latch Active Member Licensed User Longtime User Oct 26, 2013 #1 So you can see from my games, I use a buttload of bitmaps: http://www.b4x.com/android/forum/threads/sup-r-m-troid-wannabe.31185/ I use 90ish bitmaps to animate the dude. One day I will add in the story another exosuit the dude gets and it will be a different color. Is there a way to alter the palette of a loaded bitmap? Slightly related, is there way to alter the alpha? I guess I should add I am using the Accelerated Surface de Informatix
So you can see from my games, I use a buttload of bitmaps: http://www.b4x.com/android/forum/threads/sup-r-m-troid-wannabe.31185/ I use 90ish bitmaps to animate the dude. One day I will add in the story another exosuit the dude gets and it will be a different color. Is there a way to alter the palette of a loaded bitmap? Slightly related, is there way to alter the alpha? I guess I should add I am using the Accelerated Surface de Informatix
Informatix Expert Licensed User Longtime User Oct 26, 2013 #2 AlterColors from the ImageUtils class is not useful? You can also give a try to the ABExtDrawing lib. Upvote 0
AlterColors from the ImageUtils class is not useful? You can also give a try to the ABExtDrawing lib.
latch Active Member Licensed User Longtime User Oct 26, 2013 #3 I don't know, but I will check them out. Thank you sir! Upvote 0
latch Active Member Licensed User Longtime User Oct 27, 2013 #4 It looks like AlterColors will work but I don't know how to implement it. I need to be able to draw the altered bitmap in the accelerated surface. Of course, I'm drawing a lot of rocks and so I would want to alter the colors somewhere else and then draw it ten hundred times. I'm getting the immutable error: Code: Copy sub begin stone.InitializeMutable(128,128) stone = LoadBitmap(File.DirAssets, "images/stoneshadow.png") end sub sub surfacedraw ac.DrawBitmapWithMatrixAt(IU.AlterColors(stone,-1,355,1),(c*128-mx)*scale, (l*128-my)*scale, True) end sub Upvote 0
It looks like AlterColors will work but I don't know how to implement it. I need to be able to draw the altered bitmap in the accelerated surface. Of course, I'm drawing a lot of rocks and so I would want to alter the colors somewhere else and then draw it ten hundred times. I'm getting the immutable error: Code: Copy sub begin stone.InitializeMutable(128,128) stone = LoadBitmap(File.DirAssets, "images/stoneshadow.png") end sub sub surfacedraw ac.DrawBitmapWithMatrixAt(IU.AlterColors(stone,-1,355,1),(c*128-mx)*scale, (l*128-my)*scale, True) end sub
Informatix Expert Licensed User Longtime User Oct 27, 2013 #5 Use IU.MakeMutable to get rid of the error. Upvote 0
latch Active Member Licensed User Longtime User Oct 27, 2013 #6 I had not updated my AC library so it didn't work till I did. I see you got rid of drawrectrotated. What did you replace that with as I was using it extensively and it broke my sparks! Upvote 0
I had not updated my AC library so it didn't work till I did. I see you got rid of drawrectrotated. What did you replace that with as I was using it extensively and it broke my sparks!
latch Active Member Licensed User Longtime User Oct 27, 2013 #7 I found it- it's a roundabout way: In this example of rotation, only the rectangle is rotated: Code: Copy AC.SaveState AC.RotateCanvas(45) AC.DrawRect(rctRect, Colors.Red, True, 0, True) AC.RestoreState AC.DrawOval(rctOval, Colors.Blue, True, 0, True) Upvote 0
I found it- it's a roundabout way: In this example of rotation, only the rectangle is rotated: Code: Copy AC.SaveState AC.RotateCanvas(45) AC.DrawRect(rctRect, Colors.Red, True, 0, True) AC.RestoreState AC.DrawOval(rctOval, Colors.Blue, True, 0, True)
Informatix Expert Licensed User Longtime User Oct 28, 2013 #8 latch said: I found it- it's a roundabout way: In this example of rotation, only the rectangle is rotated: Code: Copy AC.SaveState AC.RotateCanvas(45) AC.DrawRect(rctRect, Colors.Red, True, 0, True) AC.RestoreState AC.DrawOval(rctOval, Colors.Blue, True, 0, True) Click to expand... Yes, it's the new way of rotating things. It's more efficient because you can group the objects to rotate. Upvote 0
latch said: I found it- it's a roundabout way: In this example of rotation, only the rectangle is rotated: Code: Copy AC.SaveState AC.RotateCanvas(45) AC.DrawRect(rctRect, Colors.Red, True, 0, True) AC.RestoreState AC.DrawOval(rctOval, Colors.Blue, True, 0, True) Click to expand... Yes, it's the new way of rotating things. It's more efficient because you can group the objects to rotate.