Re: 1-bit NSBitmapImageRep?
Re: 1-bit NSBitmapImageRep?
- Subject: Re: 1-bit NSBitmapImageRep?
- From: Heinrich Giesen <email@hidden>
- Date: Thu, 17 Apr 2008 12:45:54 +0200
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