unit Dogwaffle; interface uses GR32; procedure GetDogwaffleInBitmap32(Bitmap32: TBitmap32); procedure SendBitmap32ToDogwaffleMainBuffer(Bitmap32: TBitmap32); procedure SendBitmap32ToDogwaffleSwapBuffer(Bitmap32: TBitmap32); procedure SendBitmap32ToDogwaffleCustomBrush(Bitmap32: TBitmap32); implementation uses Variants, DibUtils, Graphics, GTypes, ComObj; var DogwaffleConex: Variant; RedChannel, GreenChannel, BlueChannel: OleVariant; DogWidth, DogHeight: Integer; procedure GetDogwaffleInBitmap32(Bitmap32: TBitmap32); var pRed, pGreen, pBlue: pByte; w,h: Integer; Bitmap: TBitmap; begin try DogwaffleConex := CreateOleObject('Dogwaffle.Dogwaffle_Class'); RedChannel := DogwaffleConex.Dog_GetRBuffer; GreenChannel := DogwaffleConex.Dog_GetGBuffer; BlueChannel := DogwaffleConex.Dog_GetBBuffer; DogWidth := DogwaffleConex.Dog_BufferWidth; DogHeight := DogwaffleConex.Dog_BufferHeight; pRed := VarArrayLock(RedChannel); pGreen := VarArrayLock(GreenChannel); pBlue := VarArrayLock(BlueChannel); Bitmap := RawToTBitmap24(pRed, pGreen, pBlue, DogWidth, DogHeight); Bitmap32.Assign(Bitmap); finally Bitmap.Free; VarArrayUnlock(BlueChannel); VarArrayUnlock(GreenChannel); VarArrayUnlock(RedChannel); end; end; procedure SendBitmap32ToDogwaffleMainBuffer(Bitmap32: TBitmap32); var pRed, pGreen, pBlue: pByte; w,h: Integer; NewBitmap32: TBitmap32; begin try RedChannel := DogwaffleConex.Dog_GetRBuffer; GreenChannel := DogwaffleConex.Dog_GetGBuffer; BlueChannel := DogwaffleConex.Dog_GetBBuffer; NewBitmap32 := Bitmap32; if (Bitmap32.Width <> DogWidth) or (Bitmap32.Height <> DogHeight) then NewBitmap32 := CreateBitmap32Resized(Bitmap32, DogWidth, DogHeight); pRed := VarArrayLock( RedChannel ); pGreen := VarArrayLock( GreenChannel ); pBlue := VarArrayLock( BlueChannel ); Bitmap32ToRaw( pRed, pGreen, pBlue, NewBitmap32 ) finally if NewBitmap32 <> Bitmap32 then NewBitmap32.Free; VarArrayUnlock( BlueChannel ); VarArrayUnlock( GreenChannel ); VarArrayUnlock( RedChannel ); end; DogwaffleConex.Dog_SetRbuffer( RedChannel ); DogwaffleConex.Dog_SetGbuffer( GreenChannel ); DogwaffleConex.Dog_SetBbuffer( BlueChannel ); DogwaffleConex.Dog_Refresh; end; procedure SendBitmap32ToDogwaffleSwapBuffer(Bitmap32: TBitmap32); var pRed, pGreen, pBlue: pByte; w,h: Integer; NewBitmap32: TBitmap32; begin try NewBitmap32 := Bitmap32; RedChannel := DogwaffleConex.Dog_GetRBuffer; GreenChannel := DogwaffleConex.Dog_GetGBuffer; BlueChannel := DogwaffleConex.Dog_GetBBuffer; if (Bitmap32.Width <> DogWidth) or (Bitmap32.Height <> DogHeight) then NewBitmap32 := CreateBitmap32Resized(Bitmap32, DogWidth, DogHeight); pRed := VarArrayLock( RedChannel ); pGreen := VarArrayLock( GreenChannel ); pBlue := VarArrayLock( BlueChannel ); Bitmap32ToRaw( pRed, pGreen, pBlue, NewBitmap32 ) finally if NewBitmap32 <> Bitmap32 then NewBitmap32.Free; VarArrayUnlock( BlueChannel ); VarArrayUnlock( GreenChannel ); VarArrayUnlock( RedChannel ); end; DogwaffleConex.Dog_SetSwapRbuffer( RedChannel ); DogwaffleConex.Dog_SetSwapGbuffer( GreenChannel ); DogwaffleConex.Dog_SetSwapBbuffer( BlueChannel ); DogwaffleConex.Dog_Refresh; end; procedure SendBitmap32ToDogwaffleCustomBrush(Bitmap32: TBitmap32); //var // pRed, pGreen, pBlue: pByte; // w,h: Integer; // NewBitmap32: TBitmap32; begin // try // NewBitmap32 := Bitmap32; // RedChannel := DogwaffleConex.Dog_GetRBuffer; // GreenChannel := DogwaffleConex.Dog_GetGBuffer; // BlueChannel := DogwaffleConex.Dog_GetBBuffer; // if (Bitmap32.Width <> DogWidth) or (Bitmap32.Height <> DogHeight) then // NewBitmap32 := CreateBitmap32Resized(Bitmap32, DogWidth, DogHeight); // pRed := VarArrayLock( RedChannel ); // pGreen := VarArrayLock( GreenChannel ); // pBlue := VarArrayLock( BlueChannel ); // Bitmap32ToRaw( pRed, pGreen, pBlue, NewBitmap32 ) // finally // if NewBitmap32 <> Bitmap32 then NewBitmap32.Free; // VarArrayUnlock( BlueChannel ); // VarArrayUnlock( GreenChannel ); // VarArrayUnlock( RedChannel ); // end; // DogwaffleConex.Dog_SetSwapRbuffer( RedChannel ); // DogwaffleConex.Dog_SetSwapGbuffer( GreenChannel ); // DogwaffleConex.Dog_SetSwapBbuffer( BlueChannel ); // DogwaffleConex.Dog_Refresh; end; initialization finalization end.