Top Methods
com.sun.prism

public Interface MaskTextureGraphics

extends Graphics
Known Direct Implementers
com.sun.prism.impl.ps.BaseShaderGraphics, com.sun.prism.j2d.J2DPrismGraphics

Method Summary

Modifier and TypeMethod and Description
public void
drawPixelsMasked(RTTexture
the texture containing the source image pixels
imgtex
,
RTTexture
the texture containing the mask pixels, only the alpha channel is used from this texture
masktex
,
int
the X coordinate of the UL destination pixel
dx
,
int
the Y coordinate of the UL destination pixel
dy
,
int
the width of the pixel regions to be combined
dw
,
int
the height of the pixel regions to be combined
dh
,
int
the X coordinate of the UL pixel in the image texture
ix
,
int
the Y coordinate of the UL pixel in the image texture
iy
,
int
the X coordinate of the UL pixel in the mask texture
mx
,
int
the Y coordinate of the UL pixel in the mask texture
my
)

Apply a mask to the pixels of an image and render the results onto the destination in device space.

public void
maskInterpolatePixels(RTTexture
the texture containing the source image pixels
imgtex
,
RTTexture
the texture containing the mask pixels, only the alpha channel is used from this texture
masktex
,
int
the X coordinate of the UL destination pixel
dx
,
int
the Y coordinate of the UL destination pixel
dy
,
int
the width of the pixel regions to be combined
dw
,
int
the height of the pixel regions to be combined
dh
,
int
the X coordinate of the UL pixel in the image texture
ix
,
int
the Y coordinate of the UL pixel in the image texture
iy
,
int
the X coordinate of the UL pixel in the mask texture
mx
,
int
the Y coordinate of the UL pixel in the mask texture
my
)

Use a mask to determine which pixels of an image are to be rendered onto the destination in device space.

Inherited from com.sun.prism.Graphics:
blitclearclearclearQuaddrawdrawColorGlyphdrawEllipsedrawLinedrawMappedTextureRawdrawRectdrawRoundRectdrawStringdrawTexturedrawTexturedrawTexture3SliceHdrawTexture3SliceVdrawTexture9SlicedrawTextureRawdrawTextureVOfillfillEllipsefillQuadfillRectfillRoundRectgetAssociatedScreengetCameraNoClonegetClipRectgetClipRectIndexgetClipRectNoClonegetCompositeModegetExtraAlphagetFinalClipNoClonegetLightsgetPaintgetPixelScaleFactorXgetPixelScaleFactorYgetRenderRootgetRenderTargetgetResourceFactorygetStrokegetTransformNoClonehasPreCullingBitsisAlphaTestShaderisAntialiasedShapeisDepthBufferisDepthTestisState3DscalescalesetAntialiasedShapesetCamerasetClipRectsetClipRectIndexsetCompositeModesetDepthBuffersetDepthTestsetExtraAlphasetHasPreCullingBitssetLightssetNodeBoundssetPaintsetPerspectiveTransformsetPixelScaleFactorssetRenderRootsetState3DsetStrokesetTransformsetTransformsetTransform3Dsetup3DRenderingsynctransformtranslatetranslate

Method Detail

drawPixelsMaskedback to summary
public void drawPixelsMasked(RTTexture imgtex, RTTexture masktex, int dx, int dy, int dw, int dh, int ix, int iy, int mx, int my)

Apply a mask to the pixels of an image and render the results onto the destination in device space. All coordinates specify pixel coordinates and are integers to reinforce the fact that these are pixel operations, not coordinate rendering operations.

The image texture is combined with the mask texture by multiplying the pixels in the image texture by the alpha in the mask texture and then the result is applied to the destination using the current compositing rule (which should likely be SrcOver in most cases).

    dst.argb = (img.argb * mask.a) Composite dst.argb
Parameters
imgtex:RTTexture

the texture containing the source image pixels

masktex:RTTexture

the texture containing the mask pixels, only the alpha channel is used from this texture

dx:int

the X coordinate of the UL destination pixel

dy:int

the Y coordinate of the UL destination pixel

dw:int

the width of the pixel regions to be combined

dh:int

the height of the pixel regions to be combined

ix:int

the X coordinate of the UL pixel in the image texture

iy:int

the Y coordinate of the UL pixel in the image texture

mx:int

the X coordinate of the UL pixel in the mask texture

my:int

the Y coordinate of the UL pixel in the mask texture

maskInterpolatePixelsback to summary
public void maskInterpolatePixels(RTTexture imgtex, RTTexture masktex, int dx, int dy, int dw, int dh, int ix, int iy, int mx, int my)

Use a mask to determine which pixels of an image are to be rendered onto the destination in device space. All coordinates specify pixel coordinates and are integers to reinforce the fact that these are pixel operations, not coordinate rendering operations.

The mask texture controls the contribution of source and destination pixels in the resulting output. Note that a simple multiply of the source texture by the mask texture may not produce the correct masking operation for the case where a non-SrcOver blending mode is in use. In those conditions, it is more accurate to first compute the result of blending the source into the destination and to then use this method to choose how much of the result should be taken from the results of the blending and how much should remain the original destination pixel value. Mathematically, the mask alpha controls a linear interpolation between the image and destination pixels.

    dst.argb = (mask.a * img.argb) + ((1 - mask.a) * dst.argb)
Note that the current composite mode is ignored during this operation.
Parameters
imgtex:RTTexture

the texture containing the source image pixels

masktex:RTTexture

the texture containing the mask pixels, only the alpha channel is used from this texture

dx:int

the X coordinate of the UL destination pixel

dy:int

the Y coordinate of the UL destination pixel

dw:int

the width of the pixel regions to be combined

dh:int

the height of the pixel regions to be combined

ix:int

the X coordinate of the UL pixel in the image texture

iy:int

the Y coordinate of the UL pixel in the image texture

mx:int

the X coordinate of the UL pixel in the mask texture

my:int

the Y coordinate of the UL pixel in the mask texture