• 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 backgroundcolors ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Transparent backgroundcolors ?


  • Subject: Re: Transparent backgroundcolors ?
  • From: Christopher Holland <email@hidden>
  • Date: Mon, 28 Apr 2003 12:41:32 -0500

Tobi,

I may have the answers you are looking for, although not a solution. :)

The example you give in #2 is drawing correctly. In order to get correct alpha blending with the NSRect shortcut functions you will need to use a "...UsingOperation" function. i.e. your code would be:

[myColor set];
NSRectFillUsingOperation(rect, NSCompositeSourceOver);

That would give you the same effect as the NSBezierPath example that you gave.

Now, that doesn't solve the problem that you are having because I am going to go out on a limb here and say that the standard controls don't use the alpha-blended functions to do their drawing. So unless you want to subclass NSTextField and do your own drawing then I doubt you can get transparent colors there.



On Monday, April 28, 2003, at 11:22 AM, Tobias Hermann wrote:

hi!

I am playing around with transparent colors and some things really seem odd to me: (yes, I called [NSColor setIgnoresAlpha: NO];):

1. I have a brushed metal window and a control on it, e.g. an NSTextField. When I set the backgroundColor to a semi-transparent color, it only gets darker, but the brushed metal pattern is totally gone. who paints the background black before the transparent background color gets drawn ??

2. I subclassed NSView and found out the following:

When drawing the background with a transparent Color like this (within drawRect):

[myColor set];
NSRectFill(rect);

I get the same strange result: the brushed metal surface gets overdrawn totally, and my transparent color only gets darker and darker with smaller alpha values...

When I do this:

[myColor set];
[NSBezierPath fillRect: rect];

it works!! I have still see the brushed metal surface, but a semitransparent myColor lies on top of it...
And that is what I want some Cocoa Controls want to do: paint the background semi-transparent. But i can't get it to work!!

And e.g. when I call NSTextField's setDrawsBackground:NO, i get other sideeffects like that the editing text overdraws itself, etc...

Any hints on that ?

Thank you in advance!!

Tobi
_______________________________________________
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.
_______________________________________________
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.

References: 
 >Transparent backgroundcolors ? (From: Tobias Hermann <email@hidden>)

  • Prev by Date: Re: strange malloc error
  • Next by Date: NSDocumentController open automatically document
  • Previous by thread: Transparent backgroundcolors ?
  • Next by thread: Getting NSPRogressIndicator to go away (Solution)
  • Index(es):
    • Date
    • Thread