Package org.joshy.gfx.draw

Examples of org.joshy.gfx.draw.FlatColor


            ,sdoc.getUnits().toPixels(sdoc.getHeight()));
    }

    private void drawDocumentGrid(GFX g, SketchDocument sdoc) {
        if(!sdoc.isGridActive()) return;
        g.setPaint(new FlatColor(0.8,0.8,0.8,1.0));
        double w = sdoc.getUnits().toPixels(sdoc.getWidth());
        double gw = sdoc.getUnits().toPixels(sdoc.getGridWidth());
        double h = sdoc.getUnits().toPixels(sdoc.getHeight());
        double gh = sdoc.getUnits().toPixels(sdoc.getGridHeight());
        for(int i=0; i<w; i+=gw) {
View Full Code Here


        }
    }

    public void drawSelection(GFX g, SNode shape) {
        if(shape == null) return;
        g.setPaint(new FlatColor(1.0,0.5,0.5,0.5));
        Bounds bounds = shape.getTransformedBounds();
        bounds = transformToDrawing(bounds);
        g.setStrokeWidth(3);
        g.drawRect(bounds.getX(),bounds.getY(),bounds.getWidth(),bounds.getHeight());
        g.setStrokeWidth(1);
        g.setPaint(new FlatColor(0.5,0.2,0.2,1.0));
        g.drawRect(bounds.getX(),bounds.getY(),bounds.getWidth(),bounds.getHeight());
    }
View Full Code Here

                double t = y1;
                y1 = y2;
                y2 = t;
            }

            g.setPaint(new FlatColor(0.1,0.2,1.0,0.1));
            g.fillRect(x1,y1,x2-x1,y2-y1);
            g.setPaint(new FlatColor(0.1,0.2,1.0,0.8));
            g.drawRect(x1,y1,x2-x1,y2-y1);
        }

        for(SNode shape : tempSelection) {
            if(shape instanceof SResizeableNode) {
                context.getSketchCanvas().drawSelection(g, shape);
            }
        }


        //draw a hover over the hovered handle
        if(hoverHandle != null) {
            Point2D.Double pt = context.getSketchCanvas().transformToDrawing(hoverHandle.getX(),hoverHandle.getY());
            DrawUtils.drawStandardHandle(g,pt.x,pt.y,FlatColor.RED);
        }

        //draw an indicator for all link nodes
        for(SNode node : context.getDocument().getCurrentPage().getNodes()) {
            if(!node.isLink()) continue;
            Bounds bds = node.getTransformedBounds();
            g.translate(bds.getX2(), bds.getY2());
            g.setPaint(FlatColor.WHITE);
            g.fillRoundRect(0,0,30,15,10,10);
            g.setPaint(FlatColor.BLACK);
            g.drawRoundRect(0,0,30,15,10,10);
            g.drawText("Go!",Font.DEFAULT,3,12);
            g.translate(-bds.getX2(), -bds.getY2());
        }

        //draw the move position indicator
        if(!showIndicator) return;
        Bounds sb = context.getSketchCanvas().selection.calculateBounds();
        String l1 = "";
        String l2 = "";
        if(selectedHandle != null) {
            String[] lines = selectedHandle.customStatusLines();
            if(lines == null || lines.length < 1) {
                l1 = "w: "+moveInfoFormatter.format(sb.getWidth());
                l2 = "h: "+moveInfoFormatter.format(sb.getHeight());
            } else {
                if(lines.length >= 1) l1 = lines[0];
                if(lines.length >= 2) l2 = lines[1];
            }
        } else {
            l1 = "x: "+moveInfoFormatter.format(sb.getX());
            l2 = "y: "+moveInfoFormatter.format(sb.getY());
        }
        sb = context.getSketchCanvas().transformToDrawing(sb);

        g.setPaint(FlatColor.hsb(0,0,0.6,ido));
        g.fillRoundRect(sb.getX()+sb.getWidth()+20,sb.getY()+sb.getHeight()/2-20,50,40,10,10);
        g.setPaint(new FlatColor(1.0,1.0,1.0,ido));
        g.drawText(l1,moveInfoFont,sb.getX()+sb.getWidth()+20+10,sb.getY()+sb.getHeight()/2-20+15);
        g.drawText(l2,moveInfoFont,sb.getX()+sb.getWidth()+20+10,sb.getY()+sb.getHeight()/2-20+15+15);
        g.setPaint(FlatColor.hsb(0,0,0.4,ido));
        g.drawRoundRect(sb.getX()+sb.getWidth()+20,sb.getY()+sb.getHeight()/2-20,50,40,10,10);
    }
View Full Code Here

    public static void drawStandardHandle(GFX g, double x, double y, FlatColor color) {
        double s = 0;
        //shadow
        s = 7;
        g.setPaint(new FlatColor(0x404040).deriveWithAlpha(0.5));
        g.fillOval(x-s,y-s+1,s*2,s*2);
        //border
        s = 7;
        g.setPaint(FlatColor.WHITE);
        g.fillOval(x-s,y-s,s*2,s*2);
 
View Full Code Here

    public static void drawTriangleHandle(GFX g, double x, double y, FlatColor color, boolean vertical) {
        double s = 0;
        double yoff = 0;
        if(vertical) {
            //shadow
            g.setPaint(new FlatColor(0x404040).deriveWithAlpha(0.5));
            s = 14;
            yoff = 1;
            g.fillPolygon(new double[]{0.0-s/2,0.0+yoff, s/2,0.0 +yoff,0,s+yoff});

            //border
            g.setPaint(FlatColor.WHITE);
            s = 14;
            yoff = 0;
            g.fillPolygon(new double[]{0.0-s/2,0.0+yoff, s/2,0.0 +yoff,0,s+yoff});
            //center
            s = 10;
            yoff = 1;
            double hue = color.getHue();
            MultiGradientFill fill = new LinearGradientFill()
                    .setStartX(0).setEndX(0).setStartY(0).setEndY(s)
                    .addStop(0,FlatColor.hsb(hue,0.4,1.0))
                    .addStop(1,FlatColor.hsb(hue,1.0,1.0))
                    ;
            g.setPaint(fill);
            g.translate(0,0);
            g.fillPolygon(new double[]{0.0-s/2,0.0+yoff, s/2,0.0 +yoff,0,s+yoff});
            g.translate(0,0);
        } else {
            //shadow
            g.setPaint(new FlatColor(0x404040).deriveWithAlpha(0.5));
            s = 14;
            yoff = 1;
            g.fillPolygon(new double[]{0.0+yoff, 0.0-s/2, 0.0+yoff, s/2,0.0+s +yoff,0});

View Full Code Here

                    gfx.setClipRect(oldClip);
                }
                gfx.setPaint(FlatColor.BLACK);
                gfx.drawRect(0,0,width,height);
                if(listView.getSelectedIndex() == index) {
                    gfx.setPaint(new FlatColor(0.8,0.8,1.0,0.5));
                    gfx.fillRect(0,0,width,height);
                }
                gfx.translate(-x,-y);
            }
        });
View Full Code Here

        Point2D pt = NodeUtils.convertToScene(this, 0, getHeight());

        double x = pt.getX();
        double y = pt.getY();
        if(recenterOnSelect) {
            FlatColor color = this.getSelectedColor();
            popup.positionAt(x, y, color);
        } else {
            popup.setTranslateX(x);
            popup.setTranslateY(y);
        }
View Full Code Here

        if(sfill.equals("none")) {
            shape.setFillPaint(null);
            return;
        }
        if(sfill.startsWith("#")) {
            shape.setFillPaint(new FlatColor(sfill));
            return;
        }
        u.p("trouble parsing fill: " + sfill);
    }
View Full Code Here

        String sstroke = root.attr("stroke");
        if(sstroke.equals("none")) {
            shape.setStrokePaint(null);
        }
        if(sstroke.startsWith("#")) {
            shape.setStrokePaint(new FlatColor(sstroke));
        }

        if(!root.hasAttr("stroke-width")) {
            shape.setStrokeWidth(1);
        } else {
View Full Code Here

                    }
                    gfx.setPaint(FlatColor.WHITE);
                    drawWrappedText(gfx, item.getTitle(), Font.name("Helvetica").size(12).resolve(),x+80,y+17,110);
                }
                if(index == listView.getSelectedIndex()) {
                    gfx.setPaint(new FlatColor(1.0,1.0,1.0,0.2));
                    gfx.fillRect(x,y,width,height);
                }
                gfx.setPaint(FlatColor.WHITE);
                gfx.drawRect(x,y,width,height);
            }
View Full Code Here

TOP

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

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.