Core Plot (macOS)
Cocoa plotting framework for macOS, iOS, and tvOS
CPTUtilities.h
Go to the documentation of this file.
1 #import "CPTDefinitions.h"
2 
4 
5 #pragma clang assume_nonnull begin
6 
7 @class CPTLineStyle;
8 
9 #if __cplusplus
10 extern "C" {
11 #endif
12 
15 int8_t CPTDecimalCharValue(NSDecimal decimalNumber);
16 int16_t CPTDecimalShortValue(NSDecimal decimalNumber);
17 int32_t CPTDecimalLongValue(NSDecimal decimalNumber);
18 int64_t CPTDecimalLongLongValue(NSDecimal decimalNumber);
19 int CPTDecimalIntValue(NSDecimal decimalNumber);
20 NSInteger CPTDecimalIntegerValue(NSDecimal decimalNumber);
21 
22 uint8_t CPTDecimalUnsignedCharValue(NSDecimal decimalNumber);
23 uint16_t CPTDecimalUnsignedShortValue(NSDecimal decimalNumber);
24 uint32_t CPTDecimalUnsignedLongValue(NSDecimal decimalNumber);
25 uint64_t CPTDecimalUnsignedLongLongValue(NSDecimal decimalNumber);
26 unsigned int CPTDecimalUnsignedIntValue(NSDecimal decimalNumber);
27 NSUInteger CPTDecimalUnsignedIntegerValue(NSDecimal decimalNumber);
28 
29 float CPTDecimalFloatValue(NSDecimal decimalNumber);
30 double CPTDecimalDoubleValue(NSDecimal decimalNumber);
31 CGFloat CPTDecimalCGFloatValue(NSDecimal decimalNumber);
32 
33 NSString *__nonnull CPTDecimalStringValue(NSDecimal decimalNumber);
34 
36 
39 NSDecimal CPTDecimalFromChar(int8_t anInt);
40 NSDecimal CPTDecimalFromShort(int16_t anInt);
41 NSDecimal CPTDecimalFromLong(int32_t anInt);
42 NSDecimal CPTDecimalFromLongLong(int64_t anInt);
44 NSDecimal CPTDecimalFromInteger(NSInteger i);
45 
50 NSDecimal CPTDecimalFromUnsignedInt(unsigned int i);
52 
53 NSDecimal CPTDecimalFromFloat(float aFloat);
54 NSDecimal CPTDecimalFromDouble(double aDouble);
55 NSDecimal CPTDecimalFromCGFloat(CGFloat aCGFloat);
56 
57 NSDecimal CPTDecimalFromString(NSString *__nonnull stringRepresentation);
58 
60 
63 NSDecimal CPTDecimalAdd(NSDecimal leftOperand, NSDecimal rightOperand);
64 NSDecimal CPTDecimalSubtract(NSDecimal leftOperand, NSDecimal rightOperand);
65 NSDecimal CPTDecimalMultiply(NSDecimal leftOperand, NSDecimal rightOperand);
66 NSDecimal CPTDecimalDivide(NSDecimal numerator, NSDecimal denominator);
67 
69 
72 BOOL CPTDecimalGreaterThan(NSDecimal leftOperand, NSDecimal rightOperand);
73 BOOL CPTDecimalGreaterThanOrEqualTo(NSDecimal leftOperand, NSDecimal rightOperand);
74 BOOL CPTDecimalLessThan(NSDecimal leftOperand, NSDecimal rightOperand);
75 BOOL CPTDecimalLessThanOrEqualTo(NSDecimal leftOperand, NSDecimal rightOperand);
76 BOOL CPTDecimalEquals(NSDecimal leftOperand, NSDecimal rightOperand);
77 
79 
83 NSDecimal CPTDecimalMin(NSDecimal leftOperand, NSDecimal rightOperand);
84 NSDecimal CPTDecimalMax(NSDecimal leftOperand, NSDecimal rightOperand);
85 NSDecimal CPTDecimalAbs(NSDecimal value);
86 
88 
91 NSRange CPTExpandedRange(NSRange range, NSInteger expandBy);
92 
94 
98 
100 
103 CPTRGBAColor CPTRGBAColorFromCGColor(__nonnull CGColorRef color);
104 
106 
109 
114 
119 
120 CGPoint CPTAlignPointToUserSpace(__nonnull CGContextRef context, CGPoint point);
121 CGSize CPTAlignSizeToUserSpace(__nonnull CGContextRef context, CGSize size);
122 CGRect CPTAlignRectToUserSpace(__nonnull CGContextRef context, CGRect rect);
123 
124 CGPoint CPTAlignIntegralPointToUserSpace(__nonnull CGContextRef context, CGPoint point);
125 CGRect CPTAlignIntegralRectToUserSpace(__nonnull CGContextRef context, CGRect rect);
126 
127 CGRect CPTAlignBorderedRectToUserSpace(__nonnull CGContextRef context, CGRect rect, CPTLineStyle *__nonnull borderLineStyle);
128 
130 
133 NSString *__nonnull CPTStringFromPoint(CGPoint point);
134 NSString *__nonnull CPTStringFromSize(CGSize size);
135 NSString *__nonnull CPTStringFromRect(CGRect rect);
136 NSString *__nonnull CPTStringFromVector(CGVector vector);
137 
139 
142 CGFloat squareOfDistanceBetweenPoints(CGPoint point1, CGPoint point2);
143 
145 
148 CPTEdgeInsets CPTEdgeInsetsMake(CGFloat top, CGFloat left, CGFloat bottom, CGFloat right);
150 
152 
155 double CPTLogModulus(double value);
156 double CPTInverseLogModulus(double value);
157 
159 
160 #if __cplusplus
161 }
162 #endif
163 
164 #pragma clang assume_nonnull end
CPTEdgeInsetsMake
CPTEdgeInsets CPTEdgeInsetsMake(CGFloat top, CGFloat left, CGFloat bottom, CGFloat right)
Returns a CPTEdgeInsets struct with the given insets.
Definition: CPTUtilities.m:1086
CPTDecimalFromString
NSDecimal CPTDecimalFromString(NSString *__nonnull stringRepresentation)
Parses a string and extracts the numeric value as an NSDecimal.
Definition: CPTUtilities.m:578
CPTDecimalFromUnsignedChar
NSDecimal CPTDecimalFromUnsignedChar(uint8_t i)
Converts an unsigned 8-bit integer value to an NSDecimal.
Definition: CPTUtilities.m:386
CPTDecimalGreaterThanOrEqualTo
BOOL CPTDecimalGreaterThanOrEqualTo(NSDecimal leftOperand, NSDecimal rightOperand)
Checks to see if one NSDecimal is greater than or equal to another.
Definition: CPTUtilities.m:685
CPTDecimalFromUnsignedInt
NSDecimal CPTDecimalFromUnsignedInt(unsigned int i)
Converts an unsigned int value to an NSDecimal.
Definition: CPTUtilities.m:478
CPTDecimalGreaterThan
BOOL CPTDecimalGreaterThan(NSDecimal leftOperand, NSDecimal rightOperand)
Checks to see if one NSDecimal is greater than another.
Definition: CPTUtilities.m:674
CPTLineStyle
Immutable wrapper for various line drawing properties. Create a CPTMutableLineStyle if you want to cu...
Definition: CPTLineStyle.h:20
CPTDecimalFromUnsignedInteger
NSDecimal CPTDecimalFromUnsignedInteger(NSUInteger i)
Converts an NSUInteger value to an NSDecimal.
Definition: CPTUtilities.m:501
CPTDecimalUnsignedCharValue
uint8_t CPTDecimalUnsignedCharValue(NSDecimal decimalNumber)
Converts an NSDecimal value to an unsigned 8-bit integer.
Definition: CPTUtilities.m:111
CPTDecimalLongValue
int32_t CPTDecimalLongValue(NSDecimal decimalNumber)
Converts an NSDecimal value to a 32-bit integer.
Definition: CPTUtilities.m:41
CPTDecimalUnsignedLongLongValue
uint64_t CPTDecimalUnsignedLongLongValue(NSDecimal decimalNumber)
Converts an NSDecimal value to an unsigned 64-bit integer.
Definition: CPTUtilities.m:151
CPTAlignRectFunction
CGRect(* CPTAlignRectFunction)(__nonnull CGContextRef, CGRect)
A function called to align a rectangle in a CGContext.
Definition: CPTUtilities.h:118
CPTDecimalIntegerValue
NSInteger CPTDecimalIntegerValue(NSDecimal decimalNumber)
Converts an NSDecimal value to an NSInteger.
Definition: CPTUtilities.m:91
CPTDecimalNaN
NSDecimal CPTDecimalNaN(void)
Creates and returns an NSDecimal struct that represents the value “not a number” (NaN).
Definition: CPTUtilities.m:733
CPTEdgeInsetsEqualToEdgeInsets
BOOL CPTEdgeInsetsEqualToEdgeInsets(CPTEdgeInsets insets1, CPTEdgeInsets insets2)
Compares two CPTEdgeInsets structstructs.
Definition: CPTUtilities.m:1103
CPTDecimalLessThanOrEqualTo
BOOL CPTDecimalLessThanOrEqualTo(NSDecimal leftOperand, NSDecimal rightOperand)
Checks to see if one NSDecimal is less than or equal to another.
Definition: CPTUtilities.m:707
NSRange
typedef NSRange
CPTDecimalFromShort
NSDecimal CPTDecimalFromShort(int16_t anInt)
Converts a 16-bit integer value to an NSDecimal.
Definition: CPTUtilities.m:271
CGPoint
typedef CGPoint
NSUInteger
typedef NSUInteger
CPTAlignPointToUserSpace
CGPoint CPTAlignPointToUserSpace(__nonnull CGContextRef context, CGPoint point)
Aligns a point in user space to integral coordinates in device space.
Definition: CPTUtilities.m:883
CPTStringFromPoint
NSString *__nonnull CPTStringFromPoint(CGPoint point)
Creates a string representation of the given point.
Definition: CPTUtilities.m:1027
CPTDecimalLessThan
BOOL CPTDecimalLessThan(NSDecimal leftOperand, NSDecimal rightOperand)
Checks to see if one NSDecimal is less than another.
Definition: CPTUtilities.m:696
CPTDecimalAbs
NSDecimal CPTDecimalAbs(NSDecimal value)
Determines the absolute value of an NSDecimal value.
Definition: CPTUtilities.m:787
CPTDecimalFromUnsignedShort
NSDecimal CPTDecimalFromUnsignedShort(uint16_t i)
Converts an unsigned 16-bit integer value to an NSDecimal.
Definition: CPTUtilities.m:409
CPTDecimalDoubleValue
double CPTDecimalDoubleValue(NSDecimal decimalNumber)
Converts an NSDecimal value to a double.
Definition: CPTUtilities.m:211
CPTDecimalFromUnsignedLongLong
NSDecimal CPTDecimalFromUnsignedLongLong(uint64_t i)
Converts an unsigned 64-bit integer value to an NSDecimal.
Definition: CPTUtilities.m:455
CPTAlignSizeToUserSpace
CGSize CPTAlignSizeToUserSpace(__nonnull CGContextRef context, CGSize size)
Adjusts a size in user space to integral dimensions in device space.
Definition: CPTUtilities.m:907
CPTRGBAColor
RGBA color for gradients.
Definition: CPTDefinitions.h:174
CPTDecimalStringValue
NSString *__nonnull CPTDecimalStringValue(NSDecimal decimalNumber)
Converts an NSDecimal value to an NSString.
Definition: CPTUtilities.m:235
CPTDecimalCharValue
int8_t CPTDecimalCharValue(NSDecimal decimalNumber)
Converts an NSDecimal value to an 8-bit integer.
Definition: CPTUtilities.m:21
CPTDecimalIntValue
int CPTDecimalIntValue(NSDecimal decimalNumber)
Converts an NSDecimal value to an int.
Definition: CPTUtilities.m:81
CPTRGBAColorFromCGColor
CPTRGBAColor CPTRGBAColorFromCGColor(__nonnull CGColorRef color)
Extracts the color information from a CGColorRef and returns it as a CPTRGBAColor.
Definition: CPTUtilities.m:829
CPTAlignIntegralRectToUserSpace
CGRect CPTAlignIntegralRectToUserSpace(__nonnull CGContextRef context, CGRect rect)
Aligns a rectangle in user space between integral coordinates in device space.
Definition: CPTUtilities.m:979
CPTDecimalFromUnsignedLong
NSDecimal CPTDecimalFromUnsignedLong(uint32_t i)
Converts an unsigned 32-bit integer value to an NSDecimal.
Definition: CPTUtilities.m:432
CPTInverseLogModulus
double CPTInverseLogModulus(double value)
Computes the inverse log modulus of the given value.
Definition: CPTUtilities.m:1135
CPTDecimalAdd
NSDecimal CPTDecimalAdd(NSDecimal leftOperand, NSDecimal rightOperand)
Adds two NSDecimal structs together.
Definition: CPTUtilities.m:604
CPTDecimalFloatValue
float CPTDecimalFloatValue(NSDecimal decimalNumber)
Converts an NSDecimal value to a float.
Definition: CPTUtilities.m:201
CPTDecimalFromLongLong
NSDecimal CPTDecimalFromLongLong(int64_t anInt)
Converts a 64-bit integer value to an NSDecimal.
Definition: CPTUtilities.m:317
CPTDecimalMultiply
NSDecimal CPTDecimalMultiply(NSDecimal leftOperand, NSDecimal rightOperand)
Multiplies two NSDecimal structs together.
Definition: CPTUtilities.m:632
CPTDecimalFromCGFloat
NSDecimal CPTDecimalFromCGFloat(CGFloat aCGFloat)
Converts a CGFloat value to an NSDecimal.
Definition: CPTUtilities.m:560
BOOL
typedef BOOL
squareOfDistanceBetweenPoints
CGFloat squareOfDistanceBetweenPoints(CGPoint point1, CGPoint point2)
Computes the square of the distance between two points.
Definition: CPTUtilities.m:1067
CPTDecimalFromChar
NSDecimal CPTDecimalFromChar(int8_t anInt)
Converts an 8-bit integer value to an NSDecimal.
Definition: CPTUtilities.m:248
CGContextRef
typedef CGContextRef
CPTDecimalEquals
BOOL CPTDecimalEquals(NSDecimal leftOperand, NSDecimal rightOperand)
Checks to see if one NSDecimal is equal to another.
Definition: CPTUtilities.m:718
CPTDecimalDivide
NSDecimal CPTDecimalDivide(NSDecimal numerator, NSDecimal denominator)
Divides one NSDecimal by another.
Definition: CPTUtilities.m:646
CPTDecimalUnsignedIntegerValue
NSUInteger CPTDecimalUnsignedIntegerValue(NSDecimal decimalNumber)
Converts an NSDecimal value to an NSUInteger.
Definition: CPTUtilities.m:181
CPTDecimalMin
NSDecimal CPTDecimalMin(NSDecimal leftOperand, NSDecimal rightOperand)
Determines the smaller of two NSDecimal values.
Definition: CPTUtilities.m:744
CPTDefinitions.h
CGFloat
typedef CGFloat
CPTAlignPointFunction
CGPoint(* CPTAlignPointFunction)(__nonnull CGContextRef, CGPoint)
A function called to align a point in a CGContext.
Definition: CPTUtilities.h:113
CGSize
typedef CGSize
NSInteger
typedef NSInteger
CPTDecimalUnsignedShortValue
uint16_t CPTDecimalUnsignedShortValue(NSDecimal decimalNumber)
Converts an NSDecimal value to an unsigned 16-bit integer.
Definition: CPTUtilities.m:121
CPTDecimalShortValue
int16_t CPTDecimalShortValue(NSDecimal decimalNumber)
Converts an NSDecimal value to a 16-bit integer.
Definition: CPTUtilities.m:31
CPTCoordinate
CPTCoordinate
Enumeration of axis coordinates.
Definition: CPTDefinitions.h:164
CPTDecimalCGFloatValue
CGFloat CPTDecimalCGFloatValue(NSDecimal decimalNumber)
Converts an NSDecimal value to a CGFloat.
Definition: CPTUtilities.m:221
CPTExpandedRange
NSRange CPTExpandedRange(NSRange range, NSInteger expandBy)
Expands an NSRange by the given amount.
Definition: CPTUtilities.m:809
CPTDecimalLongLongValue
int64_t CPTDecimalLongLongValue(NSDecimal decimalNumber)
Converts an NSDecimal value to a 64-bit integer.
Definition: CPTUtilities.m:61
CPTAlignRectToUserSpace
CGRect CPTAlignRectToUserSpace(__nonnull CGContextRef context, CGRect rect)
Aligns a rectangle in user space to integral coordinates in device space.
Definition: CPTUtilities.m:931
CPTLogModulus
double CPTLogModulus(double value)
Computes the log modulus of the given value.
Definition: CPTUtilities.m:1119
CPTDecimalUnsignedLongValue
uint32_t CPTDecimalUnsignedLongValue(NSDecimal decimalNumber)
Converts an NSDecimal value to an unsigned 32-bit integer.
Definition: CPTUtilities.m:131
CPTStringFromRect
NSString *__nonnull CPTStringFromRect(CGRect rect)
Creates a string representation of the given rectangle.
Definition: CPTUtilities.m:1045
CPTAlignBorderedRectToUserSpace
CGRect CPTAlignBorderedRectToUserSpace(__nonnull CGContextRef context, CGRect rect, CPTLineStyle *__nonnull borderLineStyle)
Definition: CPTUtilities.m:994
NSString
CPTDecimalFromLong
NSDecimal CPTDecimalFromLong(int32_t anInt)
Converts a 32-bit integer value to an NSDecimal.
Definition: CPTUtilities.m:294
CPTDecimalUnsignedIntValue
unsigned int CPTDecimalUnsignedIntValue(NSDecimal decimalNumber)
Converts an NSDecimal value to an unsigned int.
Definition: CPTUtilities.m:171
CPTStringFromVector
NSString *__nonnull CPTStringFromVector(CGVector vector)
Creates a string representation of the given vector.
Definition: CPTUtilities.m:1054
CPTDecimalFromInt
NSDecimal CPTDecimalFromInt(int i)
Converts an int value to an NSDecimal.
Definition: CPTUtilities.m:340
CPTDecimalFromInteger
NSDecimal CPTDecimalFromInteger(NSInteger i)
Converts an NSInteger value to an NSDecimal.
Definition: CPTUtilities.m:363
CPTAlignIntegralPointToUserSpace
CGPoint CPTAlignIntegralPointToUserSpace(__nonnull CGContextRef context, CGPoint point)
Aligns a point in user space between integral coordinates in device space.
Definition: CPTUtilities.m:959
CPTDecimalMax
NSDecimal CPTDecimalMax(NSDecimal leftOperand, NSDecimal rightOperand)
Determines the larger of two NSDecimal values.
Definition: CPTUtilities.m:766
CGRect
typedef CGRect
CPTStringFromSize
NSString *__nonnull CPTStringFromSize(CGSize size)
Creates a string representation of the given size.
Definition: CPTUtilities.m:1036
CPTDecimalFromDouble
NSDecimal CPTDecimalFromDouble(double aDouble)
Converts a double value to an NSDecimal.
Definition: CPTUtilities.m:542
CPTOrthogonalCoordinate
CPTCoordinate CPTOrthogonalCoordinate(CPTCoordinate coord)
Determines the CPTCoordinate that is orthogonal to the one provided.
Definition: CPTUtilities.m:865
NSDecimal
typedef NSDecimal
CPTDecimalFromFloat
NSDecimal CPTDecimalFromFloat(float aFloat)
Converts a float value to an NSDecimal.
Definition: CPTUtilities.m:524
CPTEdgeInsets
Edge inset distances for stretchable images.
Definition: CPTDefinitions.h:221
CPTDecimalSubtract
NSDecimal CPTDecimalSubtract(NSDecimal leftOperand, NSDecimal rightOperand)
Subtracts one NSDecimal from another.
Definition: CPTUtilities.m:618