• 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
Re: 1-bit NSBitmapImageRep?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 1-bit NSBitmapImageRep?


  • Subject: Re: 1-bit NSBitmapImageRep?
  • From: Graham Cox <email@hidden>
  • Date: Thu, 17 Apr 2008 22:01:29 +1000

Ah, OK, thanks for confirming that.

The process you outline will probably take too long for what I'm doing, so it looks like I'll have to just use 8-bit reps - shame, it's 8 times more memory than the job requires :-(

------
S.O.S.




On 17 Apr 2008, at 8:45 pm, Heinrich Giesen wrote:
Hi,
Can't I just fill or stroke a path with that rep as a context?


no, you can't. If you try to create a context  with:
[NSGraphicsContext graphicsContextWithBitmapImageRep:oneBitRep];
it is not accepted. The errormessage is:

CGBitmapContextCreate: unsupported parameter combination: 1 integer bits/component; 1 bits/pixel; 1-component colorspace; kCGImageAlphaNone

If you really need a 1-bit imageRep and drawing is complicated (bezierPath, and not just a color reduction of a given image)
I would do it in two steps:
1: use a 8 bit rep with 1 component and a WhiteColorSpace (or BlackColorSpace); do the drawing.
2: iterate over the bitmap of this new imageRep, use the gray pixel to convert it to black or white
and set this 1 bit pixel in a corresponding 1 bit imageRep
(this means: filling it yourself)


I wrote a small test application to explore the using (limits) of +graphicsContextWithBitmapImageRep:
I think I extend it to create a 1 bit imageRep. More in private mails.


  Heinrich


-- Heinrich Giesen email@hidden



_______________________________________________

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


References: 
 >Re: 1-bit NSBitmapImageRep? (From: Heinrich Giesen <email@hidden>)
 >Re: 1-bit NSBitmapImageRep? (From: Graham Cox <email@hidden>)
 >Re: 1-bit NSBitmapImageRep? (From: Heinrich Giesen <email@hidden>)

  • Prev by Date: Re: binary search trees & binning
  • Next by Date: Re: Chained Migration of Leopard CoreData stores
  • Previous by thread: Re: 1-bit NSBitmapImageRep?
  • Next by thread: how to wait the finish of NSURLDownload
  • Index(es):
    • Date
    • Thread