-
Notifications
You must be signed in to change notification settings - Fork 60
Open
Description
In my version of 1.4.1 I have replaced the loading of images using fpgImages.AddMaskedBMP so that the images are saved as resources rather than hard coded as include files. This also means I can use PNG files as well as BMP ones.
My main reason for this was that I couldn't work out how to implement High DPI (issue #59) and ended up scaling my forms manually, so when I load the image I resample it to the size I want. But it might be useful in general as creating and maintaining the include files is a bit inconvenient. My code is:
procedure FPGAddMask(ResName:string; MaskId:string; siz:integer);
var ResPng : TBGRABitmap;
WrkStream : TMemoryStream;
begin
ResPng:=TBGRABitmap.Create;
ResPng.LoadFromResource(ResName);
BGRAReplace(ResPng, ResPng.Resample(siz, siz, rmFineResample));
WrkStream:=TMemoryStream.Create;
ResPng.SaveToStreamAs(WrkStream, ifBmp); // force conversion to BMP
ResPng.Free;
fpgImages.AddMaskedBMP(
MaskId,
WrkStream.Memory,
WrkStream.Size, 0,0);
WrkStream.Free;
end;
So then I have code like:
NewSiz:=round(scale * 16);
FPGAddMask('FPG_ROTATE','myimg.rotate',NewSiz);
But it uses BGRAbitmap so maybe you won't want to add it as a standard option.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels