images.loader.gdiplus: Allow writing .bmp and do a better lookup.

flac
Doug Coleman 2020-03-06 19:34:41 -06:00 committed by Steve Ayerhart
parent d862f6c65b
commit 60d6f6a572
No known key found for this signature in database
GPG Key ID: 5BFD39C5359E967D
1 changed files with 2 additions and 3 deletions

View File

@ -64,7 +64,7 @@ os windows? [
ERROR: unsupported-pixel-format component-order ;
: check-pixel-format ( component-order -- )
dup { BGRX BGRA } member? [ drop ] [ unsupported-pixel-format ] if ;
dup { BGRX BGRA RGBA } member? [ drop ] [ unsupported-pixel-format ] if ;
: image>gdi+-bitmap ( image -- bitmap )
dup component-order>> check-pixel-format
@ -84,8 +84,7 @@ ERROR: unsupported-pixel-format component-order ;
nip swap ImageCodecInfo <c-direct-array> ;
: extension>mime-type ( extension -- mime-type )
! Crashes if you let this mime through on my machine.
dup mime-types at dup "image/bmp" = [ unknown-image-extension ] when nip ;
mime-types ?at [ unknown-image-extension ] unless ;
: mime-type>clsid ( mime-type -- clsid )
image-encoders [ MimeType>> alien>native-string = ] with find nip Clsid>> ;