mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
FIX: support app icons on macOS 26.1 #2519
NSBMPFileType to NSPNGFileType
(cherry picked from commit 9200ae0a7c)
This commit is contained in:
parent
c97770d6f4
commit
78ba4aef4b
1 changed files with 7 additions and 4 deletions
|
|
@ -1152,21 +1152,24 @@ function NSImageToTBitmap( const image:NSImage ): TBitmap;
|
|||
var
|
||||
nsbitmap: NSBitmapImageRep;
|
||||
tempData: NSData;
|
||||
tempStream: TBlobStream;
|
||||
tempStream: TBlobStream = nil;
|
||||
tempBitmap: TPortableNetworkGraphic = nil;
|
||||
bitmap: TBitmap;
|
||||
begin
|
||||
Result:= nil;
|
||||
if image=nil then exit;
|
||||
|
||||
tempStream:= nil;
|
||||
try
|
||||
nsbitmap:= NSBitmapImageRep.imageRepWithData( image.TIFFRepresentation );
|
||||
tempData:= nsbitmap.representationUsingType_properties( NSBMPFileType, nil );
|
||||
tempData:= nsbitmap.representationUsingType_properties( NSPNGFileType, nil );
|
||||
tempStream:= TBlobStream.Create( tempData.Bytes, tempData.Length );
|
||||
tempBitmap:= TPortableNetworkGraphic.Create;
|
||||
tempBitmap.LoadFromStream( tempStream );
|
||||
bitmap:= TBitmap.Create;
|
||||
bitmap.LoadFromStream( tempStream );
|
||||
bitmap.Assign( tempBitmap );
|
||||
Result:= bitmap;
|
||||
finally
|
||||
FreeAndNil(tempBitmap);
|
||||
FreeAndNil(tempStream);
|
||||
end;
|
||||
end;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue