Package com.lightcrafts.mediax.jai

Examples of com.lightcrafts.mediax.jai.ImageLayout


     * @param renderHints  Optionally contains destination image layout.
     */
    public RenderedImage create(ParameterBlock pb,
                                RenderingHints renderHints) {
        // Get ImageLayout from renderHints if any.
        ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);
       
       
        return new LogOpImage(pb.getRenderedSource(0), renderHints, layout);
    }
View Full Code Here


     * @param paramBlock The scaling type.
     */
    public RenderedImage create(ParameterBlock paramBlock,
                                RenderingHints renderHints) {
        // Get ImageLayout from renderHints if any.
        ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);
       
       
        RenderedImage source = paramBlock.getRenderedSource(0);
        EnumeratedParameter scalingType =
            (EnumeratedParameter)paramBlock.getObjectParameter(0);
View Full Code Here

    // Set the bounds and tile grid of the output image.
    private static ImageLayout layoutHelper(ImageLayout layout,
                                            RenderedImage source,
                                            int type) {
        ImageLayout newLayout;
        if (layout != null) {
            newLayout = (ImageLayout)layout.clone();
        } else {
            newLayout = new ImageLayout();
        }

        // Set the size of the destination to exactly cover the
        // forward-mapped source image bounds
        Rectangle sourceBounds = new Rectangle(source.getMinX(),
                                               source.getMinY(),
                                               source.getWidth(),
                                               source.getHeight());
        Rectangle rect = mapRect(sourceBounds, sourceBounds, type, true);

        newLayout.setMinX(rect.x);
        newLayout.setMinY(rect.y);
        newLayout.setWidth(rect.width);
        newLayout.setHeight(rect.height);

        // Make each destination tile correspond to a source tile
        Rectangle tileRect = new Rectangle(source.getTileGridXOffset(),
                                           source.getTileGridYOffset(),
                                           source.getTileWidth(),
                                           source.getTileHeight());
        rect = mapRect(tileRect, sourceBounds, type, true);

        // Respect any pre-existing tile grid settings
        if (newLayout.isValid(ImageLayout.TILE_GRID_X_OFFSET_MASK)) {
            newLayout.setTileGridXOffset(rect.x);
        }
        if (newLayout.isValid(ImageLayout.TILE_GRID_Y_OFFSET_MASK)) {
            newLayout.setTileGridYOffset(rect.y);
        }
        if (newLayout.isValid(ImageLayout.TILE_WIDTH_MASK)) {
            newLayout.setTileWidth(Math.abs(rect.width));
        }
        if (newLayout.isValid(ImageLayout.TILE_HEIGHT_MASK)) {
            newLayout.setTileHeight(Math.abs(rect.height));
        }

        return newLayout;
    }
View Full Code Here

    public int lpad, rpad, tpad, bpad;

    private static ImageLayout layoutHelper(ImageLayout layout,
                                            RenderedImage source,
                                            AffineTransform forward_tr) {
        ImageLayout newLayout;
        if (layout != null) {
            newLayout = (ImageLayout)layout.clone();
        } else {
            newLayout = new ImageLayout();
        }

        //
        // Get sx0,sy0 coordinates & width & height of the source.
        //
        float sx0 = (float)source.getMinX();
        float sy0 = (float)source.getMinY();
        float sw = (float)source.getWidth();
        float sh = (float)source.getHeight();

        //
        // The 4 points (clockwise order) are
        //      (sx0, sy0),    (sx0+sw, sy0)
        //      (sx0, sy0+sh), (sx0+sw, sy0+sh)
        //
        Point2D[] pts = new Point2D[4];
        pts[0] = new Point2D.Float(sx0, sy0);
        pts[1] = new Point2D.Float((sx0+sw), sy0);
        pts[2] = new Point2D.Float((sx0+sw), (sy0+sh));
        pts[3] = new Point2D.Float(sx0, (sy0+sh));

        // Forward map
        forward_tr.transform(pts, 0, pts, 0, 4);

        float dx0 = Float.MAX_VALUE;
        float dy0 = Float.MAX_VALUE;
        float dx1 = -Float.MAX_VALUE;
        float dy1 = -Float.MAX_VALUE;
        for (int i = 0; i < 4; i++) {
            float px = (float)pts[i].getX();
            float py = (float)pts[i].getY();

            dx0 = Math.min(dx0, px);
            dy0 = Math.min(dy0, py);
            dx1 = Math.max(dx1, px);
            dy1 = Math.max(dy1, py);
        }

        //
        // Get the width & height of the resulting bounding box.
        // This is set on the layout
        //
        int lw = (int)(dx1 - dx0);
        int lh = (int)(dy1 - dy0);

        //
        // Set the starting integral coordinate
        // with the following criterion.
        // If it's greater than 0.5, set it to the next integral value (ceil)
        // else set it to the integral value (floor).
        //
        int lx0, ly0;

        int i_dx0 = (int)Math.floor(dx0);
        if (Math.abs(dx0 - i_dx0) <= 0.5) {
            lx0 = i_dx0;
        } else {
            lx0 = (int) Math.ceil(dx0);
        }

        int i_dy0 = (int)Math.floor(dy0);
        if (Math.abs(dy0 - i_dy0) <= 0.5) {
            ly0 = i_dy0;
        } else {
            ly0 = (int) Math.ceil(dy0);
        }

        //
        // Create the layout
        //
        newLayout.setMinX(lx0);
        newLayout.setMinY(ly0);
        newLayout.setWidth(lw);
        newLayout.setHeight(lh);

        return newLayout;
    }
View Full Code Here

     * @param hints  May contain rendering hints and destination image layout.
     */
    public RenderedImage create(ParameterBlock args,
                                RenderingHints hints) {
        /* Get ImageLayout and TileCache from RenderingHints. */
        ImageLayout layout = RIFUtil.getImageLayoutHint(hints);
       

        if (!MediaLibAccessor.isMediaLibCompatible(args, layout) ||
            !MediaLibAccessor.hasSameNumBands(args, layout)) {
            return null;
View Full Code Here

     * @param hints  May contain rendering hints and destination image layout.
     */
    public RenderedImage create(ParameterBlock args,
                                RenderingHints hints) {
        /* Get ImageLayout and TileCache from RenderingHints. */
        ImageLayout layout = RIFUtil.getImageLayoutHint(hints);
       

        if (!MediaLibAccessor.isMediaLibCompatible(args, layout) ||
            !MediaLibAccessor.hasSameNumBands(args, layout)) {
            return null;
View Full Code Here

     * @param paramBlock  The source image and the convolution kernel.
     */
    public RenderedImage create(ParameterBlock paramBlock,
                                RenderingHints renderHints) {
        // Get ImageLayout from renderHints if any.
        ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);
       

        if (!MediaLibAccessor.isMediaLibCompatible(paramBlock, layout) ||
            !MediaLibAccessor.hasSameNumBands(paramBlock, layout)) {
            return null;
View Full Code Here

     * @param hints  May contain rendering hints and destination image layout.
     */
    public RenderedImage create(ParameterBlock args,
                                RenderingHints hints) {
        /* Get ImageLayout and TileCache from RenderingHints. */
        ImageLayout layout = RIFUtil.getImageLayoutHint(hints);
       

        if (!MediaLibAccessor.isMediaLibCompatible(args, layout) ||
            !MediaLibAccessor.hasSameNumBands(args, layout)) {
            return null;
View Full Code Here

     * @param hints  May contain rendering hints and destination image layout.
     */
    public RenderedImage create(ParameterBlock args,
                                RenderingHints hints) {
        /* Get ImageLayout and TileCache from RenderingHints. */
        ImageLayout layout = RIFUtil.getImageLayoutHint(hints);
       
        Interpolation interp = (Interpolation)args.getObjectParameter(4);

  RenderedImage source = args.getRenderedSource(0);

View Full Code Here

     * @param hints  May contain rendering hints and destination image layout.
     */
    public RenderedImage create(ParameterBlock args,
                                RenderingHints hints) {
        // Get ImageLayout and TileCache from RenderingHints.
        ImageLayout layout = RIFUtil.getImageLayoutHint(hints);
       
        if (!MediaLibAccessor.isMediaLibCompatible(args, layout) ||
            !MediaLibAccessor.hasSameNumBands(args, layout)) {
            return null;
        }
View Full Code Here

TOP

Related Classes of com.lightcrafts.mediax.jai.ImageLayout

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.