How to overlay and redraw an image with a specified color

How to overlay and redraw an image(TDrawableImage) with a specified color


This character is a combination and actually consists of many sub parts

If use javascript then
ctx.globalCompositeOperation = “overlay”;
ctx.fillStyle = color;
ctx.fillRect(0, 0, helper1.width, helper1.height);

There is a TDrawableImage.Color which multiplies the color of every pixel of the image by the specified color. I don’t think there are more elaborate blending options, however, you can literally copy-paste custom shader from TDrawableImage and use a different formula for color calculation (e.g. calculate HSL value and multiply it by color instead of by-channel multiplication which in case of non-grayscale images may give a better result).

ha, I try by acAuto、acNone、acTest、acBlending, missing option acOverlay etc

I see also example: examples/images_videos/image_render_custom_shader/ .

but use a different formula ?This is hard,There should be a better idea

I have come up with a solution. Since CGE does not support color replacement, I can only bypass CGE

Replace the color of the png first, and then draw it again

2D games often use replacement colors to change character images, such as changing hair colors (not mixing, but replacing colors). We hope that CGE can add this feature as soon as possible.