// // G A M E.O.N.E - LOW LEVEL LIB V1.0 // Copyright (C) 2001 LEVEL ONE ENTERTAINMENT, // Licensed under the terms of LGPL. //:--------------------------------------------------------------------------- //:Description // // LLGFX-BLITTER Funktionen // // SourceRect: Falls die SrcGrafik Frames besitzt, gibt rect die Framenummer ab #0 an // ansonsten einen Zeiger auf ein SrcRect übergeben. // Frames werden mit llgfx_SetFrameCount() gesetzt. //:--------------------------------------------------------------------------- #if !defined(LLGFX_BLIT_INCLUDED) #define LLGFX_BLIT_INCLUDED #if !defined(LLGFX_INCLUDED) #include "llgfx.h" #endif //:Custom /* * Blit FLAGS */ #define BLIT_COPY (1<<0) // Plain copy #define BLIT_STRETCH (1<<1) // Stretchfactor in sBLITFX.scale angeben #define BLIT_ROTATE (1<<2) // Grad 0-360 in sBLITFX.angle angeben #define BLIT_RASTER (1<<3) // 50% copy "*.*.*" #define BLIT_SRCALPHA (1<<5) // SrcGfx Alphachannel, Grafik muss mit LLGFX_CACHE Flag geladen sein! #define BLIT_FIXALPHA (1<<6) // Blendet SrcGfx mit 0.0f - 1.0f Alpha Wert #define BLIT_VD (1<<7) // Flag für Versatz und Clipping zum Virtuellen Display #define BLIT_SRC_CENTERED (1<<8) // um den Mittelpunkt der Sourcegrafik versetzt. #define BLIT_DST_CENTERED (1<<9) // SrcGfx wird genau in die Mitte der DstGrafik gesetzt. X/Y ist zusätzlicher Versatz #define BLIT_SRC_COLORKEY (1<<10) // SRC Colorkey flag für drv_blit_BLITFast() #define BLIT_MIRROR_X (1<<11) // flag für blitstretch ( negativ scale ergibt spiegeld) #define BLIT_MIRROR_Y (1<<11) // flag für blitstretch ( negativ scale ergibt spiegeld) #define BLIT_SCANLINES (1<<12) // jede 2te zeile wird ausgelassen #define BLIT_FXADD (1<<13) // Addiert SrcGfx multipliziert mit Alphawert 0.0f - 1.0f #define BLIT_FXSUB (1<<14) // Subtrahiert SrcGfx multipliziert mit Alphawert 0.0f - 1.0f #define BLIT_FXMUL (1<<16) // Multipliziert SrcGfx multipliziert mit Alphawert 0.0f - 1.0f #define BLIT_FXINVMUL (1<<17) // Multipliziert Inv SrcGfx multipliziert mit Alphawert 0.0f - 1.0f #define BLIT_FXCOLOR (1<<18) // Color Overlay mit Alphawert 0.0f - 1.0f #define BLIT_FXDIFF (1<<19) // Difference Src/Dst, Ergebnis multipliziert mit Alphawert 0.0f - 1.0f #define BLIT_FXDARKEN (1<<20) // Min von Src und Dst multipliziert mit Alphawret 0.0f - 1.0f #define BLIT_FXLIGHTEN (1<<21) // Max von Src und Dst multipliziert mit Alphawret 0.0f - 1.0f #define BLIT_SPRITE (1<<22) // Blittet RandPixel mit BlendFunktion typedef struct { float angle; // 0-360 degrees float scale_x; // 0.0f - x.f ( 1.0f = 1:1 copy ) float scale_y; // 0.0f - x.f ( 1.0f = 1:1 copy ) float fixalpha; // 0.0f(transparent) - 1.0f(opaque) float sine; // rotation sin value by angle float cosine; // rotation cosine value by angle TxU32 color; // Farbwert } llgfx_sBLITFX; typedef struct { void *gfxObjDst; void *gfxObjSrc; int x, y; // target x,y koords (topleft) s_rect src_rect; int blitflags; llgfx_sBLITFX blitfx; bool clipped; // true if clipped s_rect *cliprect; // cliprect s_rect dstrect; // dst clipped s_rect dstrect_uc; // dst unclipped s_rect srcrect; // src clipped s_rect srcrect_uc; // src unclipped } s_blitter; //:> +------------------------------------+ //:>-------------------| Global Function Declarations |------------------- //:> +------------------------------------+ int llgfx_BLIT(llgfx_id dest, // Destinantion GFX llgfx_id src, // Source GFX int x=0, // Dest POS int y=0, // * llgfx_sRECT *rect=0, // Sourcerect(Srcgfx), 0 = ganze Src-grafik int blitflags=0, // Copy,stippeld,srcalpha,fixalpha llgfx_sBLITFX *blitfx=0 // FixAlpha,Scale,etc ); int llgfx_BLIT_DIRTY( llgfx_id destgfx, llgfx_id u_gfxnum); int llgfx_VD_BLIT_DIRTY(llgfx_id srcgfx); inline int llgfx_VD_BLIT(llgfx_id srcgfx, int x=0, int y=0, llgfx_sRECT *srcrect=0, int blitflags=0, llgfx_sBLITFX *blitfx=0) { return llgfx_BLIT(0,srcgfx,x,y,srcrect,blitflags|BLIT_VD,blitfx); } inline int llgfx_VD_BLIT(llgfx_id dstgfx, llgfx_id srcgfx, int x=0, int y=0, llgfx_sRECT *srcrect=0, int blitflags=0, llgfx_sBLITFX *blitfx=0) { return llgfx_BLIT(dstgfx,srcgfx,x,y,srcrect,blitflags|BLIT_VD,blitfx); } int llgfx_BLITFast( llgfx_id dest, // Zielgrafik llgfx_id src, int x=0, // xposition in der Zielgrafik int y=0); int llgfx_BLITFast( llgfx_id dest, // Zielgrafik llgfx_id src, int x, // xposition in der Zielgrafik int y, // yposition in der Zielgrafik llgfx_sRECT *rect=0 // source rect ); // +---------------------+ // | llgfx_TILE_BLIT() | // +---------------------+ int llgfx_TILE_BLIT( llgfx_id dstgfx, llgfx_id srcgfx, int start_offsetx=0, int start_offsety=0, llgfx_sRECT *srect=0, int blitflags=0, llgfx_sBLITFX *blitfx=0); //::22 // +----------------------+ // | llgfx_SCALE_BLIT() | // +----------------------+ int llgfx_SCALE_BLIT( llgfx_id dstgfx, llgfx_id srcgfx); /* * Erstellt eine rotierte Grafik vom srcgfx. * Wenn srect==NULL, dann wird die ganze Grafik routiert, * Wenn srect = (int)frame_number oder llgfx_sRECT* dann wird nur ein Teil rotiert * Die zurückgeliefert Grafik ist immer ein wenig grösser als die Srcgrafik. * Nach Gebrauch mit llgfx_ReleaseGFX freigeben. * x_zoom und y_zoom können während dem rotieren noch strecken */ llgfx_id llgfx_ROTATE_BLIT( llgfx_id src, llgfx_sRECT * rect, float angle, float x_zoom = 1.0f, float y_zoom = 1.0f ); #endif // LLGFX_BLIT_INCLUDED