Re: Quick question: easy way to draw bitmap?
Re: Quick question: easy way to draw bitmap?
- Subject: Re: Quick question: easy way to draw bitmap?
- From: Erik Buck <email@hidden>
- Date: Fri, 13 Jul 2007 07:06:01 -0700 (PDT)
If you want to draw archaic formats like 16 bit RGB(555) color bitmaps, you are likely going to have to do one of two things:
1) Convert the bitmap to a modern supported format. Consider vImageConvert_ARGB1555toARGB8888()
http://developer.apple.com/documentation/Performance/Conceptual/vImage/Chapter10/chapter_10_section_1.html
2) Use OpenGL which will convert formats for you and most likely provide the best performance. OpenGL is also potentially cross platform.
If you select approach 2, start with any of Apple copious OpenGL samples such as http://developer.apple.com/samplecode/OpenGL_Image/ or http://developer.apple.com/samplecode/Cocoa_OpenGL/listing1.html or
http://developer.apple.com/samplecode/NSGLImage/listing3.html
If you start from the GLImage class in the NSGLImage sample, eliminate the NSBitmapImageRep in the sampe and replace the following line:
glTexImage2D(GL_TEXTURE_RECTANGLE_EXT, 0, bpp, imgWidth, imgHeight, 0, GL_RGB, datatype, [bmpRep bitmapData]);
with
glTexImage2D(GL_TEXTURE_RECTANGLE_EXT, 0, bpp, imgWidth, imgHeight, 0, GL_RGB5, datatype, pointerToYourData);
See http://developer.apple.com/documentation/Darwin/Reference/ManPages/man3/glTexImage2D.3.html
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden