c++ - How to go from raw Bitmap data to SDL Surface or Texture? -


i'm using library called awesomium , has following function:

void awesomium::bitmapsurface::copyto   (   unsigned char *     dest_buffer, // output int     dest_row_span, // input can select int     dest_depth, // input can select bool    convert_to_rgba, // input can select bool    flip_y // input can select )       const copy bitmap destination. set dirty bit false.  parameters dest_buffer pointer destination pixel buffer. dest_row_span   number of bytes per-row of destination. dest_depth  depth (number of bytes per pixel, 4 bgra surfaces , 3 bgr surfaces). convert_to_rgba whether or not should convert bgra rgba. flip_y  whether or not should invert bitmap vertically. 

this great because gives me unsigned char * dest_buffer contains raw bitmap data. i've been trying several hours convert raw bitmap data sort of usable format can use in sdl i'm having trouble. =[ there way can load sdl texture or surface? ideal have examples both if 1 example (either texture or surface), sufficient , grateful. :) tried use sdl_loadbmp_rw crashed. i'm not sure if should using method.

sdl_loadbmp_rw loading image in bmp file format. , expects sdl_rwops*, file stream, not pixel buffer. function want sdl_creatergbsurfacefrom. believe call should work purposes:

sdl_surface* surface =     sdl_creatergbsurfacefrom(       pixels,       // dest_buffer copyto       width,        // in pixels       height,       // in pixels       depth,        // in bits, should dest_depth * 8       pitch,        // dest_row_span copyto       rmask,        // rgba masks, see docs       gmask,       bmask,       amask     ); 

Comments

Popular posts from this blog

javascript - Bootstrap Popover: iOS Safari strange behaviour -

Magento/PHP - Get phones on all members in a customer group -

session - Logging Out Using PHP -