#include <stdio.h>#include <stdlib.h>#include <SDL.h>#include <SDL_video.h>Go to the source code of this file.
| Data Structures | |
| struct | SDL_gfxBlitInfo | 
| The structure passed to the low level blit functions.  More... | |
| Defines | |
| #define | GFX_RGBA_FROM_PIXEL(pixel, fmt, r, g, b, a) | 
| Unwrap RGBA values from a pixel using mask, shift and loss for surface. | |
| #define | GFX_DISASSEMBLE_RGBA(buf, bpp, fmt, pixel, r, g, b, a) | 
| Disassemble buffer pointer into a pixel and separate RGBA values. | |
| #define | GFX_PIXEL_FROM_RGBA(pixel, fmt, r, g, b, a) | 
| Wrap a pixel from RGBA values using mask, shift and loss for surface. | |
| #define | GFX_ASSEMBLE_RGBA(buf, bpp, fmt, r, g, b, a) | 
| Assemble pixel into buffer pointer from separate RGBA values. | |
| #define | GFX_ALPHA_BLEND(sR, sG, sB, A, dR, dG, dB) | 
| Blend the RGB values of two pixels based on a source alpha value. | |
| #define | GFX_DUFFS_LOOP4(pixel_copy_increment, width) | 
| 4-times unrolled DUFFs loop. | |
| Functions | |
| SDL_GFXBLITFUNC_SCOPE int | SDL_gfxBlitRGBA (SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect) | 
| Blitter for RGBA->RGBA blits with alpha adjustment. | |
| SDL_GFXBLITFUNC_SCOPE int | SDL_gfxSetAlpha (SDL_Surface *src, Uint8 a) | 
| Sets the alpha channel in a 32 bit surface. | |
| SDL_GFXBLITFUNC_SCOPE int | SDL_gfxMultiplyAlpha (SDL_Surface *src, Uint8 a) | 
| Multiply the alpha channel in a 32bit surface. | |
| #define GFX_ALPHA_BLEND | ( | sR, | |||
| sG, | |||||
| sB, | |||||
| A, | |||||
| dR, | |||||
| dG, | |||||
| dB | ) | 
do { \ dR = (((sR-dR)*(A))/255)+dR; \ dG = (((sG-dG)*(A))/255)+dG; \ dB = (((sB-dB)*(A))/255)+dB; \ } while(0)
Blend the RGB values of two pixels based on a source alpha value.
Definition at line 114 of file SDL_gfxBlitFunc.h.
| #define GFX_ASSEMBLE_RGBA | ( | buf, | |||
| bpp, | |||||
| fmt, | |||||
| r, | |||||
| g, | |||||
| b, | |||||
| a | ) | 
{                                                                       \
        Uint32 pixel;                                   \
        \
        GFX_PIXEL_FROM_RGBA(pixel, fmt, r, g, b, a);    \
        *((Uint32 *)(buf)) = pixel;                     \
        }
Assemble pixel into buffer pointer from separate RGBA values.
Definition at line 103 of file SDL_gfxBlitFunc.h.
| #define GFX_DISASSEMBLE_RGBA | ( | buf, | |||
| bpp, | |||||
| fmt, | |||||
| pixel, | |||||
| r, | |||||
| g, | |||||
| b, | |||||
| a | ) | 
do { \ pixel = *((Uint32 *)(buf)); \ GFX_RGBA_FROM_PIXEL(pixel, fmt, r, g, b, a); \ pixel &= ~fmt->Amask; \ } while(0)
Disassemble buffer pointer into a pixel and separate RGBA values.
Definition at line 82 of file SDL_gfxBlitFunc.h.
| #define GFX_DUFFS_LOOP4 | ( | pixel_copy_increment, | |||
| width | ) | 
{ int n = (width+3)/4;                                                  \
        switch (width & 3) {                                            \
        case 0: do {    pixel_copy_increment;                           \
        case 3:         pixel_copy_increment;                           \
        case 2:         pixel_copy_increment;                           \
        case 1:         pixel_copy_increment;                           \
        } while ( --n > 0 );                                    \
        }                                                               \
        }
4-times unrolled DUFFs loop.
This is a very useful loop for optimizing blitters.
Definition at line 126 of file SDL_gfxBlitFunc.h.
| #define GFX_PIXEL_FROM_RGBA | ( | pixel, | |||
| fmt, | |||||
| r, | |||||
| g, | |||||
| b, | |||||
| a | ) | 
{                                                                       \
        pixel = ((r>>fmt->Rloss)<<fmt->Rshift)|                         \
        ((g>>fmt->Gloss)<<fmt->Gshift)|                         \
        ((b>>fmt->Bloss)<<fmt->Bshift)|                         \
        ((a<<fmt->Aloss)<<fmt->Ashift);                         \
        }
Wrap a pixel from RGBA values using mask, shift and loss for surface.
Definition at line 92 of file SDL_gfxBlitFunc.h.
| #define GFX_RGBA_FROM_PIXEL | ( | pixel, | |||
| fmt, | |||||
| r, | |||||
| g, | |||||
| b, | |||||
| a | ) | 
{                                                                       \
        r = ((pixel&fmt->Rmask)>>fmt->Rshift)<<fmt->Rloss;              \
        g = ((pixel&fmt->Gmask)>>fmt->Gshift)<<fmt->Gloss;              \
        b = ((pixel&fmt->Bmask)>>fmt->Bshift)<<fmt->Bloss;              \
        a = ((pixel&fmt->Amask)>>fmt->Ashift)<<fmt->Aloss;              \
        }
Unwrap RGBA values from a pixel using mask, shift and loss for surface.
Definition at line 71 of file SDL_gfxBlitFunc.h.
| SDL_GFXBLITFUNC_SCOPE int SDL_gfxBlitRGBA | ( | SDL_Surface * | src, | |
| SDL_Rect * | srcrect, | |||
| SDL_Surface * | dst, | |||
| SDL_Rect * | dstrect | |||
| ) | 
Blitter for RGBA->RGBA blits with alpha adjustment.
Verifies the input 'src' and 'dst' surfaces and rectangles and performs blit. The destination clip rectangle is honored.
| src | The source surface. | |
| srcrect | The source rectangle. | |
| dst | The destination surface. | |
| dstrect | The destination rectangle. | 
Definition at line 390 of file SDL_gfxBlitFunc.c.
| SDL_GFXBLITFUNC_SCOPE int SDL_gfxMultiplyAlpha | ( | SDL_Surface * | src, | |
| Uint8 | a | |||
| ) | 
Multiply the alpha channel in a 32bit surface.
Helper function that multiplies the alpha channel in a 32 bit surface with a constant value. The final alpha is always scaled to the range 0-255 (i.e. the factor is a/256).
Only 32 bit surfaces can be used with this function.
| src | Pointer to the target surface to change. | |
| a | The alpha value to multiply with. When a is 255, this function is a NoOp. | 
Definition at line 566 of file SDL_gfxBlitFunc.c.
| SDL_GFXBLITFUNC_SCOPE int SDL_gfxSetAlpha | ( | SDL_Surface * | src, | |
| Uint8 | a | |||
| ) | 
Sets the alpha channel in a 32 bit surface.
Helper function that sets the alpha channel in a 32 bit surface to a constant value. Only 32 bit surfaces can be used with this function.
| src | Pointer to the target surface to change. | |
| a | The alpha value to set. | 
Definition at line 503 of file SDL_gfxBlitFunc.c.
 1.6.2
 1.6.2