- No, I don't think so, a PNG icon size is ~1kB
I added all the sizes that you mentioned in your first post to the resource-builder utlity that you posted here and created a res file: with these 13 images it is larger by 36 kB than the original version with 3 images. Having 1000+ images in Lazarus this means a size increase of the binary by about 30-40 MB. The size of an original Lazarus.exe, however, already is about this size, too - so: size increase by about 100%. Yes, I would call this a "tremendous increase" for a feature which most users will not need.
@WP:
Intermediate images can be interpolated from these sizes.
- Unfortunately there is no interpolation! just 100%, 150% and 200%..... so, for the scale of 125%, Lazarus will use the base icon (100%)... for 175%, Lazarus will ignore the right icon and will use 150%...for any scale above 200%, Lazarus will use 200% only
I don't know why Ondrej did not provide such a wide-reaching handler for the OnGetWidthForPPI event, but please try it yourself: Open the file IDEImagesIntf.pas from folder "components/ideintf" of the Lazarus installation, find the implementation of procedure FImages_24_GetWidthForPPI and replace the code as follows:
procedure TIDEImages.FImages_24_GetWidthForPPI(Sender: TCustomImageList;
AImageWidth, APPI: Integer; var AResultWidth: Integer);
begin
AResultWidth := AImageWidth * APPI div 96;
end;
Then find the implementations of the functions TIDEImages.GetImages_12, .GetImages_16 and .GetImage_24 and assign the FImages_24_GetWidthForPPI to their OnGetWidthForPPI event. This tells these imagelists how they should interpolate to not registered sizes.
function TIDEImages.GetImages_12: TLCLGlyphs;
begin
if FImages_12 = nil then
begin
FImages_12 := TLCLGlyphs.Create(nil);
FImages_12.Width := 12;
FImages_12.Height := FImages_12.Width;
FImages_12.RegisterResolutions([12, 16, 24]);
FImages_12.OnGetWidthForPPI := @FImages_24_GetWidthForPPI;
end;
Result := FImages_12;
end;
function TIDEImages.GetImages_16: TLCLGlyphs;
begin
if FImages_16 = nil then
begin
FImages_16 := TLCLGlyphs.Create(nil);
FImages_16.Width := 16;
FImages_16.Height := FImages_16.Width;
FImages_16.RegisterResolutions([16, 24, 32]);
FImages_16.OnGetWidthForPPI := @FImages_24_GetWidthForPPI;
end;
Result := FImages_16;
end;
function TIDEImages.GetImages_24: TLCLGlyphs;
begin
if FImages_24 = nil then
begin
FImages_24 := TLCLGlyphs.Create(nil);
FImages_24.Width := 24;
FImages_24.Height := FImages_24.Width;
FImages_24.RegisterResolutions([24, 36, 48]);
FImages_24.OnGetWidthForPPI := @FImages_24_GetWidthForPPI;
end;
Result := FImages_24;
end;
The attached screenshots of the relevant IDE parts at 96 (100%), 120ppi (125%), 144ppi (150%), 168ppi (175%), and 192ppi (200%) demonstrates that now both toolbar icons (default size 16x16) and palette icons(default size 24x24) are scaled (12x12 icons are not shown on these screenshots). If you look carefully, however, you'll notice that the 125% and 175% images are not as crisp as the 100%, 150% and 200% icons. Maybe this is the reason why this feature is not activated by default? We should think about adding a configuration setting for it. What do you think, Martin?