package ru.m.puzzlez.render.mask;

import flash.display.Shape;
import flash.geom.Rectangle;
import ru.m.puzzlez.core.Part;


class PartMask extends Shape {

    public var rect(default, null):Rectangle;

    public function new(rect:Rectangle, bounds:Bounds) {
        super();
        graphics.beginFill(0xff00ff, 1);
        var path = new ClassicMaskBuilder().build(rect, bounds);
        graphics.drawPath(path.commands, path.data);
        graphics.endFill();
        this.rect = rect.clone();
        var offset = rect.width / 4 + rect.width * 0.05;
        this.rect.x -= offset;
        this.rect.y -= offset;
        this.rect.width += offset * 2;
        this.rect.height += offset * 2;
    }
}
