Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SVG colors are definitely wrong #3828

Open
1 task done
FileEX opened this issue Oct 26, 2024 · 0 comments · May be fixed by #3829
Open
1 task done

SVG colors are definitely wrong #3828

FileEX opened this issue Oct 26, 2024 · 0 comments · May be fixed by #3829
Labels
bug Something isn't working

Comments

@FileEX
Copy link
Contributor

FileEX commented Oct 26, 2024

Describe the bug

The colors in textures created with svgCreate are different from the colors of the exact same texture in .png format. I already brought this up in #3695 5, but this issue is more precise and focuses only on colors.

Using dxSetBlendMode set to 'add' makes the SVG display the correct colors, but this makes it difficult (if not impossible) to manipulate the texture's alpha for animations, for example. I believe this is a bug that should be fixed, as in the current state, SVG is not suitable for use with animations like fade-out/fade-in due to the need to set the blend mode to get accurate colors

Image

Steps to reproduce

local w,h = 600, 450;

local svg_bg = svgCreate(w, h, [[
	<svg width="604" height="454" viewBox="0 0 604 454" fill="none" xmlns="http://www.w3.org/2000/svg">
		<rect x="2" y="2" width="600" height="450" rx="10" fill="#21323A" fill-opacity="0.6"/>
		<rect x="1" y="1" width="602" height="452" rx="11" stroke="#30444D" stroke-opacity="0.6" stroke-width="2"/>
	</svg>
]]);
dxSetTextureEdge(svg_bg, 'clamp');

local tex_bg = dxCreateTexture('images/bg.png', 'argb', false, 'clamp');

addEventHandler('onClientRender', root, function()
	dxDrawImage(150, 200, w, h, svg_bg, 0, 0, 0, 0xFFFFFFFF);
	dxDrawImage(150 + w + 100, 200, w, h, tex_bg, 0, 0, 0, 0xFFFFFFFF);
end);

Texture .png
Image

Version

Multi Theft Auto v1.6-release-22789

Additional context

No response

Relevant log output

No response

Security Policy

  • I have read and understood the Security Policy and this issue is not security related.
@FileEX FileEX added the bug Something isn't working label Oct 26, 2024
@Lpsd Lpsd linked a pull request Oct 26, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant