can I use RGB_565 , ARGB_4444, RGBA_8888, RGBX_8888, RGB_888 texture ?
can I use RGB_565 , ARGB_4444, RGBA_8888, RGBX_8888, RGB_888 texture ?
Sorry ..
I have some image .but pixels format is RGB_565 , ARGB_4444, RGBA_8888, RGBX_8888, RGB_888,
If you're loading from memory using the CL_PixelBuffer interface, you can check the CL_TextureFormat enumerator.
RGB_565 - No. (Interestingly, ClanLib 1.0.0 had an entry for this)
RGB_888 - Yes, via cl_rgb8.
RGBA_8888 - Yes, via cl_rgba8
RGBX_8888 - No, but you can just use cl_rgba8 and drop/ignore the alpha channel.
ARGB_4444 - No, but we have cl_rgba4 (different colour order) and cl_argb8 (different colour size).
If the image is a raw bitmap inside the system memory, you can construct a PixelBuffer and pass the pointer to that image into it using the proper texture format flag. ClanLib supports RGBA_8888(cl_rgba8) and RGB_888(cl_rgb8), while the others need to be converted manually to work. From there you can create a texture using the newly created PixelBuffer.
In ClanLib 2.3 you can do something like:
Code:CL_PixelBuffer image(width, height, cl_rgba8, raw_data); // Create system pixel buffer from raw_data CL_Texture texture(clgc, width, height, cl_rgba8); // Create texture with proper dimensions texture.set_image(image); // Put image data into texture.
Bookmarks