Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

dave.h

macrumors newbie
Original poster
Apr 30, 2005
7
0
I was previously using NSImage References for all my sprites, which made it relatively easy to draw semi-transparent images, using

[myImage drawInRect:dest fromrect:src operation:eek:p fraction:(1.0 - transparency)]

However, I'm currently in the process of porting my game to Quartz, and I'm using the operation

CGContextDrawImage( myContext,
myRectToDrawIn,
myImgSource);

I have a feeling drawing semi-transparently has something to do with CGSetRGBFillColor, but I'm not completely sure. Transparency is very important in my graphics engine, so... I'm kind of crippled in development before I figure this out.
 
um

i figured out the answer

CGContextSetAlpha(0.25)

draw something

CGContextSetAlpha(0.5)

draw again

CGContextSetAlpha(1)

draw fully visible.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.