Package sun.java2d

Examples of sun.java2d.SunGraphics2D


    public void paintTrack( Graphics g ) {
        final boolean isEnabled = slider.isEnabled();
        final boolean isHorizontal =
            slider.getOrientation() == JSlider.HORIZONTAL;
        final SunGraphics2D g2d = Utils.getGraphics2D(
            g, trackRect.x, trackRect.y, trackRect.width, trackRect.height
        );
        if ( g2d == null )
            return;

        final Color oldColor = g2d.getColor();
        final Stroke oldStroke = g2d.getStroke();
        g2d.setStroke(TRACK_STROKE);

        for ( int i = 0; i < 3; ++i ) {
            if ( isEnabled )
                g2d.setColor(
                    new Color(
                        TRACK_COLORS[i],
                        TRACK_COLORS[i],
                        TRACK_COLORS[i]
                    )
                );
            else
                g2d.setColor( Color.lightGray );

            final int lOff = i == 1 ? 0 : -1;
            if ( isHorizontal )
                g2d.drawLine(
                    (int)trackRect.getMinX() - lOff,
                    (int)trackRect.getCenterY() + i - 1,
                    (int)trackRect.getMaxX() + lOff,
                    (int)trackRect.getCenterY() + i - 1
                );
            else
                g2d.drawLine(
                    (int)trackRect.getCenterX() + i - 1,
                    (int)trackRect.getMinY() - lOff,
                    (int)trackRect.getCenterX() + i - 1,
                    (int)trackRect.getMaxY() + lOff
                );
        }

        g2d.setStroke( oldStroke );
        g2d.setColor( oldColor );
    }
View Full Code Here


        g2d.drawRenderedImage(buf, AffineTransform.getTranslateInstance(3, 2));
        g2d.dispose();
    }

    public void paintThumb( Graphics g ) {
        final SunGraphics2D g2d = Utils.getGraphics2D(
            g, thumbRect.x, thumbRect.y, thumbRect.width, thumbRect.height
        );
        if ( g2d != null ) {
            g2d.drawImage(triangleThumb, null, thumbRect.x-1, thumbRect.y);
        }
    }
View Full Code Here

            revalidate();
            Image backBuffer = getBackBuffer();
            if (backBuffer == null) {
                return getGraphics();
            }
            SunGraphics2D g = (SunGraphics2D)backBuffer.getGraphics();
            g.constrain(-insets.left, -insets.top,
                        backBuffer.getWidth(null) + insets.left,
                        backBuffer.getHeight(null) + insets.top);
            return g;
        }
View Full Code Here

            revalidate();
            Image backBuffer = getBackBuffer();
            if (backBuffer == null) {
                return getGraphics();
            }
            SunGraphics2D g = (SunGraphics2D)backBuffer.getGraphics();
            g.constrain(-insets.left, -insets.top,
                        backBuffer.getWidth(null) + insets.left,
                        backBuffer.getHeight(null) + insets.top);
            return g;
        }
View Full Code Here

    }

    public void renderPathTile(Object context,
                               byte[] atile, int offset, int tilesize,
                               int x, int y, int w, int h) {
        SunGraphics2D sg = (SunGraphics2D) context;

        sg.alphafill.MaskFill(sg, sg.getSurfaceData(), sg.composite,
                              x, y, w, h,
                              atile, offset, tilesize);
    }
View Full Code Here

    public void renderPathTile(Object ctx,
                               byte[] atile, int offset, int tilesize,
                               int x, int y, int w, int h) {
        TileContext context = (TileContext) ctx;
        PaintContext paintCtxt = context.paintCtxt;
        SunGraphics2D sg = context.sunG2D;
        SurfaceData dstData = context.dstData;
        SurfaceData srcData = null;
        Raster lastRas = null;
        if (context.lastData != null && context.lastRaster != null) {
            srcData = (SurfaceData) context.lastData.get();
View Full Code Here

            revalidate();
            Image backBuffer = getBackBuffer();
            if (backBuffer == null) {
                return getGraphics();
            }
            SunGraphics2D g = (SunGraphics2D)backBuffer.getGraphics();
            g.constrain(-insets.left, -insets.top,
                        backBuffer.getWidth(null) + insets.left,
                        backBuffer.getHeight(null) + insets.top);
            return g;
        }
View Full Code Here

                                    Rectangle devR, int[] bbox) {
            return sg;
        }

        public void renderBox(Object ctx, int x, int y, int w, int h) {
            SunGraphics2D sg2d = (SunGraphics2D) ctx;
            SurfaceData sd = sg2d.getSurfaceData();
            sg2d.loops.fillRectLoop.FillRect(sg2d, sd, x, y, w, h);
        }
View Full Code Here

                               byte[] atile, int offset, int tilesize,
                               int x, int y, int w, int h) {
        TileContext context = (TileContext) ctx;
        PaintContext paintCtxt = context.paintCtxt;
        CompositeContext compCtxt = context.compCtxt;
        SunGraphics2D sg = context.sunG2D;

        Raster srcRaster = paintCtxt.getRaster(x, y, w, h);
        ColorModel paintModel = paintCtxt.getColorModel();

        Raster dstRaster;
        Raster dstIn;
        WritableRaster dstOut;

        SurfaceData sd = sg.getSurfaceData();
        dstRaster = sd.getRaster(x, y, w, h);
        if (dstRaster instanceof WritableRaster && atile == null) {
            dstOut = (WritableRaster) dstRaster;
            dstOut = dstOut.createWritableChild(x, y, w, h, 0, 0, null);
            dstIn = dstOut;
        } else {
            dstIn = dstRaster.createChild(x, y, w, h, 0, 0, null);
            dstOut = dstIn.createCompatibleWritableRaster();
        }

        compCtxt.compose(srcRaster, dstIn, dstOut);

        if (dstRaster != dstOut && dstOut.getParent() != dstRaster) {
            if (dstRaster instanceof WritableRaster && atile == null) {
                ((WritableRaster) dstRaster).setDataElements(x, y, dstOut);
            } else {
                ColorModel cm = sg.getDeviceColorModel();
                BufferedImage resImg =
                    new BufferedImage(cm, dstOut,
                                      cm.isAlphaPremultiplied(),
                                      null);
                SurfaceData resData = BufImgSurfaceData.createData(resImg);
View Full Code Here

                dstModel.createCompatibleWritableRaster(width, height);
            boolean isPremult = dstModel.isAlphaPremultiplied();
            BufferedImage bimg =
                new BufferedImage(dstModel, wr, isPremult, null);
            SurfaceData tmpData = BufImgSurfaceData.createData(bimg);
            SunGraphics2D sg2d = new SunGraphics2D(tmpData, bgColor, bgColor,
                                                   defaultFont);
            FillRect fillop = FillRect.locate(SurfaceType.AnyColor,
                                              CompositeType.SrcNoEa,
                                              tmpData.getSurfaceType());
            Blit combineop = Blit.getFromCache(srcData.getSurfaceType(),
View Full Code Here

TOP

Related Classes of sun.java2d.SunGraphics2D

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.