#ifndef DDUTIL_H #define DDUTIL_H #include class gxGraphics; typedef IDirectDrawSurface7 ddSurf; struct ddUtil{ static void buildMipMaps( ddSurf *surf ); static void copy( ddSurf *dest,int dx,int dy,int dw,int dh,ddSurf *src,int sx,int sy,int sw,int sh ); static ddSurf *loadSurface( const std::string &f,int flags,gxGraphics *gfx ); static ddSurf *createSurface( int width,int height,int flags,gxGraphics *gfx ); }; class PixelFormat{ int depth,pitch; unsigned amask,rmask,gmask,bmask,argbfill; unsigned char ashr,ashl,rshr,rshl,gshr,gshl,bshr,bshl; typedef void (_fastcall *Plot)(void *pix,unsigned argb); typedef unsigned (_fastcall *Point)(void *pix); Plot plot; Point point; char *plot_code,*point_code; public: PixelFormat():plot_code(0){ } PixelFormat( const DDPIXELFORMAT &pf ):plot_code(0){ setFormat( pf ); } ~PixelFormat(); void setFormat( const DDPIXELFORMAT &pf ); int getDepth()const{ return depth; } int getPitch()const{ return pitch; } unsigned fromARGB( unsigned n )const{ return ( (n>>ashr<>rshr<>gshr<>bshr<>ashl<>rshl<>gshl<>bshl<