From e52bf638d25b4f74589633b09748cafa5e517f30 Mon Sep 17 00:00:00 2001 From: sekelsenmat Date: Thu, 23 Sep 2010 07:31:28 +0000 Subject: [PATCH] Corrects transparency in fpchess git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1325 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- applications/fpchess/chessdrawer.pas | 9 ++- applications/fpchess/chessgame.pas | 2 +- applications/fpchess/fpchess.lpi | 88 ++++++++++++---------------- 3 files changed, 45 insertions(+), 54 deletions(-) diff --git a/applications/fpchess/chessdrawer.pas b/applications/fpchess/chessdrawer.pas index 9e168f609..4da457dd2 100644 --- a/applications/fpchess/chessdrawer.pas +++ b/applications/fpchess/chessdrawer.pas @@ -137,9 +137,10 @@ procedure TChessDrawer.DrawImageWithTransparentColor(ADest: TLazIntfImage; const ADestX, ADestY: Integer; AColor: TFPColor; AImage: TFPImageBitmap); var x, y, CurX, CurY: Integer; - CurColor: TFPColor; IntfImage: TLazIntfImage; lDrawWidth, lDrawHeight: Integer; + CurColor: TFPColor; + lCurColorDiv, lTranspColorDiv: Byte; begin IntfImage := TLazIntfImage.Create(0,0); try @@ -158,8 +159,10 @@ begin // Never draw outside the destination if (CurX < 0) or (CurY < 0) then Continue; - // CurColor := IntfImage.Colors[x, y]; // Just for debugging - if IntfImage.Colors[x, y].Green <> AColor.Green then + CurColor := IntfImage.Colors[x, y]; // Good for debugging + lCurColorDiv := CurColor.Green div $FF; + lTranspColorDiv := AColor.Green div $FF; + if lCurColorDiv <> lTranspColorDiv then ADest.Colors[CurX, CurY] := IntfImage.Colors[x, y]; end; end; diff --git a/applications/fpchess/chessgame.pas b/applications/fpchess/chessgame.pas index 03eed0fa6..841ce54a2 100644 --- a/applications/fpchess/chessgame.pas +++ b/applications/fpchess/chessgame.pas @@ -20,7 +20,7 @@ const INT_CHESSTILE_SIZE = 40; INT_CHESSBOARD_SIZE = 40 * 8; - FPCOLOR_TRANSPARENT_TILE: TFPColor = (Red: $0000; Green: $8000; Blue: $8000; Alpha: alphaOpaque); //colTeal + FPCOLOR_TRANSPARENT_TILE: TFPColor = (Red: $0000; Green: $8100; Blue: $8100; Alpha: alphaOpaque); //+/-colTeal type diff --git a/applications/fpchess/fpchess.lpi b/applications/fpchess/fpchess.lpi index fd5a64be4..cf3c18874 100644 --- a/applications/fpchess/fpchess.lpi +++ b/applications/fpchess/fpchess.lpi @@ -31,7 +31,7 @@ - + @@ -161,11 +161,10 @@ - - - + + @@ -220,10 +219,11 @@ + - - + + @@ -241,32 +241,26 @@ - - - - - - @@ -283,8 +277,18 @@ + + + + + + + + + + - + @@ -334,77 +338,61 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - -