I have tried quite a few things to solve his.
I have some bitmaps stoed in my imagelist ilPublicPM (images 16wx16h) that I want to copy to ilPublicTV (images 16wx18h)
When ilPublicPM is used o render images (e.g. a toolbar or menu), the bitmap have (corectly) the background color of the toolbar/menu.
The problem is this... The copied over bitmaps get black background no matter what.
helper function:
function myCreateBitmap(AWidth, AHeight: Integer; ABGColor: TColor; APixelFormat: TPixelFormat): TBitMap;
var
BitMap: TBitMap;
begin
BitMap := TBitMap.Create;
with BitMap do
begin
if APixelFormat <> pfCustom then
PixelFormat := APixelFormat
;
Width := AWidth;
Height := AHeight;
Canvas.Brush.Style := bsSolid;
Canvas.Brush.Color := ABGColor;
Canvas.FillRect(Rect(0, 0, Width, Height));
end
;
Result := BitMap;
end;
Code not working:
var
C: TColor;
// ilPublicPM.DrawingStyle := dsTransparent; // no difference
TmpColor = clWindow;
// TmpColor = clNone; // no difference
//--
B1 := msCreateBitmap(16, 16, TmpColor, pf32bit);
B2 := msCreateBitmap(16, 18, TmpColor, pf32bit);
E := ilPublicPM.Count - 1;
for I := 0 to E do
begin
ilPublicPM.GetBitmap(I, B1);
R := True;
//--
if R then
begin
for BX := 0 to 15 do
begin
for BY := 0 to 15 do
begin
C := B1.Canvas.Pixels[BX, BY];
B2.Canvas.Pixels[BX, BY + 1] := C;
end;
end;
//--
ilPublicTV.Add(B2, nil)
end;
end;