Coconut Data Framework  beta
Classes | Enumerations | Functions
CNGeometryFunc.h File Reference

Define basic data types for graphics. More...

#import "CNAlign.h"

Go to the source code of this file.

Classes

struct  CNPoint2D

Enumerations

enum  { CNPointXPos = 0, CNPointYPos = 1, CNPointZPos = 2 }

Functions

static void CNSetPoint (NSPoint *dst, CGFloat x, CGFloat y)
 Set value to NSPoint.
static BOOL CNIsSamePoint (const NSPoint *a, const NSPoint *b)
 Compare NSPoint objects.
static void CNAddPoint (NSPoint *dst, const NSPoint *a, const NSPoint *b)
 Add 2 points.
static void CNDiffPoint (NSPoint *dst, const NSPoint *a, const NSPoint *b)
 Get difference of points.
static void CNSetSize (NSSize *dst, CGFloat w, CGFloat h)
 Set value to NSSize.
static BOOL CNIsZeroSize (const NSSize *src)
 Check the size is empty or not.
static BOOL CNIsSameSize (const NSSize *a, const NSSize *b)
 Compare NSSize objects.
static void CNSetRect (NSRect *dst, CGFloat x, CGFloat y, CGFloat width, CGFloat height)
 Set values for NSRect.
static void CNInitRect (NSRect *dst)
 Initialize NSRect object.
static BOOL CNIsSameRect (const NSRect *a, const NSRect *b)
 Compare NSRect objects.
void CNUnionRect (NSRect *dst, const NSRect *src0, const NSRect *src1)
 Get unioned rectangle.
static BOOL CNIsValidRect (const NSRect *src)
 Validate the rectangle.
static BOOL CNIsOverwrapperdRect (const NSRect *a, const NSRect *b)
 Check the rectangles are overwrapper.
void CNAlignRect (NSRect *dst, CNAlign align, const NSRect *bounds, const NSSize *src)
 Place the src rectangle to the center of the frame.
static void CNSetPoint2D (struct CNPoint2D *dst, CGFloat x, CGFloat y)
 Set parameters for 2D point.
static const CGFloat * CNVectorOfPoint2D (const struct CNPoint2D *src)
 Get vector of 2D point.

Detailed Description

Define basic data types for graphics.

Copyright
Copyright (C) 2011 Steel Wheels Project

Enumeration Type Documentation

anonymous enum
Enumerator:
CNPointXPos 

The index for X position in the vector

CNPointYPos 

The index for Y position in the vector

CNPointZPos 

The index for Z position in the vector


Function Documentation

static void CNSetPoint ( NSPoint *  dst,
CGFloat  x,
CGFloat  y 
) [inline, static]

Set value to NSPoint.

Parameters:
dstDestination point
xSource X position
ySource Y position

Referenced by CNSetRect().

static BOOL CNIsSamePoint ( const NSPoint *  a,
const NSPoint *  b 
) [inline, static]

Compare NSPoint objects.

Return values:
TRUEThey have same values
FALSEThey have different value
Parameters:
aSource point A
bSource point B

Referenced by CNIsSameRect().

static void CNAddPoint ( NSPoint *  dst,
const NSPoint *  a,
const NSPoint *  b 
) [inline, static]

Add 2 points.

Parameters:
dstDestination to set result
aSource point A
bSource point B
static void CNDiffPoint ( NSPoint *  dst,
const NSPoint *  a,
const NSPoint *  b 
) [inline, static]

Get difference of points.

Parameters:
dstDifference of given source points
aSource point A
bSource point B
static void CNSetSize ( NSSize *  dst,
CGFloat  w,
CGFloat  h 
) [inline, static]

Set value to NSSize.

Parameters:
dstDestination size
wSource width value
hSource height value

Referenced by CNSetRect().

static BOOL CNIsZeroSize ( const NSSize *  src) [inline, static]

Check the size is empty or not.

Return values:
TRUEThe width and height of the source size is zero
FALSEThe width or height of the source size is NOT zero
Parameters:
srcSource size
static BOOL CNIsSameSize ( const NSSize *  a,
const NSSize *  b 
) [inline, static]

Compare NSSize objects.

Return values:
TRUEThey have same values
FALSEThey have different value
Parameters:
aSource size A
bSource size B

Referenced by CNIsSameRect().

static void CNSetRect ( NSRect *  dst,
CGFloat  x,
CGFloat  y,
CGFloat  width,
CGFloat  height 
) [inline, static]

Set values for NSRect.

Parameters:
dstDestination rectangle
xSource X origin
ySource Y origin
widthWidth of rect
heightHeight of rect

References CNSetPoint(), and CNSetSize().

Referenced by CNInitRect().

static void CNInitRect ( NSRect *  dst) [inline, static]

Initialize NSRect object.

Parameters:
dstDestination rect
Note
The rect will have origin (0, 0) and size (0, 0)

References CNSetRect().

static BOOL CNIsSameRect ( const NSRect *  a,
const NSRect *  b 
) [inline, static]

Compare NSRect objects.

Return values:
TRUEThey have same values
FALSEThey have different value
Parameters:
aSource rect A
bSource rect B

References CNIsSamePoint(), and CNIsSameSize().

void CNUnionRect ( NSRect *  dst,
const NSRect *  src0,
const NSRect *  src1 
)

Get unioned rectangle.

Returns:
Unioned rectangle
Parameters:
dstDestination to set result
src0Source rectangle 0
src1Source rectangle 1
Note
This is simular to NSUnionRect function. But you can pass NULL pointer for src0 or/and src1. If NULL is passed, the rectangble is ignored.
static BOOL CNIsValidRect ( const NSRect *  src) [inline, static]

Validate the rectangle.

Return values:
TRUESource rectangle is valid
FALSESource rectangle is NOT valid
Parameters:
srcSource rectangle
static BOOL CNIsOverwrapperdRect ( const NSRect *  a,
const NSRect *  b 
) [inline, static]

Check the rectangles are overwrapper.

Return values:
TRUE2 rectangles are overwrapped
FALSE2 rectangles are NOT overwrapped
Parameters:
aSource rectangle A
bSource rectangle B
void CNAlignRect ( NSRect *  dst,
CNAlign  align,
const NSRect *  bounds,
const NSSize *  src 
)

Place the src rectangle to the center of the frame.

Parameters:
dstDestination bound rectangle
alignAlignment for source
boundsBound rectanble
srcSource rectangle size
Note
You can pass same object "dst" and "src".
static void CNSetPoint2D ( struct CNPoint2D dst,
CGFloat  x,
CGFloat  y 
) [inline, static]

Set parameters for 2D point.

Parameters:
dstDestination 2D point
xSource X pos
ySource Y pos

References CNPointXPos, CNPointYPos, and CNPoint2D::vector.

static const CGFloat* CNVectorOfPoint2D ( const struct CNPoint2D src) [inline, static]

Get vector of 2D point.

Returns:
Vector of positions
Parameters:
srcSource 2D point

References CNPoint2D::vector.