Notifications
Clear all
[Closed] Read alpha channel from bitmap
Page 2 / 2
Prev
Aug 28, 2014 8:12 am
This is actually super fast.
Can you explain these lines?
pastebitmap img img2 [0,0] [0,0] type:#blend
pastebitmap img img2 [0,0] [0,0] type:#blend
return not (comparebitmaps img img2 0 0)
Thank you very much.
Aug 28, 2014 8:12 am
Actually the function is wrong but it appears to return accurate results.
A better function could be the following:
fn GetBitmapHasAlphaBlackPixel img =
(
if img.hasalpha do
(
-- Create a new bitmap
img2 = bitmap img.width img.height
-- Blend the source Bitmap with the new Bitmap
pastebitmap img img2 [0,0] [0,0] type:#blend
-- Compare the two Bitmaps
areequal = comparebitmaps img img2 0 1
return not areequal
)
return false
)
Aug 28, 2014 8:12 am
PolyTools, after some testing I’ve noticed that it always return true. Both with white alpha or black and white alphas. Or maybe I just haven’t understood the function but
img = $.material.diffuseMap.bitmap
fn GetBitmapHasAlphaBlackPixel img = (
if img.hasalpha do
(
img2 = bitmap img.width img.height
pastebitmap img img2 [0,0] [0,0] type:#blend
equal = comparebitmaps img img2 0 0
return not equal
)
return false
)
GetBitmapHasAlphaBlackPixel img
returns always true.
1 Reply
Page 2 / 2
Prev