Wana use blitting to copy a texture (source) to the screen (destination).
Got a class (Crect) which has functionality to clip texture.
The aim being to show the texture moving about screen and to show it partially off the screen.

blitting function
Code:
void BlitFn ( BYTE *destination, int destWidth, BYTE *source, int sourceWidth, const CRect &sourceRect, int posX, int posY )
{
int sourceHeight;
BYTE alpha;
BYTE *destPnter = destination + ( posX+posY*destWidth)*4;
BYTE *sourcePnter = source;
		 
int EndOfLineDestIncrement = ( destWidth - sourceWidth )*4;
		 
for ( int posY = 0; posY < sourceHeight; posY++ )
  {
       for ( posX = 0; posX < sourceWidth; posX++ )
           {
	 if ( alpha = 255 )
	   {
	          memcpy ( destPnter, sourcePnter, 4 );
	    }
					
	 else
	    {
	          BYTE blue = sourcePnter [0];
	          BYTE green = sourcePnter [1];
                          BYTE red = sourcePnter [2];
	          BYTE alpha = sourcePnter [3];
							         destPnter[0] = destPnter[0] + ( (alpha*(blue-destPnter[0])) >> 8);
	         destPnter[1] = destPnter[1] + ( (alpha*(green-destPnter[1])) >> 8);
	          destPnter[2] = destPnter[2] + ( (alpha*(red-destPnter[2])) >> 8);
	  }
           }

            sourcePnter += 4;
            destPnter += 4;
		 
      }

         destPnter = EndOfLineDestIncrement;
}

PROBLEMS:

[1] in the final line of code: 'cant convert type 'int' from type 'BYTE *'
[2] Anybody got any good sites for downloading FREE spaceship textures that could be used for 2D vertical shooter games?