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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to