discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSColor question


From: Fred Kiefer
Subject: Re: NSColor question
Date: Tue, 24 Feb 2004 03:09:57 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030821

Chris B. Vetter wrote:
Hi,

I was trying to create a splash window, you know like Acroread displays
during startup. For that, I figured to create a transparent window and
add a content view that draws an irregular shape in -drawRect:

Before working on the view I tried to create the transparent window,
using the following:

  color = [NSColor clearColor];

  window = [[NSWindow alloc] initWithContentRect: rect
             styleMask: NSBorderlessWindowMask
             backing: NSBackingStoreBuffered
             defer: NO];
  [window setBackgroundColor: color];
  [window setAlphaValue: 1.0];
  [window setOpaque: NO];


However, popping open the window, all I got was a _black_ background on
back-art and a _white_ background on back-xlib.

Looking at the source to NSColor, I saw that +clearColor really is just
a [self colorWithCalibratedWhite: 0.0 alpha: 0.0]

Playing around with various color settings I found out that both,
+colorWithCalibratedWhite:alpha: and +colorWithDeviceWhite:alpha: do
exactly the same thing: black on back-art, white on back-xlib, without
any regard of the values passed for 'white' or 'alpha'.
Using +setIgnoresAlpha: didn't seem to make a difference either.

All the +<color>Color and +colorWith<whatever>:a:b:c: seem to work fine.

Is this a known problem, or am I missing something?


Both X backends currently don't support an alpha value for the window itself, as X has no way of dealing with (half) transparent windows. Ok, there are ways to fake them even with X, but nobody has regarded this as worthwhile. What is interesting is, that both backends result in different colours being displayed instead. I have no idea, which is correcter.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]