mirror of
https://github.com/GRRLIB/GRRLIB.git
synced 2024-11-22 23:12:21 +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;
|
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)
|
* Currently only performs "a-over-b (normal) alpha compositing" (opacity)
|
||||||
* Ie. Light source is behind the eye, not behind the canvas!
|
* Ie. Light source is behind the eye, not behind the canvas!
|
||||||
* @author BlueChip
|
* @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 canvas : The canvas/textured-image on which to draw
|
||||||
* @param mode : Currently unused - will be composition mode
|
* @param mode : Currently unused - will be composition mode
|
||||||
*/
|
*/
|
||||||
//==============================================================================
|
|
||||||
void GRRLIB_Compose( int xoff, int yoff, GRRLIB_texImg* layer,
|
void GRRLIB_Compose( int xoff, int yoff, GRRLIB_texImg* layer,
|
||||||
GRRLIB_texImg* canvas, GRRLIB_ComposeMode mode )
|
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
|
// Loop through the layer, one pixel at a time
|
||||||
for (y = 0; y < layer->h; y++) {
|
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 < 0) continue ; // not on the canvas yet
|
||||||
if (cnv_y >= canvas->h) break; // off the bottom of the canvas
|
if (cnv_y >= canvas->h) break; // off the bottom of the canvas
|
||||||
|
|
||||||
for (x = 0; x < layer->w; x++) {
|
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 < 0) continue ; // not on the canvas yet
|
||||||
if (cnv_x >= canvas->h) break; // off the right of the canvas
|
if (cnv_x >= canvas->h) break; // off the right of the canvas
|
||||||
|
|
||||||
// Grab the working pixels from the canvas and layer
|
// Grab the working pixels from the canvas and layer
|
||||||
cnv_c = GRRLIB_GetPixelFromtexImg(cnv_x,cnv_y, canvas);
|
cnv_c = GRRLIB_GetPixelFromtexImg(cnv_x, cnv_y, canvas);
|
||||||
lyr_c = GRRLIB_GetPixelFromtexImg(x,y, layer);
|
lyr_c = GRRLIB_GetPixelFromtexImg(x, y, layer);
|
||||||
|
|
||||||
// Calculate alpha value as 0.0 to 1.0 in 255th's
|
// Calculate alpha value as 0.0 to 1.0 in 255th's
|
||||||
cnv_a = A(cnv_c) /255.0;
|
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
|
// 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) );
|
RGBA(new_r, new_g, new_b, new_a) );
|
||||||
}//for x
|
}//for x
|
||||||
}// for y
|
}// for y
|
||||||
|
|
Loading…
Reference in a new issue