Do you want it to read in filenames of PNG's?
Do you want it to read in buffers? (in that case, the extension would work as rui.rosario described)
Do you want the extension to process a single image at the time or to process multiple images at once?
Do you want extra functionalities besides the ones you already described?
For instance, to have some adaptability/flexibility?
The manual does say that both forms of getpixel are slow. to quote the manual:
Description
This function can be used to get the colour of a specific pixel from a surface, using the local coordinates of the surface where (0,0) is the top left corner. This function should
not be used very often as it is extremely slow and may cause a pause in your game.
NOTE: When working with surfaces there is the possibility that they can cease to exist at any time due to them being stored in texture memory. You should ALWAYS check that a surface exists using surface_exists before referencing them directly. For further information see Surfaces.
Example:
col = surface_getpixel(surf, 56, 78 );
If it could be made into a shader that would be the best way,
I can make an extension, all I need to know is how to call the extension to run the script asynchronessly, and how to return the result array from the extension in an async event to gms and what async event to retreive (use social? use save/load?) my script works perfectly fine and does what I want, I just need it to run in the background and not block GMS thats why i wanted to use an async event. I suspect if a shader is capable of what my script does it would be wayyy faster tho but we're talking about coloring a black and white image not the other way around it's totally different.
I need it to work on windows and android (I allready have it working fine on both, but no async)
This is what my script does:
The user loads in a black and white picture
then selects weather the RGB elements to be generated go to light areas, medium areas or dark areas, such as if he picks red for dark, green for medium and blue for light my script takes all the heavilly shaded areas and converts them to red, the medium shaded areas convert to green and the lightly shaded areas convert to blue.
here's some screenshots of the working results:
how it works:
FOR EVERY PIXEL:
1. gets pixel color from the picture starting at the left top pixel.
2. records the color of the pixel to a variable
3. splits the result into the rgb values and puts each in a seperate variable
4. adds these 3 variable values together and: if less than= 255 sets a variable for dark areas, if between 255 & 510 sets a variable for medium areas, if > 510 sets a variable for dark areas
5. reads the users choice and sets the array variable at the appropriate index to the output pixel color red, green, or blue with a light, medium, or dark amount of color, the light medium values are implimented by using the original values for those 2 rgb elements. (the rgb element chosen as dark is set to 255)
6. when all pixels are read and adjusted it sets the variable colorize to 1 so the drawing event is activated using the completed array
as you can see I only need to send the script to async so the game doesnt freeze, the script does all the work, and then i only need to retreive the finished array, that's all i need to do and all i need to know is how to return an aray from async