[Closed] pasteBitmap maskColor broken?
Either that or I don’t know what I’m doing wrong.
Even in this example from the help file it doesn’t seem to be working:
bm1=bitmap 100 100 color:red
bm2=bitmap 100 100 color:green
bm3=bitmap 100 100 color:blue
pasteBitmap bm2 bm1 (box2 0 0 25 50) [50,50]
display bm1
pasteBitmap bm1 bm3 [25,25] [25,50] maskColor:green
display bm3
Has anyone ever used it successfully?
Using max2009/64
thanks
fn compfn c1 p1 c2 p2 =
(
local maskColor = green
if c1 == maskColor then c2 else c1
)
pasteBitmap greenGrid newBg [25,25] [25,50] type:#function function:compfn
thanks for the workaround, Insanto, but unfortunately this is for 2009 so the #function type doesn’t exist yet. :shrug:
the pasteBitmap method is available from max 2008, but the ability to use a custom function as a blending algorithm has only been introduced in max 2010. I have tried it in max 2009, and it ignores the #function parameter and uses #paste instead.
I’ve run into the problems also with pastebitmap (when trying to make a script more compatible with other versions of max.) The documentation does lead you to believe pastebitmap (in its entirety) is available starting in 2008, but #function is only 2010 and up.
You could look into dotNet: convert your bitmap to dotNet, do some image adjustments, then convert it back for Max to display.
hmm, in that case your only choice is to use the getPixels and setPixels functions wich will be a lot slower