public abstract class BaseShaderGraphics extends BaseGraphics implements ShaderGraphics, ReadbackGraphics, MaskTextureGraphics
IDENT, isSimpleTranslate, nodeBounds, paint, scratchEllipse, scratchLine, scratchRRect, stroke, transX, transY
Modifier | Constructor and Description |
---|---|
protected |
BaseShaderGraphics(BaseShaderContext context,
RenderTarget renderTarget) |
Modifier and Type | Method and Description |
---|---|
void |
blit(RTTexture srcTex,
RTTexture dstTex,
int srcX0,
int srcY0,
int srcX1,
int srcY1,
int dstX0,
int dstY0,
int dstX1,
int dstY1) |
boolean |
canReadBack() |
void |
drawEllipse(float x,
float y,
float w,
float h) |
void |
drawLine(float x1,
float y1,
float x2,
float y2) |
void |
drawMappedTextureRaw2(Texture src1,
Texture src2,
float dx1,
float dy1,
float dx2,
float dy2,
float t1x11,
float t1y11,
float t1x21,
float t1y21,
float t1x12,
float t1y12,
float t1x22,
float t1y22,
float t2x11,
float t2y11,
float t2x21,
float t2y21,
float t2x12,
float t2y12,
float t2x22,
float t2y22) |
protected void |
drawMultiTexture(MultiTexture tex,
float dx1,
float dy1,
float dx2,
float dy2,
float sx1,
float sy1,
float sx2,
float sy2) |
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 |
drawRect(float x,
float y,
float w,
float h) |
void |
drawRoundRect(float x,
float y,
float w,
float h,
float arcw,
float arch) |
void |
drawString(GlyphList gl,
FontStrike strike,
float x,
float y,
Color selectColor,
int selectStart,
int selectEnd) |
void |
drawTexture(Texture tex,
float dx1,
float dy1,
float dx2,
float dy2,
float sx1,
float sy1,
float sx2,
float sy2) |
void |
drawTexture3SliceH(Texture tex,
float dx1,
float dy1,
float dx2,
float dy2,
float sx1,
float sy1,
float sx2,
float sy2,
float dh1,
float dh2,
float sh1,
float sh2) |
void |
drawTexture3SliceV(Texture tex,
float dx1,
float dy1,
float dx2,
float dy2,
float sx1,
float sy1,
float sx2,
float sy2,
float dv1,
float dv2,
float sv1,
float sv2) |
void |
drawTexture9Slice(Texture tex,
float dx1,
float dy1,
float dx2,
float dy2,
float sx1,
float sy1,
float sx2,
float sy2,
float dh1,
float dv1,
float dh2,
float dv2,
float sh1,
float sv1,
float sh2,
float sv2) |
void |
drawTextureRaw2(Texture src1,
Texture src2,
float dx1,
float dy1,
float dx2,
float dy2,
float t1x1,
float t1y1,
float t1x2,
float t1y2,
float t2x1,
float t2y1,
float t2x2,
float t2y2) |
void |
fillEllipse(float x,
float y,
float w,
float h) |
void |
fillQuad(float x1,
float y1,
float x2,
float y2) |
void |
fillRect(float x,
float y,
float w,
float h) |
void |
fillRoundRect(float x,
float y,
float w,
float h,
float arcw,
float arch) |
Shader |
getExternalShader() |
NGLightBase[] |
getLights() |
void |
getPaintShaderTransform(Affine3D ret) |
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.
|
RTTexture |
readBack(Rectangle view) |
void |
releaseReadBackBuffer(RTTexture rtt) |
protected void |
renderShape(Shape shape,
BasicStroke stroke,
float bx,
float by,
float bw,
float bh) |
void |
setExternalShader(Shader shader) |
void |
setLights(NGLightBase[] lights) |
void |
setNodeBounds(RectBounds bounds)
Set the node bounds for any node that would like to render objects of a
different size to self.
|
void |
setPaint(Paint paint) |
void |
setup3DRendering() |
clear, draw, drawMappedTextureRaw, drawTexture, drawTextureRaw, drawTextureVO, fill, getAssociatedScreen, getCamera, getCameraNoClone, getClipRect, getClipRectIndex, getClipRectNoClone, getCompositeMode, getExtraAlpha, getFinalClipNoClone, getPaint, getPixelScaleFactor, getRenderRoot, getRenderTarget, getResourceFactory, getStroke, getTransformNoClone, hasPreCullingBits, isAlphaTestShader, isAntialiasedShape, isDepthBuffer, isDepthTest, isState3D, scale, scale, setAntialiasedShape, setCamera, setClipRect, setClipRectIndex, setCompositeMode, setDepthBuffer, setDepthTest, setExtraAlpha, setHasPreCullingBits, setPerspectiveTransform, setPixelScaleFactor, setRenderRoot, setState3D, setStroke, setTransform, setTransform, setTransform3D, transform, translate, translate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clear, clear, clearQuad, draw, drawMappedTextureRaw, drawTexture, drawTextureRaw, drawTextureVO, fill, getAssociatedScreen, getCameraNoClone, getClipRect, getClipRectIndex, getClipRectNoClone, getCompositeMode, getExtraAlpha, getFinalClipNoClone, getPaint, getPixelScaleFactor, getRenderRoot, getRenderTarget, getResourceFactory, getStroke, getTransformNoClone, hasPreCullingBits, isAlphaTestShader, isAntialiasedShape, isDepthBuffer, isDepthTest, isState3D, scale, scale, setAntialiasedShape, setCamera, setClipRect, setClipRectIndex, setCompositeMode, setDepthBuffer, setDepthTest, setExtraAlpha, setHasPreCullingBits, setPerspectiveTransform, setPixelScaleFactor, setRenderRoot, setState3D, setStroke, setTransform, setTransform, setTransform3D, sync, transform, translate, translate
protected BaseShaderGraphics(BaseShaderContext context, RenderTarget renderTarget)
public void getPaintShaderTransform(Affine3D ret)
getPaintShaderTransform
in interface ShaderGraphics
public Shader getExternalShader()
public void setExternalShader(Shader shader)
setExternalShader
in interface ShaderGraphics
public void setPaint(Paint paint)
setPaint
in interface Graphics
setPaint
in class BaseGraphics
public void setLights(NGLightBase[] lights)
public final NGLightBase[] getLights()
public void drawTexture(Texture tex, float dx1, float dy1, float dx2, float dy2, float sx1, float sy1, float sx2, float sy2)
drawTexture
in interface Graphics
drawTexture
in class BaseGraphics
public void drawTexture3SliceH(Texture tex, float dx1, float dy1, float dx2, float dy2, float sx1, float sy1, float sx2, float sy2, float dh1, float dh2, float sh1, float sh2)
drawTexture3SliceH
in interface Graphics
drawTexture3SliceH
in class BaseGraphics
public void drawTexture3SliceV(Texture tex, float dx1, float dy1, float dx2, float dy2, float sx1, float sy1, float sx2, float sy2, float dv1, float dv2, float sv1, float sv2)
drawTexture3SliceV
in interface Graphics
drawTexture3SliceV
in class BaseGraphics
public void drawTexture9Slice(Texture tex, float dx1, float dy1, float dx2, float dy2, float sx1, float sy1, float sx2, float sy2, float dh1, float dv1, float dh2, float dv2, float sh1, float sv1, float sh2, float sv2)
drawTexture9Slice
in interface Graphics
drawTexture9Slice
in class BaseGraphics
protected void drawMultiTexture(MultiTexture tex, float dx1, float dy1, float dx2, float dy2, float sx1, float sy1, float sx2, float sy2)
public void drawTextureRaw2(Texture src1, Texture src2, float dx1, float dy1, float dx2, float dy2, float t1x1, float t1y1, float t1x2, float t1y2, float t2x1, float t2y1, float t2x2, float t2y2)
drawTextureRaw2
in interface ShaderGraphics
public void drawMappedTextureRaw2(Texture src1, Texture src2, float dx1, float dy1, float dx2, float dy2, float t1x11, float t1y11, float t1x21, float t1y21, float t1x12, float t1y12, float t1x22, float t1y22, float t2x11, float t2y11, float t2x21, float t2y21, float t2x12, float t2y12, float t2x22, float t2y22)
drawMappedTextureRaw2
in interface ShaderGraphics
public void drawPixelsMasked(RTTexture imgtex, RTTexture masktex, int dx, int dy, int dw, int dh, int ix, int iy, int mx, int my)
MaskTextureGraphics
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
drawPixelsMasked
in interface MaskTextureGraphics
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 texturepublic void maskInterpolatePixels(RTTexture imgtex, RTTexture masktex, int dx, int dy, int dw, int dh, int ix, int iy, int mx, int my)
MaskTextureGraphics
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.
maskInterpolatePixels
in interface MaskTextureGraphics
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 textureprotected void renderShape(Shape shape, BasicStroke stroke, float bx, float by, float bw, float bh)
renderShape
in class BaseGraphics
public void fillRect(float x, float y, float w, float h)
public void fillEllipse(float x, float y, float w, float h)
fillEllipse
in interface Graphics
public void fillRoundRect(float x, float y, float w, float h, float arcw, float arch)
fillRoundRect
in interface Graphics
public void fillQuad(float x1, float y1, float x2, float y2)
public void blit(RTTexture srcTex, RTTexture dstTex, int srcX0, int srcY0, int srcX1, int srcY1, int dstX0, int dstY0, int dstX1, int dstY1)
public void drawRect(float x, float y, float w, float h)
public void drawEllipse(float x, float y, float w, float h)
drawEllipse
in interface Graphics
public void drawRoundRect(float x, float y, float w, float h, float arcw, float arch)
drawRoundRect
in interface Graphics
public void drawLine(float x1, float y1, float x2, float y2)
public void setNodeBounds(RectBounds bounds)
Graphics
setNodeBounds
in interface Graphics
bounds
- should not include node transformpublic void drawString(GlyphList gl, FontStrike strike, float x, float y, Color selectColor, int selectStart, int selectEnd)
drawString
in interface Graphics
public boolean canReadBack()
canReadBack
in interface ReadbackGraphics
public RTTexture readBack(Rectangle view)
readBack
in interface ReadbackGraphics
public void releaseReadBackBuffer(RTTexture rtt)
releaseReadBackBuffer
in interface ReadbackGraphics
public void setup3DRendering()
setup3DRendering
in interface Graphics
Copyright © 2020. All rights reserved.