• 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
CGContextSetRGBFillColor() off by one?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CGContextSetRGBFillColor() off by one?


  • Subject: CGContextSetRGBFillColor() off by one?
  • From: Mike Manzano <email@hidden>
  • Date: Thu, 29 May 2008 00:21:27 -0700

Hi there,

I have this code:

	CGContextSetRGBFillColor(cref, 0xaa/255.0, 0xb0/255.0,0xc0/255.0, 1) ;
	CGContextFillRect(cref, CGRectMake(0, 0, w, h))	 ;
	CGContextFlush(cref) ;

Later on, I get the image buffer to print out the contents of the first pixel:

	unsigned long*data = CGBitmapContextGetData (cref);
	if (data != NULL)
		NSLog( "%lx" , data[0]) ;

Here's the output:

c0b0a9ff

Regardless of what I set the red component to, the value in the actual image buffer is always off by one (it is always exactly one less). This does not seem to be true for the green and blue components.

Any ideas why?

Mike
_______________________________________________

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: CGContextSetRGBFillColor() off by one?
      • From: Uli Kusterer <email@hidden>
  • Prev by Date: NSFileHandle fileHandleForUpdatingAtPath never returns
  • Next by Date: Package Builder Questions
  • Previous by thread: Re: NSFileHandle fileHandleForUpdatingAtPath never returns
  • Next by thread: Re: CGContextSetRGBFillColor() off by one?
  • Index(es):
    • Date
    • Thread