Hi.
>Is there a way I can use quartz to colorize a bitmap image? Or, if
>not, is there a non-QD way to do that with Carbon or cocoa calls?
I also seek any other better way than I do now if exist.
My app needs colorize each pixel one by one, such as SetCPixel() for
QuickDraw. Now I create 4 bytes color data, and set it to Bitmap context
directly as following code.
UInt16 red, green, blue; // actually defined as RGBColor
UInt32 height, width; // prsented by caller
UInt32 hh, vv;
UInt32 colorData;
CGContextRef bitmapContext;
UInt32 rowBytes;
Ptr baseAddr;
baseAddr = CGBitmapContextGetData( bitmapContext );
rowBytes = CGBitmapContextGetBytesPerRow( bitmapContext );
for ( vv = 0; vv < height; vv++ )
for ( hh = 0; hh < width; hh++ )
{ /* Calculate and set red/green/blue here */
colorData = ((long)(red & 0xff00)) << 8 + (green &0xff00) + blue >> 8;
*(UInt32*)(baseAddr + vv * rowBytes + hh * 4 ) = colorData;
}
}
I did this way even in QuickDraw program, because SetCPixel and LineTo are
too slow for my app.
# This is my first mail here.
Yoshiaki Katayanagi
http://www.jizoh.jp/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartz-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartz-dev/email@hidden
This email sent to email@hidden