Re: Compositing to custom view in Cocoa
Re: Compositing to custom view in Cocoa
- Subject: Re: Compositing to custom view in Cocoa
- From: "I. Savant" <email@hidden>
- Date: Fri, 30 Jun 2006 09:52:33 -0400
Kenny:
There's no support directly in NSImage for replacing colors. The
problem you're facing is that not all images are bitmap graphics
(where you work with individual pixels). Some are vector-based.
NSImage is an abstraction of images in general. You can work with
image representations though, however after following the link you
provided, I think your approach could probably use an overhaul.
For one thing, if you'd use an image format that supports
transparency (like tiff, for example), you can simply do away with
the white background in your "characters" image and composite the
correct section, which would allow your view's background to show
through the sides and insides of the letters. That's one approach.
The other approach would be to composite the characters on the fly
using the Cocoa text system using the fixed-width font of your
choice. If however you're trying to use a font that is unavailable,
not universal, not even in a "font" format, or whatever, I can
understand why you're using the above approach.
--
I.S.
On Jun 30, 2006, at 7:56 AM, Kenny Millar wrote:
Hi everyone.
I'm still struggling to find out how to replace colors in an image,
before I draw it to the screen.
Basically I have a black and white image, as an image resource in
my bundle, and subsequently as an NSImage in my app.
When I draw it in my custom view, I'd like to replace all the
'white' pixels with my current background color, and all the black
pixels with a specific fore-ground color.
I've been all through the NSImage and NSView docs, but can't seem
to come close to this.
For an example of what I'm doing look at http://www.kmillar.co.uk/
mac/macstuff.html
Thanks in advance everyone.
-Kenny
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40gmail.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden