Package org.jfree.experimental.swt

Examples of org.jfree.experimental.swt.SWTGraphics2D


        if (this.chart == null) {
            this.canvas.drawBackground(e.gc, available.x, available.y,
                    available.width, available.height);
            return;
        }
        SWTGraphics2D sg2 = new SWTGraphics2D(e.gc);

        // work out if scaling is required...
        boolean scale = false;
        int drawWidth = available.width;
        int drawHeight = available.height;
        if (drawWidth == 0.0 || drawHeight == 0.0) return;
        this.scaleX = 1.0;
        this.scaleY = 1.0;
        if (drawWidth < this.minimumDrawWidth) {
            this.scaleX = (double) drawWidth / this.minimumDrawWidth;
            drawWidth = this.minimumDrawWidth;
            scale = true;
        }
        else if (drawWidth > this.maximumDrawWidth) {
            this.scaleX = (double) drawWidth / this.maximumDrawWidth;
            drawWidth = this.maximumDrawWidth;
            scale = true;
        }
        if (drawHeight < this.minimumDrawHeight) {
            this.scaleY = (double) drawHeight / this.minimumDrawHeight;
            drawHeight = this.minimumDrawHeight;
            scale = true;
        }
        else if (drawHeight > this.maximumDrawHeight) {
            this.scaleY = (double) drawHeight / this.maximumDrawHeight;
            drawHeight = this.maximumDrawHeight;
            scale = true;
        }
        // are we using the chart buffer?
        if (this.useBuffer) {
            //SwtGraphics2D sg2 = new SwtGraphics2D(e.gc);
            this.chartBuffer = (org.eclipse.swt.graphics.Image)
                    this.canvas.getData("double-buffer-image");
            // do we need to fill the buffer?
            if (this.chartBuffer == null
                    || this.chartBufferWidth != available.width
                    || this.chartBufferHeight != available.height) {
                this.chartBufferWidth = available.width;
                this.chartBufferHeight = available.height;
                if (this.chartBuffer != null) {
                    this.chartBuffer.dispose();
                }
                this.chartBuffer = new org.eclipse.swt.graphics.Image(
                        getDisplay(), this.chartBufferWidth,
                        this.chartBufferHeight);
                this.refreshBuffer = true;
            }

            // do we need to redraw the buffer?
            if (this.refreshBuffer) {
                // Performs the actual drawing here ...
                GC gci = new GC(this.chartBuffer);
                // anti-aliasing
                if (this.chart.getAntiAlias()) {
                    gci.setAntialias(SWT.ON);
                }
                if (this.chart.getTextAntiAlias()
                        == RenderingHints.KEY_TEXT_ANTIALIASING) {
                    gci.setTextAntialias(SWT.ON);
                }
                SWTGraphics2D sg2d = new SWTGraphics2D(gci);
                if (scale) {
                    sg2d.scale(this.scaleX, this.scaleY);
                    this.chart.draw(sg2d, new Rectangle2D.Double(0, 0,
                            drawWidth, drawHeight), getAnchor(), this.info);
                }
                else {
                    this.chart.draw(sg2d, new Rectangle2D.Double(0, 0,
                            drawWidth, drawHeight), getAnchor(), this.info);
                }
                this.canvas.setData("double-buffer-image", this.chartBuffer);
                sg2d.dispose();
                gci.dispose();
                this.refreshBuffer = false;
            }

            // zap the buffer onto the canvas...
View Full Code Here


        if (this.chart == null) {
            this.canvas.drawBackground(e.gc, available.x, available.y,
                    available.width, available.height);
            return;
        }
        SWTGraphics2D sg2 = new SWTGraphics2D(e.gc);

        // work out if scaling is required...
        boolean scale = false;
        int drawWidth = available.width;
        int drawHeight = available.height;
        if (drawWidth == 0.0 || drawHeight == 0.0) return;
        this.scaleX = 1.0;
        this.scaleY = 1.0;
        if (drawWidth < this.minimumDrawWidth) {
            this.scaleX = (double) drawWidth / this.minimumDrawWidth;
            drawWidth = this.minimumDrawWidth;
            scale = true;
        }
        else if (drawWidth > this.maximumDrawWidth) {
            this.scaleX = (double) drawWidth / this.maximumDrawWidth;
            drawWidth = this.maximumDrawWidth;
            scale = true;
        }
        if (drawHeight < this.minimumDrawHeight) {
            this.scaleY = (double) drawHeight / this.minimumDrawHeight;
            drawHeight = this.minimumDrawHeight;
            scale = true;
        }
        else if (drawHeight > this.maximumDrawHeight) {
            this.scaleY = (double) drawHeight / this.maximumDrawHeight;
            drawHeight = this.maximumDrawHeight;
            scale = true;
        }
        // are we using the chart buffer?
        if (this.useBuffer) {
            //SwtGraphics2D sg2 = new SwtGraphics2D(e.gc);
            this.chartBuffer = (org.eclipse.swt.graphics.Image)
                    this.canvas.getData("double-buffer-image");
            // do we need to fill the buffer?
            if (this.chartBuffer == null
                    || this.chartBufferWidth != available.width
                    || this.chartBufferHeight != available.height) {
                this.chartBufferWidth = available.width;
                this.chartBufferHeight = available.height;
                if (this.chartBuffer != null) {
                    this.chartBuffer.dispose();
                }
                this.chartBuffer = new org.eclipse.swt.graphics.Image(
                        getDisplay(), this.chartBufferWidth,
                        this.chartBufferHeight);
                this.refreshBuffer = true;
            }

            // do we need to redraw the buffer?
            if (this.refreshBuffer) {
                // Performs the actual drawing here ...
                GC gci = new GC(this.chartBuffer);
                // anti-aliasing
                if (this.chart.getAntiAlias()) {
                    gci.setAntialias(SWT.ON);
                }
                if (this.chart.getTextAntiAlias()
                        == RenderingHints.KEY_TEXT_ANTIALIASING) {
                    gci.setTextAntialias(SWT.ON);
                }
                SWTGraphics2D sg2d = new SWTGraphics2D(gci);
                if (scale) {
                    sg2d.scale(this.scaleX, this.scaleY);
                    this.chart.draw(sg2d, new Rectangle2D.Double(0, 0,
                            drawWidth, drawHeight), getAnchor(), this.info);
                }
                else {
                    this.chart.draw(sg2d, new Rectangle2D.Double(0, 0,
                            drawWidth, drawHeight), getAnchor(), this.info);
                }
                this.canvas.setData("double-buffer-image", this.chartBuffer);
                sg2d.dispose();
                gci.dispose();
                this.refreshBuffer = false;
            }

            // zap the buffer onto the canvas...
View Full Code Here

        if (this.chart == null) {
            this.canvas.drawBackground(e.gc, available.x, available.y,
                    available.width, available.height);
            return;
        }
        SWTGraphics2D sg2 = new SWTGraphics2D(e.gc);

        // work out if scaling is required...
        boolean scale = false;
        int drawWidth = available.width;
        int drawHeight = available.height;
        if ( drawWidth == 0.0 || drawHeight == 0.0 ) return;
        this.scaleX = 1.0;
        this.scaleY = 1.0;
        if (drawWidth < this.minimumDrawWidth) {
            this.scaleX = (double) drawWidth / this.minimumDrawWidth;
            drawWidth = this.minimumDrawWidth;
            scale = true;
        }
        else if (drawWidth > this.maximumDrawWidth) {
            this.scaleX = (double) drawWidth / this.maximumDrawWidth;
            drawWidth = this.maximumDrawWidth;
            scale = true;
        }
        if (drawHeight < this.minimumDrawHeight) {
            this.scaleY = (double) drawHeight / this.minimumDrawHeight;
            drawHeight = this.minimumDrawHeight;
            scale = true;
        }
        else if (drawHeight > this.maximumDrawHeight) {
            this.scaleY = (double) drawHeight / this.maximumDrawHeight;
            drawHeight = this.maximumDrawHeight;
            scale = true;
        }
        // are we using the chart buffer?
        if (this.useBuffer) {
            //SwtGraphics2D sg2 = new SwtGraphics2D( e.gc );
            this.chartBuffer = (org.eclipse.swt.graphics.Image)
                    this.canvas.getData("double-buffer-image");
            // do we need to fill the buffer?
            if (this.chartBuffer == null
                    || this.chartBufferWidth != available.width
                    || this.chartBufferHeight != available.height ) {
                this.chartBufferWidth = available.width;
                this.chartBufferHeight = available.height;
                if (this.chartBuffer != null) {
                    this.chartBuffer.dispose();
                }
                this.chartBuffer = new org.eclipse.swt.graphics.Image(
                        getDisplay(), this.chartBufferWidth,
                        this.chartBufferHeight);
                this.refreshBuffer = true;
            }

            // do we need to redraw the buffer?
            if (this.refreshBuffer) {
                // Performs the actual drawing here ...
                GC gci = new GC(this.chartBuffer);
                // anti-aliasing
                if (this.chart.getAntiAlias()) {
                    gci.setAntialias(SWT.ON);
                }
                if (this.chart.getTextAntiAlias()
                        == RenderingHints.KEY_TEXT_ANTIALIASING) {
                    gci.setTextAntialias(SWT.ON);
                }
                SWTGraphics2D sg2d = new SWTGraphics2D(gci);
                if (scale) {
                    sg2d.scale(this.scaleX, this.scaleY);
                    this.chart.draw(sg2d, new Rectangle2D.Double(0, 0,
                            drawWidth, drawHeight), getAnchor(), this.info);                           
                }
                else {
                    this.chart.draw(sg2d, new Rectangle2D.Double(0, 0,
                            drawWidth, drawHeight), getAnchor(), this.info);                           
                }
                this.canvas.setData("double-buffer-image", this.chartBuffer);
                sg2d.dispose();
                gci.dispose();
                this.refreshBuffer = false;
            }

            // zap the buffer onto the canvas...
View Full Code Here

TOP

Related Classes of org.jfree.experimental.swt.SWTGraphics2D

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.