Advertisement
Guest User

Untitled

a guest
Feb 8th, 2024
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.68 KB | None | 0 0
  1. void gPrepareBitmap(CBitmap* bmp)
  2. {
  3.     VMINT cnvs = vm_graphic_create_canvas(bmp->width, bmp->height);
  4.     VMINT layer = vm_graphic_create_layer_ex(0, 0, bmp->width, bmp->height, VM_COLOR_888_TO_565(255, 0, 255), VM_BUF, vm_graphic_get_canvas_buffer(cnvs));
  5.     memcpy(vm_graphic_get_layer_buffer(layer), bmp->pixels, bmp->width * bmp->height * 2);
  6.    
  7.     vm_graphic_canvas_set_trans_color(cnvs, VM_COLOR_888_TO_565(255, 0, 255));
  8.    
  9.     bmp->_platData = (void*)cnvs;
  10. }
  11.  
  12. void gDrawBitmap(CBitmap* bmp, int x, int y)
  13. {
  14.     int i, j;
  15.     if(!bmp->_platData)
  16.         gPrepareBitmap(bmp);
  17.    
  18.     vm_graphic_blt(screenBuf, x, y, vm_graphic_get_canvas_buffer((VMINT)bmp->_platData), 0, 0, bmp->width, bmp->height, 1);
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement