• 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: alpha color and drawRect
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: alpha color and drawRect


  • Subject: Re: alpha color and drawRect
  • From: Nicko van Someren <email@hidden>
  • Date: Mon, 3 Apr 2006 17:56:48 +0100

On 3 Apr 2006, at 14:52, Valerio Ferrucci wrote:

Here is the code:

- (void)drawRect:(NSRect)rect
{
	NSRect	bounds = [self bounds];
	[[NSColor colorWithDeviceRed:22. green:22. blue:22. alpha:.3] set];
	[NSBezierPath fillRect:NSInsetRect(bounds, 100, 100)];
}

You're GB components are out of range; they are supposed to be in the range 0.0 to 1.0 so 22 is well off. It's quite possible that the effect you are seeing is because the color is being stored "pre- scaled" with the alpha channel.


	Nicko



Il giorno 03/apr/06, alle ore 15:45, Stephane ha scritto:


On Apr 3, 2006, at 3:38 PM, Valerio Ferrucci wrote:

Hi,
I have a window with backGroundcolor completely transparent.

[myWin setBackgroundColor:[NSColor colorWithDeviceRed:22. green: 22. blue:22. alpha:0]];

then I add to it a subView to draw something inside. (all this is inspired by the overlay win apple example).

The view's drawRect routine simply draw a little centered rect with the semi-transparent color:
[NSColor colorWithDeviceRed:22. green:22. blue:22. alpha:.3]


The problem is:
the centered rect doesn't remain transparent. Instead it becomes completely in 2 or 3 redraws white!!.


Any idea?

Probably if you could show the code you're using to fill that rect.


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40tabasoft.it


This email sent to email@hidden

================================================================== Valerio Ferrucci Tabasoft Sas email@hidden http://www.tabasoft.it


_______________________________________________ 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

_______________________________________________ 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
References: 
 >alpha color and drawRect (From: Valerio Ferrucci <email@hidden>)
 >Re: alpha color and drawRect (From: Stephane <email@hidden>)
 >Re: alpha color and drawRect (From: Valerio Ferrucci <email@hidden>)

  • Prev by Date: Re: Path names in executable
  • Next by Date: Re: get window server?
  • Previous by thread: Re: alpha color and drawRect
  • Next by thread: Re: Distro?
  • Index(es):
    • Date
    • Thread