Dimage - image with argb data

Monkey Programming Forums/User Modules/Dimage - image with argb data

chrisc2977(Posted 2017) [#1]
Dimage is a module that adds some additional functionality to images. Its main feature is being able to access an images argb values and change them.
It should work for Html, Desktop(glfw), ios and android

I got fed up with having to use drawimage / readpixel to return the rgb values of an image. Also it did not work well with alpha.
Hence my Dimage module.

Basic Use (sudo code):
format_code('Import dimage
Global MyImage:Dimage
MyImage = LoadDimage("myimage.png") 'Has to be in OnCreate()
Local argb:Int[] = MyImage.GetArgb() 'Has to be in either OnRender() or OnUpdate()')

Please see the link below fore more details and download
http://www.code33.co.uk/monkey-modules/dimage/

Would like to hear thoughts :)


Gerry Quinn(Posted 2017) [#2]
Looks like a nice quality of life addition for those who like to manipulate images!

Just one question - it says on Method New(path:String) that it must be used in OnCreate(). But I don't see any major code there other than LoadImage(). LoadImage() can cause a slight delay, but it works anytime as far as I know.


chrisc2977(Posted 2017) [#3]
Thanks for the feedback!
If it works, go for it :)
I found that my html5 code needed the image to be loaded before it could access the image data.


Gerry Quinn(Posted 2017) [#4]
Well, obviously the image must be loaded before use, but that needn't be when the app is started. However, if you are loading non-locally, there is a potential delay involved which might cause problems. But anyway, if someone is dealing with that kind of stuff, I guess they can deal with the loading themselves and modify the Dimage constructor to take an image that they have already loaded themselves.