You are not logged in.
Pages: 1
http://www.gmlscripts.com/script/sprite … olor_blend
This code is what i exactly search : colorize partial code.. But it is really laggy. The other sprite_replace_color replaces only one type color. Will it be optimized by someone ? There is no other way for it ?
Edit : i wonder how colorize partial works that fast in sprite editor..
Last edited by xantier (2010-06-07 00:31:37)
Offline
The sprite editor's "colorize partial" tool works that fast because it is natively compiled code and it can directly access the memory the sprite is stored into. GML has neither of those advantages.
It might be possible to make a script to replace multiple colors with blending using the raster tricks that sprite_replace_color uses, along with some of the similar work that brac37 has done with HSV conversion, but there are certain limitations to what can be accomplished due to the imprecision problems inherent to those methods. The complexity of the resulting script would probably slow it down to the point that it would be impractical for real-time use.
If it's suitable for your project, I'd highly recommend splitting your sprite into parts. You can recolor any of these parts extremely quickly using the color blending features of image_blend or the extended sprite drawing functions.
Abusing forum power since 1986.
Offline
Can i see what brac37 did ? And why are these functions removed at gm5 ? And im not able to split 115 images per sprite.. I'm ripping RA1 sprites so my work is hard.. I recoded the replace_color_blend using surfaces (surface_getpixel, set target on surface etc.), it became only a "bit" faster.. Is it possible to do it with DLLs, without lag ?
Offline
GM5 uses a completely different graphics API. Many things had to be changed when hardware acceleration was added to later versions of Game Maker.
If your sprites are files, you could certainly make a recoloring DLL that would be much faster, but you wouldn't be able to recolor sprites quickly enough to do at 30 FPS if that's what you are thinking.
Here are brac37's scripts:
http://gmc.yoyogames.com/index.php?showtopic=377844
Now think about this: If the slow script works for you, can't you modify it to automatically extract the parts you are recoloring into separate sprites which could then be saved to disk for fast loading at game time?
Abusing forum power since 1986.
Offline
I think i will have to recode my gm8 game for gm5. Actually I dont want to spend my time on complicated things DLLs, surfaces etc. much more.. The functions i needed are already in gm5. I hope advanced functions like these will be added in gm9 (if there will be..). Until that, i will probably use gm5..
Offline
Pages: 1