How do you set an image's background color to CLEAR?
How do you set an image's background color to CLEAR?
- Subject: How do you set an image's background color to CLEAR?
- From: "Frederick C. Lee" <email@hidden>
- Date: Wed, 12 Jan 2005 17:59:19 -0800
Greetings:
I want to overlay a text image upon a background image, like of a map of Europe or whatever. For example, I have a small TIFF file with "Hello World!" upon a white background via GraphicConverter.
I do get an overlay. But when I reduce the alpha value of the banner, the entire image fades. What I want is the text with clear background upon the background image.
I tried to do a [[NSColor clearColor] set] but nothing happened.
Any ideas?
Here's my code:
- (void)drawRect:(NSRect)rect
{
NSLog(@"{transView} drawRect.");
if ([[self backgroundImage] isValid]) {
NSLog(@"We have a valid background image.");
NSRect bds = [self bounds];
// draw the whole background
[backgroundImage drawInRect:bds fromRect:bds
operation:NSCompositeSourceOver fraction:1.0];
} else {
NSLog(@"We don't have a background image!");
}
if ([[self bannerImage] isValid]) {
NSRect bds = [self bounds];
// draw the whole background
// [[NSColor clearColor]set] <--- something like this?
[bannerImage drawInRect:bds fromRect:bds
operation:NSCompositeSourceAtop fraction:1.0];
} else {
NSLog(@"We don't have a banner image!");
}
}
-----
Regards,
Ric.
_______________________________________________
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