currently porting from Cocoa to Quartz 2d...

Discussion in 'Mac Programming' started by dave.h, May 20, 2005.

  1. dave.h macrumors newbie

    Joined:
    Apr 30, 2005
    #1
    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.
     
  2. dave.h thread starter macrumors newbie

    Joined:
    Apr 30, 2005
    #2
    um

    i figured out the answer

    CGContextSetAlpha(0.25)

    draw something

    CGContextSetAlpha(0.5)

    draw again

    CGContextSetAlpha(1)

    draw fully visible.
     

Share This Page