RRPathRenderer

Objective-C

@interface RRPathRenderer : RRRenderer

Swift

class RRPathRenderer : RRRenderer

Renderer for primitives like lines and polygons as well as for filled primitives. All paths are just defined in 2D and will be rendered within the XY plane. When attached to a RRRenderable instance, renderers inherit its transformation automatically. So to change the plane your path should be rendered in, just modify the renderable’s transformation.

  • Adds a new path to the renderer. Paths are not displayed until they are added to a RRPathRenderer.

    Declaration

    Objective-C

    - (void)addPath:(RRPath *_Nonnull)path;

    Swift

    func add(_ path: RRPath)

    Parameters

    path

    Path object that should be displayed by the renderer.

  • Removes a path from the renderer. Nothing happens if the path is not attached to the renderer.

    Declaration

    Objective-C

    - (void)removePath:(RRPath *_Nonnull)path;

    Swift

    func remove(_ path: RRPath)

    Parameters

    path

    Path object that should be removed from the renderer

  • Returns a array containing all the path which are attached to the renderer.

    Declaration

    Objective-C

    - (NSArray<RRPath *> *_Nonnull)getPaths;

    Swift

    func getPaths() -> [RRPath]

    Return Value

    Array of paths attached to the renderer.

  • Removes all paths that are attached to the renderer.

    Declaration

    Objective-C

    - (void)clear;

    Swift

    func clear()
  • Creates a polyline with the given points and adds it to the renderer.

    Declaration

    Objective-C

    - (RRPath *_Nonnull)addPolylineWithPoints:(NSArray<NSValue *> *_Nonnull)points
                                    lineWidth:(CGFloat)lineWidth
                                        color:(UIColor *_Nonnull)color
                                    jointType:(RRLineJointType)jointType
                                 startCapType:(RRLineJointType)startCapType
                                   endCapType:(RRLineJointType)endCapType;

    Swift

    func addPolyline(withPoints points: [NSValue], lineWidth: CGFloat, color: UIColor, jointType: RRLineJointType, startCapType: RRLineJointType, endCapType: RRLineJointType) -> RRPath

    Parameters

    points

    Array of points of the polyline

    lineWidth

    Line width in pixel

    color

    Line color

    jointType

    Type of the joint between lines

    startCapType

    Type of the cap of of the first line segment

    endCapType

    Type of the cap of of the last line segment

    Return Value

    RRPath object which has already been added to the renderer

  • Creates a closed polygon with the given points and adds it to the renderer.

    Declaration

    Objective-C

    - (RRPath *_Nonnull)addPolygonWithPoints:(NSArray<NSValue *> *_Nonnull)points
                                   lineWidth:(CGFloat)lineWidth
                                       color:(UIColor *_Nonnull)color
                                   jointType:(RRLineJointType)jointType;

    Swift

    func addPolygon(withPoints points: [NSValue], lineWidth: CGFloat, color: UIColor, jointType: RRLineJointType) -> RRPath

    Parameters

    points

    Array of points of the polygon. The last point is automatically connected to the first one.

    lineWidth

    Line width in pixel

    color

    Line color

    jointType

    Type of the joint between lines

    Return Value

    RRPath object which has already been added to the renderer

  • Creates a rectangle defined by the top left and bottom right position and adds it to the renderer

    Declaration

    Objective-C

    - (RRPath *_Nonnull)addRectWithTopLeft:(CGPoint)topleft
                               bottomRight:(CGPoint)bottomRight
                                 lineWidth:(CGFloat)lineWidth
                                     color:(UIColor *_Nonnull)color
                                 jointType:(RRLineJointType)jointType;

    Swift

    func addRect(withTopLeft topleft: CGPoint, bottomRight: CGPoint, lineWidth: CGFloat, color: UIColor, jointType: RRLineJointType) -> RRPath

    Parameters

    topLeft

    Top left point of the rectangle

    bottomRight

    Bottom right point of the rectangle

    lineWidth

    Line width in pixel

    color

    Line color

    jointType

    Type of the joint between lines

    Return Value

    RRPath object which has already been added to the renderer

  • Creates a rectangle defined by the top left and bottom right position with rounded corners and adds it to the renderer.

    Declaration

    Objective-C

    - (RRPath *_Nonnull)addRoundedRectWithTopLeft:(CGPoint)topleft
                                      bottomRight:(CGPoint)bottomRight
                                           radius:(CGFloat)radius
                                        lineWidth:(CGFloat)lineWidth
                                            color:(UIColor *_Nonnull)color;

    Swift

    func addRoundedRect(withTopLeft topleft: CGPoint, bottomRight: CGPoint, radius: CGFloat, lineWidth: CGFloat, color: UIColor) -> RRPath

    Parameters

    topLeft

    Top left point of the rectangle

    bottomRight

    Bottom right point of the rectangle

    radius

    Corner radius in pixel

    lineWidth

    Line width in pixel

    color

    Line color

    Return Value

    RRPath object which has already been added to the renderer

  • Creates an ellipse defined by a center point and its extend in X and Y and adds it to the renderer. If dx equals dy the result is a circle and the extend equals the radius of that circle.

    Declaration

    Objective-C

    - (RRPath *_Nonnull)addEllipseWithCenter:(CGPoint)center
                                     extendX:(CGFloat)dx
                                     extendY:(CGFloat)dy
                                   lineWidth:(CGFloat)lineWidth
                                       color:(UIColor *_Nonnull)color
                                subdivisions:(NSUInteger)subdivisions;

    Swift

    func addEllipse(withCenter center: CGPoint, extendX dx: CGFloat, extendY dy: CGFloat, lineWidth: CGFloat, color: UIColor, subdivisions: UInt) -> RRPath

    Parameters

    center

    Center of the ellipse

    dx

    Extend of the ellipse on the x-axis

    dy

    Extend of the ellipse on the y-axis

    lineWidth

    Line width in pixel

    color

    Line color

    subdivisions

    Number of subdivisions for creating the ellipse geometry. (The ellipse will be created as a polygon with number of subdivisions points)

    Return Value

    RRPath object which has already been added to the renderer

  • Creates an arc from an starting position and a starting angle covering the given enclosed angle with the given radius. Angles are counter clockwise and in degrees.

    Declaration

    Objective-C

    - (RRPath *_Nonnull)addArcWithPosition:(CGPoint)position
                                    radius:(CGFloat)radius
                                startAngle:(CGFloat)startAngle
                             enclosedAngle:(CGFloat)enclosedAngle
                                 lineWidth:(CGFloat)lineWidth
                                     color:(UIColor *_Nonnull)color
                                   capType:(RRLineJointType)capType;

    Swift

    func addArc(withPosition position: CGPoint, radius: CGFloat, startAngle: CGFloat, enclosedAngle: CGFloat, lineWidth: CGFloat, color: UIColor, capType: RRLineJointType) -> RRPath

    Parameters

    position

    Starting position of the arc

    radius

    Defines the rotation center of the arc in pixel from the starting point in the direction of the staring angle

    startAngle

    Starting angle in degrees

    enclosedAngle

    Enclosed angle of the arc in degrees

    lineWidth

    Line width in pixel

    color

    Line color

  • Creates a filled polygon and adds it to the renderer.

    Declaration

    Objective-C

    - (RRPath *_Nonnull)addFilledPolygonWithPoints:
                            (NSArray<NSValue *> *_Nonnull)points
                                             color:(UIColor *_Nonnull)color;

    Swift

    func addFilledPolygon(withPoints points: [NSValue], color: UIColor) -> RRPath

    Parameters

    points

    Array of points of the polygon. The last point is automatically connected to the first one.

    color

    Fill color

  • Creates a filled rectangle and adds it to the renderer.

    Declaration

    Objective-C

    - (RRPath *_Nonnull)addFilledRectWithTopLeft:(CGPoint)topleft
                                     bottomRight:(CGPoint)bottomRight
                                           color:(UIColor *_Nonnull)color;

    Swift

    func addFilledRect(withTopLeft topleft: CGPoint, bottomRight: CGPoint, color: UIColor) -> RRPath

    Parameters

    topLeft

    Top left point of the rectangle

    bottomRight

    Bottom right point of the rectangle

    color

    Fill color

  • Creates a filled rectangle with rounded corners and adds it to the renderer.

    Declaration

    Objective-C

    - (RRPath *_Nonnull)addFilledRoundedRectWithTopLeft:(CGPoint)topleft
                                            bottomRight:(CGPoint)bottomRight
                                                 radius:(CGFloat)radius
                                                  color:(UIColor *_Nonnull)color;

    Swift

    func addFilledRoundedRect(withTopLeft topleft: CGPoint, bottomRight: CGPoint, radius: CGFloat, color: UIColor) -> RRPath

    Parameters

    topLeft

    Top left point of the rectangle

    bottomRight

    Bottom right point of the rectangle

    radius

    Corner radius in pixel

    color

    Fill color

  • Creates an filled ellipse defined by a center point and its extend in X and Y and adds it to the renderer. If dx equals dy the result is a circle and the extend equals the radius of that circle.

    Declaration

    Objective-C

    - (RRPath *_Nonnull)addFilledEllipseWithCenter:(CGPoint)center
                                           extendX:(CGFloat)dx
                                           extendY:(CGFloat)dy
                                             color:(UIColor *_Nonnull)color
                                      subdivisions:(NSUInteger)subdivisions;

    Swift

    func addFilledEllipse(withCenter center: CGPoint, extendX dx: CGFloat, extendY dy: CGFloat, color: UIColor, subdivisions: UInt) -> RRPath

    Parameters

    center

    Center of the ellipse

    dx

    Extend of the ellipse on the x-axis

    dy

    Extend of the ellipse on the y-axis

    color

    Fill color

    subdivisions

    Number of subdivisions for creating the ellipse geometry. (The ellipse will be created as a polygon with number of subdivisions points)

  • Creates a set of points with a given radius and adds it to the renderer.

    Declaration

    Objective-C

    - (RRPath *_Nonnull)addPoints:(NSArray<NSValue *> *_Nonnull)points
                           radius:(CGFloat)radius
                            color:(UIColor *_Nonnull)color;

    Swift

    func addPoints(_ points: [NSValue], radius: CGFloat, color: UIColor) -> RRPath

    Parameters

    points

    Array of points

    radius

    Radius in pixel

    color

    Fill color