Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

[MBS] Check if ImmutableBitmap has alpha channel (MBS Xojo Plugin Mailinglist archive)

Back to the thread list
Previous thread: [MBS] [ANN] 18.2pr3
Next thread: [MBS] [ANN] MonkeyBread Software Releases IP in menubar 4.6


[MBS] MBS 7.5 with RB2010r4.1   -   Garth Hjelte
  [MBS] Check if ImmutableBitmap has alpha channel   -   Michael Diehr
   [MBS] Improvements for new Picture object types   -   Michael Diehr

[MBS] Check if ImmutableBitmap has alpha channel
Date: 17.04.18 16:17 (Tue, 17 Apr 2018 08:17:58 -0700)
From: Michael Diehr
With Supports HiDPI ON, Xojo loads pictures as ImmutableBitmaps, which always claim hasAlphaChannel=True regardless of the source file.

See here: https://forum.xojo.com/47184-picture-fromdata-gives-immutablebitmap-with-hasalphachannel-tru/last

Apparently this is stored internally as an NSImage, and once it's an NSImage there is no way to tell if the original file did or did not have alpha.

A brute-force workaround: get the copy of the mask, and see if all the pixels are zero.

Is there a fast way to do that in MBS?

Looks like PictureMBS.CompareImages might work, although I'd rather have a function that was fast and exited upon finding the first different pixel.

Ideas?
_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
<email address removed>
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info