Core Plot (macOS)
Cocoa plotting framework for macOS, iOS, and tvOS
CPTLineStyle Class Reference

Immutable wrapper for various line drawing properties. Create a CPTMutableLineStyle if you want to customize properties. More...

#import <CPTLineStyle.h>

+ Inheritance diagram for CPTLineStyle:
+ Collaboration diagram for CPTLineStyle:

Public Class Methods

Factory Methods
(nonnull instancetype) + lineStyle
 Creates and returns a new CPTLineStyle instance. More...
 
(nonnull instancetype) + lineStyleWithStyle:
 Creates and returns a new line style instance initialized from an existing line style. More...
 
- Public Class Methods inherited from NSObject
(id) + alloc
 
(Class) + class
 
(void) + initialize
 
(void) + load
 
(id) + new
 
- Public Class Methods inherited from <NSKeyValueBindingCreation>
(void) + exposeBinding:
 
- Public Class Methods inherited from <NSSecureCoding>
(BOOL) + supportsSecureCoding:
 

Public Instance Methods

Drawing
(void) - setLineStyleInContext:
 Sets all of the line drawing properties in the given graphics context. More...
 
(void) - strokePathInContext:
 Stroke the current path in the given graphics context. Call -setLineStyleInContext: first to set up the drawing properties. More...
 
(void) - strokeRect:inContext:
 Stroke a rectangular path in the given graphics context. Call -setLineStyleInContext: first to set up the drawing properties. More...
 
Initialization
(nonnull instancetype) - init [implementation]
 Initializes a newly allocated CPTLineStyle object. More...
 
- Public Instance Methods inherited from NSObject
(Class) - classForCoder
 
(id) - copy
 
(void) - dealloc
 
(void) - finalize
 
(id) - init
 
(id) - mutableCopy
 
- Public Instance Methods inherited from <NSObject>
(NSString *) - description
 
(NSUInteger) - hash
 
(BOOL) - isEqual:
 
- Public Instance Methods inherited from <NSKeyValueBindingCreation>
(NSArray *) - exposedBindings
 
(Class) - valueClassForBinding:
 
(void) - bind:toObject:withKeyPath:options:
 
(NSArray *) - optionDescriptionsForBinding:
 
(NSDictionary *) - infoForBinding:
 
(void) - unbind:
 
- Public Instance Methods inherited from <NSCopying>
(id) - copyWithZone:
 
- Public Instance Methods inherited from <NSMutableCopying>
(id) - mutableCopyWithZone:
 
- Public Instance Methods inherited from <NSCoding>
(id) - initWithCoder:
 
(void) - encodeWithCoder:
 

Properties

CGLineCap lineCap
 The style for the endpoints of lines drawn in a graphics context. Default is kCGLineCapButt. More...
 
CGLineJoin lineJoin
 The style for the joins of connected lines in a graphics context. Default is kCGLineJoinMiter. More...
 
CGFloat miterLimit
 The miter limit for the joins of connected lines in a graphics context. Default is 10.0. More...
 
CGFloat lineWidth
 The line width for a graphics context. Default is 1.0. More...
 
CPTNumberArray * dashPattern
 The dash-and-space pattern for the line. Default is nil. More...
 
CGFloat patternPhase
 The starting phase of the line dash pattern. Default is 0.0. More...
 
CPTColor * lineColor
 The current stroke color in a context. Default is solid black. More...
 
CPTFill * lineFill
 The current line fill. Default is nil. More...
 
CPTGradient * lineGradient
 The current line gradient fill. Default is nil. More...
 
BOOL opaque
 If YES, a line drawn using the line style is completely opaque. More...
 

Detailed Description

Immutable wrapper for various line drawing properties. Create a CPTMutableLineStyle if you want to customize properties.

The line stroke can be drawn three different ways, prioritized in the following order:

  1. A gradient that follows the stroked path (lineGradient)
  2. As a cut out mask over an area filled with a CPTFill (lineFill)
  3. Filled with a solid color (lineColor)
See also
See Apple’s Quartz 2D and CGContext documentation for more information about each of these properties.

Method Documentation

◆ init

- (nonnull instancetype) init
implementation

Initializes a newly allocated CPTLineStyle object.

The initialized object will have the following properties:

Returns
The initialized object.

◆ lineStyle

+ (nonnull instancetype) lineStyle

Creates and returns a new CPTLineStyle instance.

Returns
A new CPTLineStyle instance.

◆ lineStyleWithStyle:

+ (nonnull instancetype) lineStyleWithStyle: (nullable CPTLineStyle *)  lineStyle

Creates and returns a new line style instance initialized from an existing line style.

The line style will be initialized with values from the given lineStyle.

Parameters
lineStyleAn existing CPTLineStyle.
Returns
A new line style instance.

◆ setLineStyleInContext:

- (void) setLineStyleInContext: (nonnull CGContextRef)  context

Sets all of the line drawing properties in the given graphics context.

Parameters
contextThe graphics context.

◆ strokePathInContext:

- (void) strokePathInContext: (nonnull CGContextRef)  context

Stroke the current path in the given graphics context. Call -setLineStyleInContext: first to set up the drawing properties.

Parameters
contextThe graphics context.

◆ strokeRect:inContext:

- (void) strokeRect: (CGRect)  rect
inContext: (nonnull CGContextRef)  context 

Stroke a rectangular path in the given graphics context. Call -setLineStyleInContext: first to set up the drawing properties.

Parameters
rectThe rectangle to draw.
contextThe graphics context.

Property Documentation

◆ dashPattern

- (nullable CPTNumberArray *) dashPattern
readnonatomicassign

The dash-and-space pattern for the line. Default is nil.

◆ lineCap

- (CGLineCap) lineCap
readnonatomicassign

The style for the endpoints of lines drawn in a graphics context. Default is kCGLineCapButt.

◆ lineColor

- (nullable CPTColor *) lineColor
readnonatomicassign

The current stroke color in a context. Default is solid black.

◆ lineFill

- (nullable CPTFill *) lineFill
readnonatomicassign

The current line fill. Default is nil.

If nil, the line is drawn using the lineGradient or lineColor.

◆ lineGradient

- (nullable CPTGradient *) lineGradient
readnonatomicassign

The current line gradient fill. Default is nil.

If nil, the line is drawn using the lineFill or lineColor.

◆ lineJoin

- (CGLineJoin) lineJoin
readnonatomicassign

The style for the joins of connected lines in a graphics context. Default is kCGLineJoinMiter.

◆ lineWidth

- (CGFloat) lineWidth
readnonatomicassign

The line width for a graphics context. Default is 1.0.

◆ miterLimit

- (CGFloat) miterLimit
readnonatomicassign

The miter limit for the joins of connected lines in a graphics context. Default is 10.0.

◆ opaque

- (BOOL) opaque
readnonatomicassign

If YES, a line drawn using the line style is completely opaque.

◆ patternPhase

- (CGFloat) patternPhase
readnonatomicassign

The starting phase of the line dash pattern. Default is 0.0.


The documentation for this class was generated from the following files: