X-Git-Url: https://deadsoftware.ru/gitweb?p=d2df-editor.git;a=blobdiff_plain;f=src%2Feditor%2Ff_addresource_texture.pas;h=86566cfa9627df9eeab1238aed7ad118dd19bc41;hp=0ab28a5586e623ebc0580fdfca4cff372e36e060;hb=797ba76501e5360f4d02d6aade613dc529a24213;hpb=a00a3d61ed426b67fed0fce818471fb84c462aac diff --git a/src/editor/f_addresource_texture.pas b/src/editor/f_addresource_texture.pas index 0ab28a5..86566cf 100644 --- a/src/editor/f_addresource_texture.pas +++ b/src/editor/f_addresource_texture.pas @@ -241,7 +241,7 @@ function CreateBitMap(Data: Pointer; DataSize: Cardinal): TBitMap; var img: TImageData; clr: TColor32Rec; - bgc: Byte; + bgc: TColor32Rec; ii: PByte; Width, Height: Integer; @@ -274,13 +274,22 @@ begin // HACK: Lazarus's TBitMap doesn't seem to have a working 32 bit mode, so // mix color with checkered background. Also, can't really read // CHECKERS.tga from here. FUCK! - if (((x shr 3) and 1) = 0) xor (((y shr 3) and 1) = 0) then - bgc := 255 + if UseCheckerboard then + begin + if (((x shr 3) and 1) = 0) xor (((y shr 3) and 1) = 0) then + bgc.Color := $FDFDFD + else + bgc.Color := $CBCBCB; + end else - bgc := 200; - clr.r := ClampToByte((Byte(255 - clr.a) * bgc + clr.a * clr.r) div 255); - clr.g := ClampToByte((Byte(255 - clr.a) * bgc + clr.a * clr.g) div 255); - clr.b := ClampToByte((Byte(255 - clr.a) * bgc + clr.a * clr.b) div 255); + begin + bgc.r := GetRValue(PreviewColor); + bgc.g := GetGValue(PreviewColor); + bgc.b := GetBValue(PreviewColor); + end; + clr.r := ClampToByte((Byte(255 - clr.a) * bgc.r + clr.a * clr.r) div 255); + clr.g := ClampToByte((Byte(255 - clr.a) * bgc.g + clr.a * clr.g) div 255); + clr.b := ClampToByte((Byte(255 - clr.a) * bgc.b + clr.a * clr.b) div 255); // TODO: check for RGB/BGR somehow? ii^ := clr.b; Inc(ii); ii^ := clr.g; Inc(ii);