Interface IRenderContext2D
Defines the interface to a 2D RenderContext, allowing rendering of pens, brushes, sprites and textures on the IRenderSurface
Implements
Namespace:
Assembly: .dll
Syntax
public interface IRenderContext2D extends IDisposable
Methods
beginLine(IPen2D pen, float x, float y)
Begins a line segment, returning the IPathDrawingContext
Declaration
public abstract IPathDrawingContext beginLine(IPen2D pen, float x, float y)
Parameters
Type | Name | Description |
---|---|---|
IPen2D | pen | The pen for line segment |
float | x | The x-coordinate in pixels |
float | y | The y-coordinate in pixels |
Returns
Type | Description |
---|---|
IPathDrawingContext | The IPathDrawingContext to continue the line |
beginTextDrawing(IFont font, int textColor)
Begins a text batch using same IFont instance and same text color
Declaration
public abstract ITextDrawingContext beginTextDrawing(IFont font, int textColor)
Parameters
Type | Name | Description |
---|---|---|
IFont | font | The IFont instance to draw text with |
int | textColor | The text color |
Returns
Type | Description |
---|---|
ITextDrawingContext | The ITextDrawingContext to draw text width |
beginTrianglesStrip(IBrush2D brush, float x, float y)
Begins a filled triangle strips segment, returning the IPathDrawingContext
Declaration
public abstract IPathDrawingContext beginTrianglesStrip(IBrush2D brush, float x, float y)
Parameters
Type | Name | Description |
---|---|---|
IBrush2D | brush | The brush for triangle strips segment |
float | x | The x-coordinate in pixels |
float | y | The y-coordinate in pixels |
Returns
Type | Description |
---|---|
IPathDrawingContext | The IPathDrawingContext to continue the line |
clear()
Clears the IRenderSurface
Declaration
public abstract void clear()
drawCanvasTexture(ICanvasTexture2D texture, Action1<Canvas> drawingCommand)
Executed drawing command which used Canvas API. After executing command content of Canvas is rendered onto texture. Texture for this call should be created by calling IAssetManager2D#createCanvasTexture(int, int) method
Declaration
public abstract void drawCanvasTexture(ICanvasTexture2D texture, Action1<Canvas> drawingCommand)
Parameters
Type | Name | Description |
---|---|---|
ICanvasTexture2D | texture | The target texture to draw on |
Action1<android.graphics.Canvas> | drawingCommand | The drawing command which |
drawEllipse(float xCenter, float yCenter, float width, float height, IBrush2D fillBrush)
Draws a single ellipse on the IRenderSurface using the specified IBrush2D
Declaration
public abstract void drawEllipse(float xCenter, float yCenter, float width, float height, IBrush2D fillBrush)
Parameters
Type | Name | Description |
---|---|---|
float | xCenter | The x center coordinate in pixels |
float | yCenter | The y center coordinate in pixels |
float | width | The width of ellipse in pixels |
float | height | The height of ellipse in pixels |
IBrush2D | fillBrush | The brush to fill ellipse with |
drawEllipse(float xCenter, float yCenter, float width, float height, IPen2D strokePen)
Draws a single ellipse on the IRenderSurface using the specified IPen2D
Declaration
public abstract void drawEllipse(float xCenter, float yCenter, float width, float height, IPen2D strokePen)
Parameters
Type | Name | Description |
---|---|---|
float | xCenter | The x center coordinate in pixels |
float | yCenter | The y center coordinate in pixels |
float | width | The width of ellipse in pixels |
float | height | The height of ellipse in pixels |
IPen2D | strokePen | The pen to draw ellipse stroke with |
drawEllipse(float xCenter, float yCenter, float width, float height, IPen2D strokePen, IBrush2D fillBrush)
Draws a single ellipse on the IRenderSurface using the specified IBrush2D and IPen2D
Declaration
public abstract void drawEllipse(float xCenter, float yCenter, float width, float height, IPen2D strokePen, IBrush2D fillBrush)
Parameters
Type | Name | Description |
---|---|---|
float | xCenter | The x center coordinate in pixels |
float | yCenter | The y center coordinate in pixels |
float | width | The width of ellipse in pixels |
float | height | The height of ellipse in pixels |
IPen2D | strokePen | The pen to draw ellipse stroke with |
IBrush2D | fillBrush | The brush to fill ellipse with |
drawEllipses(float[] points, int startIndex, int count, float width, float height, IBrush2D fillBrush)
Draws a series of ellipses. Each point for sprite is taken from 2 consecutive values in the points array. Thus to draw 1 ellipse, the array must contain at least 2 values.
Declaration
public abstract void drawEllipses(float[] points, int startIndex, int count, float width, float height, IBrush2D fillBrush)
Parameters
Type | Name | Description |
---|---|---|
float[] | points | Array of points with centers to draw [x0 y0 x1 y1 ...] |
int | startIndex | Start index in points array to start drawing with |
int | count | The amount of points to draw from points array |
float | width | The width of ellipses in pixels |
float | height | The height of ellipses in pixels |
IBrush2D | fillBrush | The brush to fill ellipses with |
drawEllipses(float[] points, int startIndex, int count, float width, float height, IPen2D strokePen)
Draws a series of ellipses. Each point for sprite is taken from 2 consecutive values in the points array. Thus to draw 1 ellipse, the array must contain at least 2 values.
Declaration
public abstract void drawEllipses(float[] points, int startIndex, int count, float width, float height, IPen2D strokePen)
Parameters
Type | Name | Description |
---|---|---|
float[] | points | Array of points with centers to draw [x0 y0 x1 y1 ...] |
int | startIndex | Start index in points array to start drawing with |
int | count | The amount of points to draw from points array |
float | width | The width of ellipses in pixels |
float | height | The height of ellipses in pixels |
IPen2D | strokePen | The pen to draw ellipse stroke with |
drawEllipses(float[] points, int startIndex, int count, float width, float height, IPen2D strokePen, IBrush2D fillBrush)
Draws a series of ellipses. Each point for sprite is taken from 2 consecutive values in the points array. Thus to draw 1 ellipse, the array must contain at least 2 values.
Declaration
public abstract void drawEllipses(float[] points, int startIndex, int count, float width, float height, IPen2D strokePen, IBrush2D fillBrush)
Parameters
Type | Name | Description |
---|---|---|
float[] | points | Array of points with centers to draw [x0 y0 x1 y1 ...] |
int | startIndex | Start index in points array to start drawing with |
int | count | The amount of points to draw from points array |
float | width | The width of ellipses in pixels |
float | height | The height of ellipses in pixels |
IPen2D | strokePen | The pen to draw ellipse stroke with |
IBrush2D | fillBrush | The brush to fill ellipses with |
drawLine(float x1, float y1, float x2, float y2, IPen2D pen)
Draws a single line on the IRenderSurface using the specified IPen2D
Declaration
public abstract void drawLine(float x1, float y1, float x2, float y2, IPen2D pen)
Parameters
Type | Name | Description |
---|---|---|
float | x1 | The x1 coordinate in pixels |
float | y1 | The y1 coordinate in pixels |
float | x2 | The x2 coordinate in pixels |
float | y2 | The y2 coordinate in pixels |
IPen2D | pen | The pen to draw line with |
drawLines(float[] points, int startIndex, int count, IPen2D pen)
Draws a series of lines. Each line is taken from 4 consecutive values in the points array. Thus to draw 1 line, the array must contain at least 4 values.
Declaration
public abstract void drawLines(float[] points, int startIndex, int count, IPen2D pen)
Parameters
Type | Name | Description |
---|---|---|
float[] | points | Array of points to draw [x0 y0 x1 y1 x2 y2 ...] |
int | startIndex | Start index in points array to start drawing with |
int | count | The amount of points to draw from points array |
IPen2D | pen | The pen to draw lines with |
drawLinesStrip(float[] points, int startIndex, int count, IPen2D pen)
Draws a lines strip. Each line is taken from 4 consecutive values in the points array. Thus to draw 1 line, the array must contain at least 4 values.
Declaration
public abstract void drawLinesStrip(float[] points, int startIndex, int count, IPen2D pen)
Parameters
Type | Name | Description |
---|---|---|
float[] | points | Array of points to draw [x0 y0 x1 y1 x2 y2 ...] |
int | startIndex | Start index in points array to start drawing with |
int | count | The amount of points to draw from points array |
IPen2D | pen | The pen to draw lines with |
drawRect(float x1, float y1, float x2, float y2, IPen2D pen)
Draws a single rectangle on the IRenderSurface using the specified IPen2D
Declaration
public abstract void drawRect(float x1, float y1, float x2, float y2, IPen2D pen)
Parameters
Type | Name | Description |
---|---|---|
float | x1 | The x1 coordinate in pixels |
float | y1 | The y1 coordinate in pixels |
float | x2 | The x2 coordinate in pixels |
float | y2 | The y2 coordinate in pixels |
IPen2D | pen | The pen to draw rect with |
drawRects(float[] points, int startIndex, int count, IPen2D pen)
Draws a series of rectangles. Each point for sprite is taken from 4 consecutive values in the points array. Thus to draw 1 rectangle, the array must contain at least 4 values.
Declaration
public abstract void drawRects(float[] points, int startIndex, int count, IPen2D pen)
Parameters
Type | Name | Description |
---|---|---|
float[] | points | Array of points to draw [x0 y0 x1 y1 ...] |
int | startIndex | Start index in points array to start drawing with |
int | count | The amount of points to draw from points array |
IPen2D | pen | The pen to draw rectangles with |
drawSprite(ITexture2D sprite, float x, float y)
Draws a sprite at specified x, y coordinate
Declaration
public abstract void drawSprite(ITexture2D sprite, float x, float y)
Parameters
Type | Name | Description |
---|---|---|
ITexture2D | sprite | The sprite to draw |
float | x | The x-coordinate in pixels |
float | y | The y-coordinate in pixels |
drawSprite(ITexture2D sprite, float x, float y, float opacity)
Draws a sprite at specified x, y coordinate
Declaration
public abstract void drawSprite(ITexture2D sprite, float x, float y, float opacity)
Parameters
Type | Name | Description |
---|---|---|
ITexture2D | sprite | The sprite to draw |
float | x | The x-coordinate in pixels |
float | y | The y-coordinate in pixels |
float | opacity | The opacity to draw sprite with |
drawSprites(ITexture2D sprite, float[] points, int startIndex, int count)
Draws a series of sprites. Each point for sprite is taken from 2 consecutive values in the points array. Thus to draw 1 sprite, the array must contain at least 2 values.
Declaration
public abstract void drawSprites(ITexture2D sprite, float[] points, int startIndex, int count)
Parameters
Type | Name | Description |
---|---|---|
ITexture2D | sprite | The spite to draw |
float[] | points | Array of points to draw [x0 y0 x1 y1 x2 y2 ...] |
int | startIndex | Start index in points array to start drawing with |
int | count | The amount of points to draw from points array |
drawSprites(ITexture2D sprite, float[] points, int startIndex, int count, float opacity)
Draws a series of sprites. Each point for sprite is taken from 2 consecutive values in the points array. Thus to draw 1 sprite, the array must contain at least 2 values.
Declaration
public abstract void drawSprites(ITexture2D sprite, float[] points, int startIndex, int count, float opacity)
Parameters
Type | Name | Description |
---|---|---|
ITexture2D | sprite | The spite to draw |
float[] | points | Array of points to draw [x0 y0 x1 y1 x2 y2 ...] |
int | startIndex | Start index in points array to start drawing with |
int | count | The amount of points to draw from points array |
float | opacity | The opacity to draw sprite with |
drawText(IFont font, float x, float y, int textColor, String text)
Draws text at x,y coordinate using a specified font and text color
Declaration
public abstract void drawText(IFont font, float x, float y, int textColor, String text)
Parameters
Type | Name | Description |
---|---|---|
IFont | font | The IFont instance to draw text with |
float | x | The x-coordinate in pixels |
float | y | The y-coordinate in pixels |
int | textColor | The text color |
String | text | The text to draw |
drawTexture(ITexture2D texture, float x1, float y1, float x2, float y2)
Fills a single rectangle on the IRenderSurface using the specified ITexture2D
Declaration
public abstract void drawTexture(ITexture2D texture, float x1, float y1, float x2, float y2)
Parameters
Type | Name | Description |
---|---|---|
ITexture2D | texture | The texture to draw |
float | x1 | The x1 coordinate in pixels |
float | y1 | The y1 coordinate in pixels |
float | x2 | The x2 coordinate in pixels |
float | y2 | The y2 coordinate in pixels |
drawTexture(ITexture2D texture, float x1, float y1, float x2, float y2, float opacity)
Fills a single rectangle on the IRenderSurface using the specified ITexture2D
Declaration
public abstract void drawTexture(ITexture2D texture, float x1, float y1, float x2, float y2, float opacity)
Parameters
Type | Name | Description |
---|---|---|
ITexture2D | texture | The texture to draw |
float | x1 | The x1 coordinate in pixels |
float | y1 | The y1 coordinate in pixels |
float | x2 | The x2 coordinate in pixels |
float | y2 | The y2 coordinate in pixels |
float | opacity | The opacity to draw texture with |
drawTexture(ITexture2D texture, float[] points, int startIndex, int count)
Draws a series of textures. Each point for sprite is taken from 4 consecutive values in the points array. Thus to draw 1 texture, the array must contain at least 4 values.
Declaration
public abstract void drawTexture(ITexture2D texture, float[] points, int startIndex, int count)
Parameters
Type | Name | Description |
---|---|---|
ITexture2D | texture | The texture to draw |
float[] | points | Array of points to draw [x0 y0 x1 y1 ...] |
int | startIndex | Start index in points array to start drawing with |
int | count | The amount of points to draw from points array |
drawTexture(ITexture2D texture, float[] points, int startIndex, int count, float opacity)
Draws a series of textures. Each point for sprite is taken from 4 consecutive values in the points array. Thus to draw 1 texture, the array must contain at least 4 values.
Declaration
public abstract void drawTexture(ITexture2D texture, float[] points, int startIndex, int count, float opacity)
Parameters
Type | Name | Description |
---|---|---|
ITexture2D | texture | The texture to draw |
float[] | points | Array of points to draw [x0 y0 x1 y1 ...] |
int | startIndex | Start index in points array to start drawing with |
int | count | The amount of points to draw from points array |
float | opacity | The opacity to draw texture with |
drawTrianglesStrip(float[] points, int startIndex, int count, IBrush2D brush)
Draws a triangle strip. Each line is taken from 6 consecutive values in the points array. Thus to draw 1 triangle, the array must contain at least 6 values.
Declaration
public abstract void drawTrianglesStrip(float[] points, int startIndex, int count, IBrush2D brush)
Parameters
Type | Name | Description |
---|---|---|
float[] | points | Array of points to draw [x0 y0 x1 y1 x2 y2 ...] |
int | startIndex | Start index in points array to start drawing with |
int | count | The amount of points to draw from points array |
IBrush2D | brush | The brush to fill triangles with |
fillRect(float x1, float y1, float x2, float y2, IBrush2D brush)
Fills a single rectangle on the IRenderSurface using the specified IBrush2D
Declaration
public abstract void fillRect(float x1, float y1, float x2, float y2, IBrush2D brush)
Parameters
Type | Name | Description |
---|---|---|
float | x1 | The x1 coordinate in pixels |
float | y1 | The y1 coordinate in pixels |
float | x2 | The x2 coordinate in pixels |
float | y2 | The y2 coordinate in pixels |
IBrush2D | brush | The brush to fill rectangle with |
fillRects(float[] points, int startIndex, int count, IBrush2D brush)
Fills a series of rectangles. Each point for sprite is taken from 4 consecutive values in the points array. Thus to draw 1 rectangle, the array must contain at least 4 values.
Declaration
public abstract void fillRects(float[] points, int startIndex, int count, IBrush2D brush)
Parameters
Type | Name | Description |
---|---|---|
float[] | points | Array of points to draw [x0 y0 x1 y1 ...] |
int | startIndex | Start index in points array to start drawing with |
int | count | The amount of points to draw from points array |
IBrush2D | brush | The brush to fill rectangles with |
getViewportHeight()
Gets the current viewport height
Declaration
public abstract int getViewportHeight()
Returns
Type | Description |
---|---|
int | The viewport height in pixels |
getViewportWidth()
Gets the current viewport width
Declaration
public abstract int getViewportWidth()
Returns
Type | Description |
---|---|
int | The viewport width in pixels |
restore()
This call balances a previous call to save(), and is used to remove all modifications made by IRenderContext2D#translate(float, float), IRenderContext2D#rotate(float), IRenderContext2D#scale(float, float) and IRenderContext2D#setClipRect(float, float, float, float) calls since the last save call. It is an error to call restore() more times than save() was called.
Declaration
public abstract void restore()
rotate(float degrees)
Rotates this IRenderContext2D on specified angle
Declaration
public abstract void rotate(float degrees)
Parameters
Type | Name | Description |
---|---|---|
float | degrees | The amount to rotate, in degrees |
save()
Saves the current transformation and clip rect onto a private stack.
Declaration
public abstract void save()
scale(float x, float y)
Scales this IRenderContext2D by the provided x, y values
Declaration
public abstract void scale(float x, float y)
Parameters
Type | Name | Description |
---|---|---|
float | x | The amount to scale in x direction |
float | y | The amount to scale in y direction |
setClipRect(float left, float top, float right, float bottom)
Sets clip rect for this IRenderContext2D at specified coordinates in pixels
Declaration
public abstract void setClipRect(float left, float top, float right, float bottom)
Parameters
Type | Name | Description |
---|---|---|
float | left | The left coordinate in pixels |
float | top | The top coordinate in pixels |
float | right | The right coordinate in pixels |
float | bottom | The bottom coordinate in pixels |
setTexturePixels(IPixelTexture2D texture, int x, int y, int width, int height, int[] pixels, int startIndex)
Sets the region of texture pixels based on values provided by pixels array
Declaration
public abstract void setTexturePixels(IPixelTexture2D texture, int x, int y, int width, int height, int[] pixels, int startIndex)
Parameters
Type | Name | Description |
---|---|---|
IPixelTexture2D | texture | The texture to set pixels for |
int | x | The x-coordinate of texture region in pixels to set pixels for |
int | y | The y-coordinate of texture region in pixels to set pixels for |
int | width | The width of texture region in pixels to set pixels for |
int | height | The height of texture region in pixels to set pixels for |
int[] | pixels | The array with values of texture pixels |
int | startIndex | Start index in pixels array to start copying with |
setTexturePixels(IPixelTexture2D texture, int[] pixels, int startIndex)
Sets the texture pixels based on values provided by pixels array
Declaration
public abstract void setTexturePixels(IPixelTexture2D texture, int[] pixels, int startIndex)
Parameters
Type | Name | Description |
---|---|---|
IPixelTexture2D | texture | The texture to set pixels for |
int[] | pixels | The array with values of texture pixels |
int | startIndex | Start index in pixels array to start copying with |
translate(float dx, float dy)
Translates this IRenderContext2D by specified x, y offset
Declaration
public abstract void translate(float dx, float dy)
Parameters
Type | Name | Description |
---|---|---|
float | dx | The x offset in pixels |
float | dy | The y offset in pixels |