mirror of
https://github.com/GRRLIB/GRRLIB.git
synced 2024-11-22 15:02:20 +00:00
[CHG] GRRLIB_Compose is now using 4 spaces for tabs (instead of 2)
This commit is contained in:
parent
08c03a8de9
commit
c8abda9052
1 changed files with 40 additions and 42 deletions
|
@ -173,9 +173,8 @@ GRRLIB_texImg* GRRLIB_LoadTextureJPG (const u8 *my_jpg) {
|
|||
return my_texture;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
/**
|
||||
* Compose a layer/sprite to a canvas/textured-image
|
||||
* Compose a layer/sprite to a canvas/textured-image.
|
||||
* Currently only performs "a-over-b (normal) alpha compositing" (opacity)
|
||||
* Ie. Light source is behind the eye, not behind the canvas!
|
||||
* @author BlueChip
|
||||
|
@ -185,7 +184,6 @@ GRRLIB_texImg* GRRLIB_LoadTextureJPG (const u8 *my_jpg) {
|
|||
* @param canvas : The canvas/textured-image on which to draw
|
||||
* @param mode : Currently unused - will be composition mode
|
||||
*/
|
||||
//==============================================================================
|
||||
void GRRLIB_Compose( int xoff, int yoff, GRRLIB_texImg* layer,
|
||||
GRRLIB_texImg* canvas, GRRLIB_ComposeMode mode )
|
||||
{
|
||||
|
@ -198,18 +196,18 @@ void GRRLIB_Compose( int xoff, int yoff, GRRLIB_texImg* layer,
|
|||
|
||||
// Loop through the layer, one pixel at a time
|
||||
for (y = 0; y < layer->h; y++) {
|
||||
cnv_y = y +yoff; // y coord of canvas pixel to be changed
|
||||
cnv_y = y + yoff; // y coord of canvas pixel to be changed
|
||||
if (cnv_y < 0) continue ; // not on the canvas yet
|
||||
if (cnv_y >= canvas->h) break; // off the bottom of the canvas
|
||||
|
||||
for (x = 0; x < layer->w; x++) {
|
||||
cnv_x = x +xoff; // x coord of canvas pixel to be changed
|
||||
cnv_x = x + xoff; // x coord of canvas pixel to be changed
|
||||
if (cnv_x < 0) continue ; // not on the canvas yet
|
||||
if (cnv_x >= canvas->h) break; // off the right of the canvas
|
||||
|
||||
// Grab the working pixels from the canvas and layer
|
||||
cnv_c = GRRLIB_GetPixelFromtexImg(cnv_x,cnv_y, canvas);
|
||||
lyr_c = GRRLIB_GetPixelFromtexImg(x,y, layer);
|
||||
cnv_c = GRRLIB_GetPixelFromtexImg(cnv_x, cnv_y, canvas);
|
||||
lyr_c = GRRLIB_GetPixelFromtexImg(x, y, layer);
|
||||
|
||||
// Calculate alpha value as 0.0 to 1.0 in 255th's
|
||||
cnv_a = A(cnv_c) /255.0;
|
||||
|
@ -230,7 +228,7 @@ void GRRLIB_Compose( int xoff, int yoff, GRRLIB_texImg* layer,
|
|||
}
|
||||
|
||||
// Replace the old canvas pixel with the new one
|
||||
GRRLIB_SetPixelTotexImg( cnv_x,cnv_y, canvas,
|
||||
GRRLIB_SetPixelTotexImg( cnv_x, cnv_y, canvas,
|
||||
RGBA(new_r, new_g, new_b, new_a) );
|
||||
}//for x
|
||||
}// for y
|
||||
|
|
Loading…
Reference in a new issue