Package org.apache.myfaces.trinidadinternal.image.painter

Examples of org.apache.myfaces.trinidadinternal.image.painter.Painter


        if (!isRenderable(imageContext, requestedProperties))
        {
          return null;
        }

        Painter painter = getPainter(imageContext, requestedProperties);

        // First we measure the preferred size using a dummy image of
        // size 1x1 - we need this image to get the Graphics obejct
        // for measuring.
        BufferedImage measureImage = createImage(1, 1);

        // Create a PaintContext to use for measuring
        PaintContext measureContext = createPaintContext(imageContext,
                                                         measureImage,
                                                         requestedProperties,
                                                         responseProperties);

        // Get a measurement for the requested image
        Dimension d = painter.getPreferredSize(measureContext);

        int width = d.width;
        int height = d.height;

        // We're done with the measure image and context - free them up
        measureImage.flush();
        disposePaintContext(measureContext);

        // Now that we know how big the image should be, create the image
        // that we'll use for painting
        BufferedImage paintImage = createImage(width, height);

        // Create a PaintContext to use for drawing
        PaintContext paintContext = createPaintContext(imageContext,
                                                       paintImage,
                                                       requestedProperties,
                                                       responseProperties);

        // Fill in the image with the surrounding color
        Graphics g = paintContext.getPaintGraphics();
        Color oldColor = g.getColor();
        g.setColor(paintContext.getSurroundingColor());
        g.fillRect(0, 0, width, height);
        g.setColor(oldColor);

        // Paint the image
        painter.paint(paintContext, g, 0, 0, width, height);

        // Now that we are done painting, dispose the PaintContext
        disposePaintContext(paintContext);

        // Store width/height for client
View Full Code Here


    Dimension bottomSize = _getImageSize(context,
                                         _BOTTOM_BACKGROUND_IMAGE_KEY);

    // Need to get height of wrapped contents in order to figure out
    // top/bottom insets.
    Painter wrappedPainter = getWrappedPainter(context);
    Dimension innerSize = wrappedPainter.getPreferredSize(context);

    int topInset = topSize.height;
    int bottomInset = bottomSize.height;

    int innerHeight = innerSize.height + topInset + bottomInset;
View Full Code Here

    Dimension bottomSize = _getImageSize(context,
                                         _BOTTOM_BACKGROUND_IMAGE_KEY);

    // Need to get height of wrapped contents in order to figure out
    // top/bottom insets.
    Painter wrappedPainter = getWrappedPainter(context);
    Dimension innerSize = wrappedPainter.getPreferredSize(context);

    int topInset = topSize.height;
    int bottomInset = bottomSize.height;

    int innerHeight = innerSize.height + topInset + bottomInset;
View Full Code Here

        if (!isRenderable(imageContext, requestedProperties))
        {
          return null;
        }

        Painter painter = getPainter(imageContext, requestedProperties);

        // First we measure the preferred size using a dummy image of
        // size 1x1 - we need this image to get the Graphics obejct
        // for measuring.
        BufferedImage measureImage = createImage(1, 1);

        // Create a PaintContext to use for measuring
        PaintContext measureContext = createPaintContext(imageContext,
                                                         measureImage,
                                                         requestedProperties,
                                                         responseProperties);

        // Get a measurement for the requested image
        Dimension d = painter.getPreferredSize(measureContext);

        int width = d.width;
        int height = d.height;

        // We're done with the measure image and context - free them up
        measureImage.flush();
        disposePaintContext(measureContext);

        // Now that we know how big the image should be, create the image
        // that we'll use for painting
        BufferedImage paintImage = createImage(width, height);

        // Create a PaintContext to use for drawing
        PaintContext paintContext = createPaintContext(imageContext,
                                                       paintImage,
                                                       requestedProperties,
                                                       responseProperties);

        // Fill in the image with the surrounding color
        Graphics g = paintContext.getPaintGraphics();
        Color oldColor = g.getColor();
        g.setColor(paintContext.getSurroundingColor());
        g.fillRect(0, 0, width, height);
        g.setColor(oldColor);

        // Paint the image
        painter.paint(paintContext, g, 0, 0, width, height);

        // Now that we are done painting, dispose the PaintContext
        disposePaintContext(paintContext);

        // Store width/height for client
View Full Code Here

        if (!isRenderable(imageContext, requestedProperties))
        {
          return null;
        }

        Painter painter = getPainter(imageContext, requestedProperties);

        // First we measure the preferred size using a dummy image of
        // size 1x1 - we need this image to get the Graphics obejct
        // for measuring.
        BufferedImage measureImage = createImage(1, 1);

        // Create a PaintContext to use for measuring
        PaintContext measureContext = createPaintContext(imageContext,
                                                         measureImage,
                                                         requestedProperties,
                                                         responseProperties);

        // Get a measurement for the requested image
        Dimension d = painter.getPreferredSize(measureContext);

        int width = d.width;
        int height = d.height;

        // We're done with the measure image and context - free them up
        measureImage.flush();
        disposePaintContext(measureContext);

        // Now that we know how big the image should be, create the image
        // that we'll use for painting
        BufferedImage paintImage = createImage(width, height);

        // Create a PaintContext to use for drawing
        PaintContext paintContext = createPaintContext(imageContext,
                                                       paintImage,
                                                       requestedProperties,
                                                       responseProperties);

        // Fill in the image with the surrounding color
        Graphics g = paintContext.getPaintGraphics();
        Color oldColor = g.getColor();
        g.setColor(paintContext.getSurroundingColor());
        g.fillRect(0, 0, width, height);
        g.setColor(oldColor);

        // Paint the image
        painter.paint(paintContext, g, 0, 0, width, height);

        // Now that we are done painting, dispose the PaintContext
        disposePaintContext(paintContext);

        // Store width/height for client
View Full Code Here

    Dimension bottomSize = _getImageSize(context,
                                         _BOTTOM_BACKGROUND_IMAGE_KEY);

    // Need to get height of wrapped contents in order to figure out
    // top/bottom insets.
    Painter wrappedPainter = getWrappedPainter(context);
    Dimension innerSize = wrappedPainter.getPreferredSize(context);

    int topInset = topSize.height;
    int bottomInset = bottomSize.height;

    int innerHeight = innerSize.height + topInset + bottomInset;
View Full Code Here

TOP

Related Classes of org.apache.myfaces.trinidadinternal.image.painter.Painter

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.