FileDocCategorySizeDatePackage
RenderableImageOp.javaAPI DocAndroid 1.5 API5520Wed May 06 22:41:54 BST 2009java.awt.image.renderable

RenderableImageOp

public class RenderableImageOp extends Object implements RenderableImage
The Class RenderableImageOp is a basic implementation of RenderableImage, with methods to access the parameter data and perform rendering operations.
since
Android 1.0

Fields Summary
ContextualRenderedImageFactory
CRIF
The CRIF.
ParameterBlock
paramBlock
The param block.
float
minX
The height.
float
minY
float
width
float
height
Constructors Summary
public RenderableImageOp(ContextualRenderedImageFactory CRIF, ParameterBlock paramBlock)
Instantiates a new renderable image op.

param
CRIF the cRIF.
param
paramBlock the param block.

        this.CRIF = CRIF;
        this.paramBlock = (ParameterBlock)paramBlock.clone();
        Rectangle2D r = CRIF.getBounds2D(paramBlock);
        minX = (float)r.getMinX();
        minY = (float)r.getMinY();
        width = (float)r.getWidth();
        height = (float)r.getHeight();
    
Methods Summary
public java.awt.image.RenderedImagecreateDefaultRendering()

        AffineTransform at = new AffineTransform();
        RenderContext context = new RenderContext(at);
        return createRendering(context);
    
public java.awt.image.RenderedImagecreateRendering(java.awt.image.renderable.RenderContext renderContext)


        Vector<RenderableImage> sources = getSources();
        ParameterBlock rdParam = (ParameterBlock)paramBlock.clone();

        if (sources != null) {
            Vector<Object> rdSources = new Vector<Object>();
            int i = 0;
            while (i < sources.size()) {
                RenderContext newContext = CRIF
                        .mapRenderContext(i, renderContext, paramBlock, this);
                RenderedImage rdim = sources.elementAt(i).createRendering(newContext);

                if (rdim != null) {
                    rdSources.addElement(rdim);
                }
                i++;
            }
            if (rdSources.size() > 0) {
                rdParam.setSources(rdSources);
            }
        }
        return CRIF.create(renderContext, rdParam);
    
public java.awt.image.RenderedImagecreateScaledRendering(int w, int h, java.awt.RenderingHints hints)

        if (w == 0 && h == 0) {
            // awt.60=Width and Height mustn't be equal zero both
            throw new IllegalArgumentException(Messages.getString("awt.60")); //$NON-NLS-1$
        }
        if (w == 0) {
            w = Math.round(h * (getWidth() / getHeight()));
        }

        if (h == 0) {
            h = Math.round(w * (getHeight() / getWidth()));
        }

        double sx = (double)w / getWidth();
        double sy = (double)h / getHeight();

        AffineTransform at = AffineTransform.getScaleInstance(sx, sy);
        RenderContext context = new RenderContext(at, hints);
        return createRendering(context);
    
public floatgetHeight()

        return height;
    
public floatgetMinX()

        return minX;
    
public floatgetMinY()

        return minY;
    
public java.awt.image.renderable.ParameterBlockgetParameterBlock()
Gets the parameter block.

return
the parameter block

        return paramBlock;
    
public java.lang.ObjectgetProperty(java.lang.String name)

        return CRIF.getProperty(paramBlock, name);
    
public java.lang.String[]getPropertyNames()

        return CRIF.getPropertyNames();
    
public java.util.VectorgetSources()

        if (paramBlock.getNumSources() == 0) {
            return null;
        }
        Vector<RenderableImage> v = new Vector<RenderableImage>();
        int i = 0;
        while (i < paramBlock.getNumSources()) {
            Object o = paramBlock.getSource(i);
            if (o instanceof RenderableImage) {
                v.addElement((RenderableImage)o);
            }
            i++;
        }
        return v;
    
public floatgetWidth()

        return width;
    
public booleanisDynamic()

        return CRIF.isDynamic();
    
public java.awt.image.renderable.ParameterBlocksetParameterBlock(java.awt.image.renderable.ParameterBlock paramBlock)
Sets the parameter block.

param
paramBlock the param block.
return
the parameter block.

        ParameterBlock oldParam = this.paramBlock;
        this.paramBlock = (ParameterBlock)paramBlock.clone();
        return oldParam;