All pastes #743658 Raw Edit

Someone

public text v1 · immutable
·published 2007-10-20 17:20 UTC
rendered paste body
   /* Make a translucent copy of the ship */
   ALLEGRO_BITMAP *old_target = al_get_target_bitmap();
   for (int py = 0; py < al_get_bitmap_height(bitmap); py++) {
      for (int px = 0; px < al_get_bitmap_height(bitmap); px++) {
         ALLEGRO_COLOR color;
         al_get_pixel(bitmap, px, py, &color);
         unsigned char r, g, b, a;
         al_set_target_bitmap(bitmap);
         al_unmap_rgba(&color, &r, &g, &b, &a);
         al_set_target_bitmap(trans_bitmap);
         if (a != 0) {
            a = 160;
            al_map_rgba(&color, r, g, b, a);
         }
         al_put_pixel(px, py, &color);
      }
   }
   al_set_target_bitmap(old_target);