public interface MaskTextureGraphics extends Graphics
Modifier and Type | Method and Description |
---|---|
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.
|
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.
|
blit, clear, clear, clearQuad, draw, drawEllipse, drawLine, drawMappedTextureRaw, drawRect, drawRoundRect, drawString, drawTexture, drawTexture, drawTexture3SliceH, drawTexture3SliceV, drawTexture9Slice, drawTextureRaw, drawTextureVO, fill, fillEllipse, fillQuad, fillRect, fillRoundRect, getAssociatedScreen, getCameraNoClone, getClipRect, getClipRectIndex, getClipRectNoClone, getCompositeMode, getExtraAlpha, getFinalClipNoClone, getLights, getPaint, getPixelScaleFactor, getRenderRoot, getRenderTarget, getResourceFactory, getStroke, getTransformNoClone, hasPreCullingBits, isAlphaTestShader, isAntialiasedShape, isDepthBuffer, isDepthTest, isState3D, scale, scale, setAntialiasedShape, setCamera, setClipRect, setClipRectIndex, setCompositeMode, setDepthBuffer, setDepthTest, setExtraAlpha, setHasPreCullingBits, setLights, setNodeBounds, setPaint, setPerspectiveTransform, setPixelScaleFactor, setRenderRoot, setState3D, setStroke, setTransform, setTransform, setTransform3D, setup3DRendering, sync, transform, translate, translate
void drawPixelsMasked(RTTexture imgtex, RTTexture masktex, int dx, int dy, int dw, int dh, int ix, int iy, int mx, int my)
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
imgtex
- the texture containing the source image pixelsmasktex
- the texture containing the mask pixels, only the
alpha channel is used from this texturedx
- the X coordinate of the UL destination pixeldy
- the Y coordinate of the UL destination pixeldw
- the width of the pixel regions to be combineddh
- the height of the pixel regions to be combinedix
- the X coordinate of the UL pixel in the image textureiy
- the Y coordinate of the UL pixel in the image texturemx
- the X coordinate of the UL pixel in the mask texturemy
- the Y coordinate of the UL pixel in the mask texturevoid maskInterpolatePixels(RTTexture imgtex, RTTexture masktex, int dx, int dy, int dw, int dh, int ix, int iy, int mx, int my)
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.
imgtex
- the texture containing the source image pixelsmasktex
- the texture containing the mask pixels, only the
alpha channel is used from this texturedx
- the X coordinate of the UL destination pixeldy
- the Y coordinate of the UL destination pixeldw
- the width of the pixel regions to be combineddh
- the height of the pixel regions to be combinedix
- the X coordinate of the UL pixel in the image textureiy
- the Y coordinate of the UL pixel in the image texturemx
- the X coordinate of the UL pixel in the mask texturemy
- the Y coordinate of the UL pixel in the mask textureCopyright © 2020. All rights reserved.