• 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
How do you set an image's background color to CLEAR?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: How do you set an image's background color to CLEAR?
      • From: Andrew Farmer <email@hidden>
  • Prev by Date: Edit cell after adding to TableView
  • Next by Date: NSWindow orderOut: causing a crash?
  • Previous by thread: Edit cell after adding to TableView
  • Next by thread: Re: How do you set an image's background color to CLEAR?
  • Index(es):
    • Date
    • Thread