Package org.eclipse.swt.graphics

Examples of org.eclipse.swt.graphics.GC


  }

  private static final Image createCloseImage(Display display, Color bg, Color fg) {
    int size = 11, off = 1;
    Image image = new Image(display, size, size);
    GC gc = new GC(image);
    gc.setBackground(bg);
    gc.fillRectangle(image.getBounds());
    gc.setForeground(fg);
    gc.drawLine(0 + off, 0 + off, size - 1 - off, size - 1 - off);
    gc.drawLine(1 + off, 0 + off, size - 1 - off, size - 2 - off);
    gc.drawLine(0 + off, 1 + off, size - 2 - off, size - 1 - off);
    gc.drawLine(size - 1 - off, 0 + off, 0 + off, size - 1 - off);
    gc.drawLine(size - 1 - off, 1 + off, 1 + off, size - 1 - off);
    gc.drawLine(size - 2 - off, 0 + off, 0 + off, size - 2 - off);
    /*
     * gc.drawLine(1, 0, size-2, 0); gc.drawLine(1, size-1, size-2, size-1);
     * gc.drawLine(0, 1, 0, size-2); gc.drawLine(size-1, 1, size-1, size-2);
     */
    gc.dispose();
    return image;
  }
View Full Code Here



    private static Image getMissingImage() {
        Image image = new Image(Display.getCurrent(), MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE);
        //
        GC gc = new GC(image);
        gc.setBackground(getColor(SWT.COLOR_RED));
        gc.fillRectangle(0, 0, MISSING_IMAGE_SIZE, MISSING_IMAGE_SIZE);
        gc.dispose();
        //
        return image;
    }
View Full Code Here

        if (buffer != null) {
            buffer.dispose();
        }
        buffer = new Image(topshell.getDisplay(),
                c.getBounds().width, c.getBounds().height);
        GC bufferGC = new GC(buffer);
        paint(bufferGC);
        bufferGC.dispose();
    }
View Full Code Here

    public final void repaintBuffer() {
        if (buffer != null) {
            buffer.dispose();
        }
        buffer = new Image(disp, c.getBounds().width, c.getBounds().height);
        GC bufferGC = new GC(buffer);
        paint(bufferGC);
    }
View Full Code Here

        if (buffer != null) {
            buffer.dispose();
        }
        buffer = new Image(topshell.getDisplay(),
                c.getBounds().width, c.getBounds().height);
        GC bufferGC = new GC(buffer);
        paint(bufferGC);
        bufferGC.dispose();
    }
View Full Code Here

    public final void repaintBuffer() {
        if (buffer != null) {
            buffer.dispose();
        }
        buffer = new Image(disp, c.getBounds().width, c.getBounds().height);
        GC bufferGC = new GC(buffer);
        paint(bufferGC);
    }
View Full Code Here

    }

    private void onSashPaint(Event e) {
        Sash sash = (Sash) e.widget;
        boolean vertical = (sash.getStyle() & SWT.VERTICAL) != 0;
        GC gc = e.gc;
        Boolean hover = (Boolean) sash.getData("hover"); //$NON-NLS-1$
        gc.setBackground(bg);
        gc.setForeground(fg);
        Point size = sash.getSize();
        if (vertical) {
            if (hover != null)
                gc.fillRectangle(0, 0, size.x, size.y);
            // else
            // gc.drawLine(1, 0, 1, size.y-1);
        } else {
            if (hover != null)
                gc.fillRectangle(0, 0, size.x, size.y);
            // else
            // gc.drawLine(0, 1, size.x-1, 1);
        }
    }
View Full Code Here

        double[][] shading = hsa.call();
       
        int mapSize = mapInstance.getWidth();
        Device device = Display.getCurrent();
        background = new Image(device, mapSize, mapSize);
        GC gc = new GC(background);
       
        String makeRed = "MapPerProject";
       
        CodemapColors colors = new CodemapColors();
        colors.setColor(makeRed, new MColor(255, 0, 0));
        Iterable<Location> locations = mapInstance.locations();
        ColorBrewer colorBrewer = new ColorBrewer();
        for (Location location : locations) {
            MColor color = colorBrewer.forPackage(location.getDocument());
            colors.setColor(location.getDocument(), color);
        }
       
        Color black = new Color(gc.getDevice(), 0, 0, 0);
        gc.setBackground(black);
        gc.fillRectangle(gc.getClipping());
        black.dispose();       
        Image image = new FastBackgroundRenderer(DEM, shading, mapInstance, colors, device).render();       
        gc.drawImage(image, 0, 0);
       
       
        gc.setForeground(new Color(gc.getDevice(), 255, 0, 0));
        for(int x = 0; x < mapInstance.width; x++) {
            for (int y = 0; y < mapInstance.height; y++) {
                Location kdTreeNearest = mapInstance.kdTreeNearest(x, y);
                Location naiveNearest = mapInstance.naiveNearest(x, y);
                if (naiveNearest.equals(kdTreeNearest)) continue;
               
                gc.drawPoint(x, y);
//                assertEquals(naiveNearest, kdTreeNearest);
            }
        }       
       
//        gc.setForeground(new Color(gc.getDevice(), 123, 0, 0));
//        ImageData id = image.getImageData();
//        for(int x = 0; x < id.width; x++) {
//            for (int y = 0; y < id.height; y++) {
//                Location nn = mapInstance.nearestNeighbor(x, y);
//                if (! nn.getDocument().equals(makeRed)) continue;
//                gc.drawPoint(x, y);
//            }
//        }
        gc.dispose();
       
//        Location mpp = getLocation(mapInstance, "MapPerProject");
//        Location dda = getLocation(mapInstance, "ColorDropDownAction");       
//        System.out.println("Distance to MapPerProject: " +  Math.sqrt(Math.pow(575 - mpp.px, 2) + Math.pow(500 - mpp.py, 2)));
//        System.out.println("Distance to ColorDropDownAction: " + Math.sqrt(Math.pow(575 - dda.px, 2) + Math.pow(500 - dda.py, 2)));
View Full Code Here

    protected Image newCodemapImage() {
        if (canvas == null) return null;
        Point size = canvas.getSize();
        Image image = new Image(Display.getDefault(), size.x, size.y);
        GC gc = new GC(image);
        boolean success = canvas.print(gc);
        if (!success) return null;
        return image;
    }
View Full Code Here

    @Override
    public void paintControl(PaintEvent e) {
        if (!(e.widget instanceof Canvas)) throw new Error();
        try {
            GC gc = e.gc;
            Device device = gc.getDevice();
            Color waterColor = colorScheme().getWaterColor().asSWTColor(device);
            gc.setBackground(waterColor);
            gc.fillRectangle(gc.getClipping());
           
            Point bounds = ((Canvas) e.widget).getSize();
            offsetX = (bounds.x - mapValues.getSize()) / 2;
            offsetY = (bounds.y - mapValues.getSize()) / 2;
            Transform t = new Transform(device);
            t.translate(offsetX, offsetY);
            gc.setTransform(t);
           
            this.paintMap(mapValues, gc);
           
            t.dispose();
            waterColor.dispose();
View Full Code Here

TOP

Related Classes of org.eclipse.swt.graphics.GC

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.