iOS & macOS Charting Documentation - SciChart iOS & macOS Charts SDK v4.x
ISCIRenderContext2D
@protocol ISCIRenderContext2D <ISCIDisposable>
Defines the protocol to a 2D RenderContext, allowing rendering of pens, brushes, sprites and textures on the ISCIRenderSurface
.
-
The viewport size in user space coordinate system.
Declaration
Objective-C
@property (nonatomic, readonly) CGSize viewportSize;
Swift
var viewportSize: CGSize { get }
-
Begins a line segment, returning the
ISCIPathDrawingContext
.Note
Please note, that coordinates should be provided in user space coordinate system.Declaration
Objective-C
- (nonnull id<ISCIPathDrawingContext>)beginLineWithPen: (nonnull id<ISCIPen2D>)pen at:(CGPoint)point;
Swift
func beginLine(with pen: ISCIPen2D, at point: CGPoint) -> ISCIPathDrawingContext
Parameters
pen
The pen for line segment.
point
The point coordinates.
Return Value
The
ISCIPathDrawingContext
to continue the line. -
Draws a single line on the
ISCIRenderSurface
using the specifiedISCIPen2D
.Note
Please note, that coordinates should be provided in user space coordinate system.Declaration
Objective-C
- (void)drawLineWithPen:(nonnull id<ISCIPen2D>)pen atStart:(CGPoint)start end:(CGPoint)end;
Swift
func drawLine(with pen: ISCIPen2D, at start: CGPoint, end: CGPoint)
Parameters
pen
The pen to draw line with.
start
The start point coordinates.
end
The end point coordinates.
-
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.
Note
Please note, that coordinates should be provided in user space coordinate system.Declaration
Objective-C
- (void)drawLinesWithPen:(nonnull id<ISCIPen2D>)pen points:(nonnull const float *)points startIndex:(int)startIndex count:(int)count;
Parameters
pen
The pen to draw lines with.
points
Array of points to draw
[x0, y0, x1, y1, x2, y2 ...]
.startIndex
Start index in points array to start drawing with.
count
The amount of points to draw from points array.
-
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.
Note
Please note, that coordinates should be provided in user space coordinate system.Declaration
Objective-C
- (void)drawLinesStripWithPen:(nonnull id<ISCIPen2D>)pen points:(nonnull const float *)points startIndex:(int)startIndex count:(int)count;
Parameters
pen
The pen to draw lines with.
points
Array of points to draw
[x0, y0, x1, y1, x2, y2 ...]
.startIndex
Start index in points array to start drawing with.
count
The amount of points to draw from points array.
-
Begins a filled triangle strips segment, returning the
ISCIPathDrawingContext
.Note
Please note, that coordinates should be provided in user space coordinate system.Declaration
Objective-C
- (nonnull id<ISCIPathDrawingContext>) beginTrianglesStripWithBrush:(nonnull id<ISCIBrush2D>)brush at:(CGPoint)point;
Swift
func beginTrianglesStrip(with brush: ISCIBrush2D, at point: CGPoint) -> ISCIPathDrawingContext
Parameters
brush
The brush for triangle strips segment.
point
The point coordinates.
Return Value
The
ISCIPathDrawingContext
to continue the line. -
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.
Note
Please note, that coordinates should be provided in user space coordinate system.Declaration
Objective-C
- (void)drawTrianglesStripWithBrush:(nonnull id<ISCIBrush2D>)brush points:(nonnull const float *)points startIndex:(int)startIndex count:(int)count;
Parameters
brush
The brush to fill triangles with.
points
Array of points to draw
[x0, y0, x1, y1, x2, y2 ...]
.startIndex
Start index in points array to start drawing with.
count
The amount of points to draw from points array.
-
Draws a single rectangle on the
ISCIRenderSurface
using the specifiedISCIPen2D
.Note
Please note, that coordinates should be provided in user space coordinate system.Declaration
Objective-C
- (void)drawRect:(CGRect)rect withPen:(nonnull id<ISCIPen2D>)pen;
Swift
func drawRect(_ rect: CGRect, with pen: ISCIPen2D)
Parameters
rect
The CGRect coordinates.
pen
The pen to draw rect with.
-
Fills a single rectangle on the
ISCIRenderSurface
using the specifiedISCIBrush2D
.Note
Please note, that coordinates should be provided in user space coordinate system.Declaration
Objective-C
- (void)fillRect:(CGRect)rect withBrush:(nonnull id<ISCIBrush2D>)brush;
Swift
func fillRect(_ rect: CGRect, with brush: ISCIBrush2D)
Parameters
rect
The CGRect coordinates.
brush
The brush to fill rectangle with.
-
Draws a single rounded rectangle on the
ISCIRenderSurface
.Note
Please note, that coordinates should be provided in user space coordinate system.Declaration
Objective-C
- (void)drawRoundedRect:(CGRect)rect withPen:(nullable id<ISCIPen2D>)pen andBrush:(nullable id<ISCIBrush2D>)brush topRadius:(CGFloat)topRadius bottomRadius:(CGFloat)bottomRadius;
Parameters
rect
The CGRect coordinates.
pen
The pen to draw rectangle outline with.
brush
The brush to fill rectangle with.
topRadius
The radius which will be used for top-left and top-right corners.
bottomRadius
The radius which will be used for bottom-left and bottom-right corners.
-
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.
Note
Please note, that coordinates should be provided in user space coordinate system.Declaration
Objective-C
- (void)drawRectsWithPen:(nonnull id<ISCIPen2D>)pen points:(nonnull const float *)points startIndex:(int)startIndex count:(int)count;
Parameters
pen
The pen to draw rectangles with.
points
Array of points to draw
[x0, y0, x1, y1...]
.startIndex
Start index in points array to start drawing with.
count
The amount of points to draw from points array.
-
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.
Note
Please note, that coordinates should be provided in user space coordinate system.Declaration
Objective-C
- (void)fillRectsWithBrush:(nonnull id<ISCIBrush2D>)brush points:(nonnull const float *)points startIndex:(int)startIndex count:(int)count;
Parameters
brush
The brush to fill rectangles with.
points
Array of points to draw
[x0, y0, x1, y1...]
.startIndex
Start index in points array to start drawing with.
count
The amount of points to draw from points array.
-
Draws a series of rounded 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.
Note
Please note, that coordinates should be provided in user space coordinate system.Declaration
Objective-C
- (void)drawRoundedRects:(nonnull const float *)points startIndex:(int)startIndex count:(int)count withPen:(nullable id<ISCIPen2D>)pen andBrush:(nullable id<ISCIBrush2D>)brush topRadius:(CGFloat)topRadius bottomRadius:(CGFloat)bottomRadius;
Parameters
points
Array of points to draw
[x0, y0, x1, y1...]
.startIndex
Start index in points array to start drawing with.
count
The amount of points to draw from points array.
pen
The pen to draw rectangles outline with.
brush
The brush to fill rectangles with.
topRadius
The radius which will be used for top-left and top-right corners.
bottomRadius
The radius which will be used for bottom-left and bottom-right corners.
-
Draws a single ellipse on the
ISCIRenderSurface
using the specifiedISCIPen2D
.Note
Please note, that coordinates should be provided in user space coordinate system.Declaration
Objective-C
- (void)drawEllipseWithPen:(nonnull id<ISCIPen2D>)pen andSize:(CGSize)size at:(CGPoint)center;
Swift
func drawEllipse(with pen: ISCIPen2D, andSize size: CGSize, at center: CGPoint)
Parameters
pen
The pen to draw ellipse stroke with.
size
The size of ellipse.
center
The center coordinates.
-
Draws a single ellipse on the
ISCIRenderSurface
using the specifiedISCIBrush2D
.Note
Please note, that coordinates should be provided in user space coordinate system.Declaration
Objective-C
- (void)fillEllipseWithBrush:(nonnull id<ISCIBrush2D>)brush andSize:(CGSize)size at:(CGPoint)center;
Swift
func fillEllipse(with brush: ISCIBrush2D, andSize size: CGSize, at center: CGPoint)
Parameters
brush
The brush to fill ellipse with.
size
The size of ellipse.
center
The center coordinates.
-
Draws a single ellipse on the
ISCIRenderSurface
using the specifiedISCIBrush2D
andISCIPen2D
.Note
Please note, that coordinates should be provided in user space coordinate system.Declaration
Objective-C
- (void)drawEllipseWithPen:(nonnull id<ISCIPen2D>)pen brush:(nonnull id<ISCIBrush2D>)brush andSize:(CGSize)size at:(CGPoint)center;
Swift
func drawEllipse(with pen: ISCIPen2D, brush: ISCIBrush2D, andSize size: CGSize, at center: CGPoint)
Parameters
pen
The pen to draw ellipse stroke with.
brush
The brush to fill ellipse with.
size
The size of ellipse.
center
The center coordinates.
-
Draws a series of ellipses. Each point for sprite is taken from 4 consecutive values in the points array representing rectangle in which each ellipse will be drawn. Thus to draw 1 ellipse, the array must contain at least 4 values.
Note
Please note, that coordinates should be provided in user space coordinate system.Declaration
Objective-C
- (void)drawEllipsesWithPen:(nonnull id<ISCIPen2D>)pen points:(nonnull const float *)points startIndex:(int)startIndex count:(int)count;
Parameters
pen
The pen to draw ellipse stroke with.
points
Array of points to draw
[x0, y0, x1, y1...]
.startIndex
Start index in points array to start drawing with.
count
The amount of points to draw from points array.
-
Draws a series of ellipses. Each point for sprite is taken from 4 consecutive values in the points array representing rectangle in which each ellipse will be drawn. Thus to draw 1 ellipse, the array must contain at least 4 values.
Note
Please note, that coordinates should be provided in user space coordinate system.*Declaration
Objective-C
- (void)fillEllipsesWithBrush:(nonnull id<ISCIBrush2D>)brush points:(nonnull const float *)points startIndex:(int)startIndex count:(int)count;
Parameters
brush
The brush to fill ellipses with.
points
Array of points to draw
[x0, y0, x1, y1...]
.startIndex
Start index in points array to start drawing with.
count
The amount of points to draw from points array.
-
Draws a series of ellipses. Each point for sprite is taken from 4 consecutive values in the points array representing rectangle in which each ellipse will be drawn. Thus to draw 1 ellipse, the array must contain at least 4 values.
Note
Please note, that coordinates should be provided in user space coordinate system.Declaration
Objective-C
- (void)drawEllipsesWithPen:(nonnull id<ISCIPen2D>)pen brush:(nonnull id<ISCIBrush2D>)brush points:(nonnull const float *)points startIndex:(int)startIndex count:(int)count;
Parameters
pen
The pen to draw ellipse stroke with.
brush
The brush to fill ellipses with.
points
Array of points to draw
[x0, y0, x1, y1...]
.startIndex
Start index in points array to start drawing with.
count
The amount of points to draw from points array.
-
Fills a single rectangle on the
ISCIRenderSurface
using the specifiedISCITexture2D
.Note
Please note, that coordinates should be provided in user space coordinate system.Declaration
Objective-C
- (void)drawTexture:(nonnull id<ISCITexture2D>)texture inRect:(CGRect)rect;
Parameters
texture
The texture to draw.
rect
The rect coordinates to draw texture in.
-
Fills a single rectangle on the
ISCIRenderSurface
using the specifiedISCITexture2D
.Note
Please note, that coordinates should be provided in user space coordinate system.Declaration
Objective-C
- (void)drawTexture:(nonnull id<ISCITexture2D>)texture inRect:(CGRect)rect withOpacity:(float)opacity;
Parameters
texture
The texture to draw.
rect
The rect coordinates to draw texture in.
opacity
The opacity to draw texture with.
-
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.
Note
Please note, that coordinates should be provided in user space coordinate system.*Declaration
Objective-C
- (void)drawTextures:(nonnull id<ISCITexture2D>)texture points:(nonnull const float *)points startIndex:(int)startIndex count:(int)count;
Parameters
texture
The texture to draw.
points
Array of points to draw
[x0, y0, x1, y1...]
.startIndex
Start index in points array to start drawing with.
count
The amount of points to draw from points array.
-
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.
Note
Please note, that coordinates should be provided in user space coordinate system.Declaration
Objective-C
- (void)drawTextures:(nonnull id<ISCITexture2D>)texture points:(nonnull const float *)points startIndex:(int)startIndex count:(int)count opacity:(float)opacity;
Parameters
texture
The texture to draw.
points
Array of points to draw
[x0, y0, x1, y1...]
.startIndex
Start index in points array to start drawing with.
count
The amount of points to draw from points array.
opacity
The opacity to draw texture with.
-
Sets the texture pixels based on values provided by pixels array.
Declaration
Objective-C
- (void)updateTexture:(nonnull id<ISCITexture2D>)texture withPixels:(nonnull unsigned int *)pixels;
Swift
func update(_ texture: ISCITexture2D, withPixels pixels: UnsafeMutablePointer<UInt32>)
Parameters
texture
The texture to set pixels for.
pixels
The array with values of texture pixels.
-
Sets the region of texture pixels based on values provided by pixels array.
Declaration
Objective-C
- (void)updateFloatTexture:(nonnull id<ISCITexture2D>)texture withPixels:(nonnull float *)pixels;
Swift
func updateFloat(_ texture: ISCITexture2D, withPixels pixels: UnsafeMutablePointer<Float>)
Parameters
texture
The texture to set pixels for.
pixels
The array with values of texture pixels.
-
Draws a sprite at specified
x, y
coordinate.Note
Please note, that coordinates should be provided in user space coordinate system.Declaration
Objective-C
- (void)drawSprite:(nonnull id<ISCITexture2D>)sprite at:(CGPoint)point;
Swift
func drawSprite(_ sprite: ISCITexture2D, at point: CGPoint)
Parameters
sprite
The sprite to draw.
point
The sprite coordinates.
-
Draws a sprite at specified
x, y
coordinate.Note
Please note, that coordinates should be provided in user space coordinate system.*Declaration
Objective-C
- (void)drawSprite:(nonnull id<ISCITexture2D>)sprite at:(CGPoint)point withOpacity:(float)opacity;
Swift
func drawSprite(_ sprite: ISCITexture2D, at point: CGPoint, withOpacity opacity: Float)
Parameters
sprite
The sprite to draw.
point
The sprite coordinates.
opacity
The opacity to draw sprite with.
-
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.
Note
Please note, that coordinates should be provided in user space coordinate system.Declaration
Objective-C
- (void)drawSprites:(nonnull id<ISCITexture2D>)sprite points:(nonnull const float *)points startIndex:(int)startIndex count:(int)count;
Parameters
sprite
The spite to draw.
points
Array of points to draw
[x0, y0, x1, y1, x2, y2 ...]
.startIndex
Start index in points array to start drawing with.
count
The amount of points to draw from points array.
-
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.
Note
Please note, that coordinates should be provided in user space coordinate system.Declaration
Objective-C
- (void)drawSprites:(nonnull id<ISCITexture2D>)sprite points:(nonnull const float *)points startIndex:(int)startIndex count:(int)count opacity:(float)opacity;
Parameters
sprite
The spite to draw.
points
Array of points to draw
[x0, y0, x1, y1, x2, y2 ...]
.startIndex
Start index in points array to start drawing with.
count
The amount of points to draw from points array.
opacity
The opacity to draw sprite with.
-
Draws a single heatmap on the
ISCIRenderSurface
using the specified float texture and gradient color map.Note
Please note, that coordinates should be provided in user space coordinate system.Declaration
Objective-C
- (void)drawHeatmapTexure:(nonnull id<ISCITexture2D>)heatmap inRect:(CGRect)rect withColorMapTexture:(nonnull id<ISCITexture2D>)colorMap min:(double)min andMax:(double)max;
Swift
func drawHeatmapTexure(_ heatmap: ISCITexture2D, in rect: CGRect, withColorMapTexture colorMap: ISCITexture2D, min: Double, andMax max: Double)
Parameters
heatmap
The heatmap texture with normalized float values which will be converted to colors using
colorMap
.rect
The rect coordinates to draw texture in.
colorMap
The colorMap texture, which will be used to calculate colors for heatmap normalized values.
min
The minimum value for this heatmap texture.
max
The maximum value for this heatmap texture.
-
Saves the current transformation and clip rect onto a private stack.
Declaration
Objective-C
- (void)save;
Swift
func save()
-
This call balances a previous call to
-save
. It’s used to remove all modifications made by-translateXBy:yBy:
,rotateByDegrees:
,-scaleXBy:yBy:
and-setClipRect:
calls since the last save call.Declaration
Objective-C
- (void)restore;
Swift
func restore()
-
Translates this
ISCIRenderContext2D
by specified x, y offset.Declaration
Objective-C
- (void)translateXBy:(float)deltaX yBy:(float)deltaY;
Swift
func translateBy(x deltaX: Float, y deltaY: Float)
Parameters
deltaX
The x offset in pixels.
deltaY
The y offset in pixels.
-
Rotates this
ISCIRenderContext2D
on specified angle.Declaration
Objective-C
- (void)rotateByDegrees:(float)angle;
Swift
func rotate(by angle: Float)
Parameters
angle
The amount to rotate, in degrees.
-
Scales this
ISCIRenderContext2D
by the provided x, y values.Declaration
Objective-C
- (void)scaleXBy:(float)scaleX yBy:(float)scaleY;
Swift
func scaleBy(x scaleX: Float, y scaleY: Float)
Parameters
scaleX
The amount to scale in x direction.
scaleY
The amount to scale in y direction.
-
Sets clip rect for this
ISCIRenderContext2D
at specified coordinates in pixels.Declaration
Objective-C
- (void)setClipRect:(CGRect)clipRect;
Swift
func setClipRect(_ clipRect: CGRect)
Parameters
clipRect
The rect which will be used to clip this render context.
-
Clears the
ISCIRenderSurface
.Declaration
Objective-C
- (void)clear;
Swift
func clear()