• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Colored Pattern example problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Colored Pattern example problems
      • From: David Duncan <email@hidden>
  • Prev by Date: Re: Function-Key Unicodes
  • Next by Date: How to make 2D lines look 3D
  • Previous by thread: Re: Function-Key Unicodes
  • Next by thread: Re: Colored Pattern example problems
  • Index(es):
    • Date
    • Thread