Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Alpha for Carbon window...



On Jul 27, 2004, at 10:21 PM, Ando Sonenblick wrote:

Thanks Scott,

So there's no way to say "Use this pixmap as the alpha channel of my window" and have the window Mgr do the compositing/blending magic?

Not that I'm aware of. You might be able to do something with CreateCGImageFromPixMaps, but I don't know of any way to set up the windowin such a way that you specify the alpha channel and have the OS use only the color channels when drawing.

If you draw into the window with QuickDraw it will set the alpha channel to fully opaque for every pixel you touch.

I guess that your solution #1 below is kinda like that, yes? On the kEventWindowPaint, I erase the alpha and then paint in whatever alpha (pixel by pixel) that I want, yes?

You use CGContextClearRect which clears both the Alpha and the color channels (it fills the rect with transparent black if that makes any sense).

Then you can paint the window in whatever alpha values you care to. That's the way the Finder (for example) does it's selection rectangles. The selection rectangle is really just an overlay window that the Finder paints with something like a 25% alpha.

If so, my C++ offscreen abstraction works with GWorlds. I presume I can make another subclass of that to work with CGContexts? Basically I just need the base address and rowbytes, etc...

When you get the paint event it will pass you a CGContext as a parameter to use. If you want to use CG to draw into any other GWorld you can use QDBeginCGContext to create a CG context... Draw your stuff and end it with a call to QDEndCGContext. (don't use QuickDraw calls between the Begin and End context calls).

Scott
_______________________________________________
carbon-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/carbon-development
Do not post admin requests to the list. They will be ignored.


References: 
 >Alpha for Carbon window... (From: Ando Sonenblick <email@hidden>)
 >Re: Alpha for Carbon window... (From: Ricky Sharp <email@hidden>)
 >Re: Alpha for Carbon window... (From: Scott Thompson <email@hidden>)
 >Re: Alpha for Carbon window... (From: Ando Sonenblick <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.