简体   繁体   English

Pygame / Python中的Illustrator矢量

[英]Illustrator Vector in Pygame/Python

I do not know if this is doable but I am making a program in pygame and wanted to know if I could change the color of a vector file from python/pygame. 我不知道这是否可行,但是我正在pygame中编写一个程序,想知道是否可以从python / pygame中更改矢量文件的颜色。 I have a color wheel and would like to know if the user can use the selected color on an image. 我有一个色轮,想知道用户是否可以在图像上使用所选的颜色。 Is there another file format that makes this possible? 是否有其他文件格式可以做到这一点? Thanks. 谢谢。

Edit: 编辑:

I found svgwrite, but how could I change to color of the SVG. 我找到了svgwrite,但是如何更改为SVG的颜色。 Thanks 谢谢

Probably your best bet is to store the image you want to "tint" as a grayscale bitmap, and then use a line like this to "tint" it in whatever direction you want: 最好的选择是将要“着色”的图像存储为灰度位图,然后使用类似的线条沿所需的任何方向“着色”它:

surface.fill(color, special_flags=BLEND_RGB_MULT)

An alternative method would be to use a palette (old-school!) for your image, and have the user pick the palette. 一种替代方法是为图像使用调色板 (老式!),然后让用户选择调色板。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM