Package org.eclipse.swt.graphics

Examples of org.eclipse.swt.graphics.Device


  initialize(
    Canvas     _canvas )
  {
    canvas   = _canvas;
   
    Device device = canvas.getDisplay();
   
    colours = new Color[16];
   
    HSLColor hsl = new HSLColor();
   
View Full Code Here


    }

    @Override
    public void paintControl(PaintEvent e) {
        if (mds == null) return;
        Device device = e.gc.getDevice();
        e.gc.setAntialias(SWT.ON);
        e.gc.setAlpha(128);
        e.gc.drawOval(256-zoom, 256-zoom, zoom*2, zoom*2);
        final double[][] pps = mds.points();
        if (pps == null) return;
        for (int i = 0; i < pps[0].length; i++) {
            int x = (int) (pps[0][i] * zoom + 256);
            int y = (int) (pps[1][i] * zoom + 256);
            e.gc.drawLine(x - 2, y - 2, x + 2, y + 2);
            e.gc.drawLine(x - 2, y + 2, x + 2, y - 2);
        }
        e.gc.setForeground(device.getSystemColor(SWT.COLOR_RED));
        drawEdges(e.gc);
        e.gc.setForeground(device.getSystemColor(SWT.COLOR_BLUE));
        drawHistogram(e, mds.config_dist.getHistogram());
        e.gc.setForeground(device.getSystemColor(SWT.COLOR_GREEN));
        drawHistogram(e, mds.Dtarget.getHistogram());
    }
View Full Code Here

    }

    @Override
    public void paintControl(PaintEvent e) {
        if (points == null) return;
        Device device = e.gc.getDevice();
        e.gc.setForeground(device.getSystemColor(SWT.COLOR_BLACK));
        e.gc.setAntialias(SWT.ON);
        e.gc.setAlpha(128);
        e.gc.drawOval(256-zoom, 256-zoom, zoom*2, zoom*2);
        for (int i = 0; i < points.x.length; i++) {
            int x = (int) (points.x[i] * zoom + 256);
            int y = (int) (points.y[i] * zoom + 256);
            e.gc.drawLine(x - 2, y - 2, x + 2, y + 2);
            e.gc.drawLine(x - 2, y + 2, x + 2, y - 2);
        }
        e.gc.setForeground(device.getSystemColor(SWT.COLOR_RED));
        drawEdges(e.gc);
    }
View Full Code Here

    protected void updateShellLocation(int x, int y) {
        shell.setLocation(x, y+15);
    }

    private void makeHoverShell() {
        Device device = canvas.getDisplay();
        Color backgroundColor = device.getSystemColor(SWT.COLOR_INFO_BACKGROUND);
        Color foregroundColor = device.getSystemColor(SWT.COLOR_INFO_FOREGROUND);
       
        shell = new Shell(canvas.getShell(), SWT.NO_FOCUS | SWT.ON_TOP | SWT.TOOL);
        shell.setBackground(backgroundColor);
        int border = ((canvas.getShell().getStyle() & SWT.NO_TRIM) == 0) ? 0 : 1;
        GridLayoutFactory.fillDefaults().margins(border, border).applyTo(shell);
View Full Code Here

        ShadeAlgorithm hsa = new ShadeAlgorithm();
        hsa.setMap(mapInstance);
        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";
       
View Full Code Here

    protected final int SELECTION_SIZE = 12;
    protected final int POINT_STROKE = 1

    @Override
    public void paintBefore(MapValues map, GC gc) {
        Device device = Display.getCurrent();
        gc.setForeground(device.getSystemColor(SWT.COLOR_BLACK));
        gc.setBackground(device.getSystemColor(SWT.COLOR_WHITE));
        gc.setLineWidth(POINT_STROKE);
        gc.setAlpha(255);
    }
View Full Code Here

        if (labeling == null) return;
        paintLabels(labeling, gc);
    }
   
    public void paintLabels(Labeling labeling, GC gc) {
        Device device = gc.getDevice();
        String fname = ARIAL_NARROW;
        Font basefont = new Font(device, fname, 12, SWT.NORMAL);
       
        for (Label each: labeling.labels()) {
            FontData[] fontData = basefont.getFontData();
View Full Code Here

        return map.openFilesSelection;
    }
   
    @Override
    public void paintBefore(MapValues map, GC gc) {
        Device d = gc.getDevice();
        gc.setBackground(d.getSystemColor(SWT.COLOR_WHITE));
        gc.setForeground(d.getSystemColor(SWT.COLOR_BLACK));
        gc.setLineWidth(1);
        gc.setAntialias(SWT.ON);
    }
View Full Code Here

    public void paintBefore(MapValues map, GC gc) {
        image = descriptor(MEEPLE).createImage();
        bounds = image.getBounds();       
        diameter = (int) Math.sqrt(bounds.width * bounds.width + bounds.height * bounds.height);
       
        Device d = gc.getDevice();
        gc.setBackground(d.getSystemColor(SWT.COLOR_WHITE));
        gc.setForeground(d.getSystemColor(SWT.COLOR_BLACK));
        gc.setLineWidth(1);
        gc.setAntialias(SWT.ON);       
    }
View Full Code Here

        return .5;
    }

    @Override
    public void renderLabel(GC gc, String text, Rectangle bounds) {
        Device device = gc.getDevice();
        gc.setAlpha(128);
        gc.setForeground(device.getSystemColor(SWT.COLOR_BLACK));
        gc.drawText(text, bounds.x + 1, bounds.y + 1, SWT.DRAW_TRANSPARENT);
        gc.setAlpha(255);
       
        gc.setForeground(device.getSystemColor(SWT.COLOR_WHITE));
        gc.drawText(text, bounds.x, bounds.y, SWT.DRAW_TRANSPARENT);
    }
View Full Code Here

TOP

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

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.