• 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: Transparent color over an image: how to prevent a hole?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Transparent color over an image: how to prevent a hole?


  • Subject: Re: Transparent color over an image: how to prevent a hole?
  • From: John Timmer <email@hidden>
  • Date: Wed, 24 Sep 2003 14:11:35 -0400

I'm afraid that you may have to composite the text and the image onto a new
image, then place the new image into the NSImageView that's holding it. The
code would look something like this:


tempImage = [[NSImage alloc] initWithSize: [regularImage size]];
[tempImage lockFocus];
[regularImage compositeToPoint: NSMakePoint(0, 0) operation:
NSCompositeSourceOver];
[overlayString drawAtPoint: NSMakePoint(8,7)];
[tempImage unlockFocus];

There's definitely some problems with transparency affects blasting through
the underlying view hierarcy. Compositing a raw gif with transparency will
also blow a hole through the underlying window, so if there's a problem with
this happening, it can usually be solved by re-compositing onto a fresh
image.

Cheers,

JT

> I have some text over an image, and I would like to make the text blink by
> periodically making it disappear. I tried to do this by setting the
> NSBackgroundColorAttributeName and NSForegroundColorAttributeName to [NSColor
> clearColor], but when I do this, the clear color goes right through the image
> and the window making a hole.
>
> How do I get the transparency to stop at the image?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Transparent color over an image: how to prevent a hole?
      • From: Greg Titus <email@hidden>
References: 
 >Transparent color over an image: how to prevent a hole? (From: "Ujwal S. Sathyam" <email@hidden>)

  • Prev by Date: Re: NSTextFieldCell subclass
  • Next by Date: Re: Transparent color over an image: how to prevent a hole?
  • Previous by thread: Transparent color over an image: how to prevent a hole?
  • Next by thread: Re: Transparent color over an image: how to prevent a hole?
  • Index(es):
    • Date
    • Thread