Colored Pattern example problems
Colored Pattern example problems
- Subject: Colored Pattern example problems
- From: FF <email@hidden>
- Date: Thu, 23 Dec 2010 08:58:07 -0500
I copied this example from Apple docs. Listing 6-5: and get 3 errors - as below.
Can someone suggest the fixes. I'm new to CG environment.
Thanks and Merry Xmas everyone.
Jack.
#define H_PATTERN_SIZE 16
#define V_PATTERN_SIZE 16
#define H_PSIZE 8
#define V_PSIZE 8
void MyColoredPatternPainting (CGContextRef myContext, CGRect rect) {
CGPatternRef pattern;
CGColorSpaceRef patternSpace;
float alpha = 1,
width, height; //Error: unused variables
static const CGPatternCallbacks callbacks = { 0, &MyDrawPattern, NULL }; //Error: MyDrawPattern undeclared
CGContextSaveGState (myContext);
patternSpace = CGColorSpaceCreatePattern (NULL);
CGContextSetFillColorSpace (myContext, patternSpace);
CGColorSpaceRelease (patternSpace);
pattern = CGPatternCreate (NULL,
CGRectMake (0, 0, H_PSIZE, V_PSIZE),
CGAffineTransformMake (1, 0, 0, 1, 0, 0),
H_PATTERN_SIZE,
V_PATTERN_SIZE,
kCGPatternTilingConstantSpacing,
true,
&callbacks);
CGContextSetFillPattern (myContext, pattern, &alpha); //Error: arg 3 from incompatible pointer
CGPatternRelease (pattern);
CGContextFillRect (myContext, rect);
CGContextRestoreGState (myContext);
}
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden