Package org.joshy.gfx.draw

Examples of org.joshy.gfx.draw.Paint


    @Override
    public void changed() {
        if(shape instanceof AbstractResizeableNode) {
            AbstractResizeableNode res = (AbstractResizeableNode) shape;
            Paint paint = shape.getFillPaint();
            if(paint instanceof LinearGradientFill) {
                LinearGradientFill lg = (LinearGradientFill) paint;
                switch(lg.getStartXSnapped()) {
                    case Start: lg.setStartX(0); break;
                    case Middle: lg.setStartX(res.getBounds().getWidth() / 2); break;
View Full Code Here


    public void draw(GFX g) {
        drawShadow(g);

        double opacity = -1;
        Paint paint = this.getFillPaint();
        if(paint != null) {
            if(paint instanceof FlatColor) {
                g.setPaint(((FlatColor)paint).deriveWithAlpha(getFillOpacity()));
            }
            if(paint instanceof MultiGradientFill) {
View Full Code Here

        }
    }

    @Override
    protected void initPaint(GFX g) {
        Paint paint = this.getFillPaint();
        if(paint != null) {
            if(paint instanceof FlatColor) {
                g.setPaint(((FlatColor)paint).deriveWithAlpha(getFillOpacity()));
            }
            if(paint instanceof MultiGradientFill) {
View Full Code Here

    }

    public void draw(GFX g) {
        drawShadow(g);

        Paint paint = getFillPaint();
        if(paint != null) {
            double opacity = -1;
            if(paint instanceof FlatColor) {
                g.setPaint(((FlatColor)paint).deriveWithAlpha(getFillOpacity()));
            }
View Full Code Here

            g.setOpacity(oldOpacity);
        }
    }

    protected void initPaint(GFX g) {
        Paint paint = this.getFillPaint();
        if(paint != null) {
            if(paint instanceof FlatColor) {
                g.setPaint(((FlatColor)paint).deriveWithAlpha(getFillOpacity()));
            }
        }
View Full Code Here

        drawShadow(g);

       
        if(anyClosed()) {
            double opacity = -1;
            Paint paint = getFillPaint();
            if(paint != null) {
                if(paint instanceof FlatColor) {
                    g.setPaint(((FlatColor)paint).deriveWithAlpha(getFillOpacity()));
                }
                if(paint instanceof MultiGradientFill) {
View Full Code Here

                    dialog.hide();
                }
            };

            FillPicker picker = new FillPicker(this.manager);
            Paint pt = ((SketchDocument) context.getDocument()).getBackgroundFill();
            picker.setSelectedFill(pt);
            EventBus.getSystem().addListener(picker,ChangedEvent.ObjectChanged, new Callback<ChangedEvent>() {
                public void call(ChangedEvent event) throws Exception {
                    Paint paint = (Paint) event.getValue();
                    SketchDocument doc = (SketchDocument) context.getDocument();
                    setBackgroundFill(paint, doc);
                    context.redraw();
                }
            });
View Full Code Here

    }

    private ListView<Paint> setupGradientTab(TabPanel panel) {
        double size = 40;
        //linears
        Paint gf1 = new LinearGradientFill()
                .setStartX(0)
                .setStartXSnapped(Snap.Start)
                .setEndX(size)
                .setEndXSnapped(Snap.End)
                .setStartY(size/2)
                .setStartYSnapped(Snap.Middle)
                .setEndY(size/2)
                .setEndYSnapped(Snap.Middle)
                .addStop(0,FlatColor.BLACK)
                .addStop(1,FlatColor.WHITE);

        Paint gf2 = new LinearGradientFill()
                .setStartX(size/2).setStartXSnapped(Snap.Middle)
                .setEndX(size/2).setEndXSnapped(Snap.Middle)
                .setStartY(0).setStartYSnapped(Snap.Start)
                .setEndY(size).setEndYSnapped(Snap.End)
                .addStop(0,FlatColor.BLACK)
                .addStop(1,FlatColor.WHITE);

        Paint gf3 = new LinearGradientFill()
                .setStartX(0).setStartXSnapped(Snap.Start)
                .setEndX(size).setEndXSnapped(Snap.End)
                .setStartY(0).setStartYSnapped(Snap.Start)
                .setEndY(size).setEndYSnapped(Snap.End)
                .addStop(0,FlatColor.BLACK)
                .addStop(1,FlatColor.WHITE);

        //linears 2
        Paint gf6 = new LinearGradientFill()
                .setStartX(0).setStartXSnapped(Snap.Start)
                .setStartY(size / 2).setStartYSnapped(Snap.Middle)
                .setEndX(size).setEndXSnapped(Snap.End)
                .setEndY(size / 2).setEndYSnapped(Snap.Middle)
                .addStop(0.0, FlatColor.BLACK)
                .addStop(0.5, FlatColor.WHITE)
                .addStop(1.0, FlatColor.BLACK);

        //radials
        Paint gf4 = new RadialGradientFill()
                .setCenterX(size / 2).setCenterY(size / 2)
                .setRadius(size / 2)
                .addStop(0, FlatColor.BLACK)
                .addStop(1, FlatColor.WHITE);

        Paint gf5 = new RadialGradientFill()
                .setCenterX(size / 2).setCenterY(size / 2)
                .setRadius(size / 2)
                .addStop(0.0, FlatColor.BLACK)
                .addStop(0.5, FlatColor.WHITE)
                .addStop(1.0, FlatColor.BLACK);
View Full Code Here

        drawShadow(g);

        if(isClosed()) {
            double opacity = -1;
            Paint paint = getFillPaint();
            if(paint != null) {
                if(paint instanceof FlatColor) {
                    g.setPaint(((FlatColor)paint).deriveWithAlpha(getFillOpacity()));
                }
                if(paint instanceof MultiGradientFill) {
View Full Code Here

            SketchDocument doc = null;
            if(this.doc != null) doc = this.doc;
            if(this.context != null) doc = context.getDocument();

            Paint fill = this.backgroundFill;
            if(this.backgroundFill instanceof LinearGradientFill) {
                fill = DocumentActions.resizeTo((LinearGradientFill) this.backgroundFill,new Bounds(0,0,doc.getWidth(),doc.getHeight()));
            }
            doc.setBackgroundFill(fill);
            doc.getProperties().put("theme",this);
View Full Code Here

TOP

Related Classes of org.joshy.gfx.draw.Paint

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.