kyamagu / skia-python

Python binding to Skia Graphics Library
https://kyamagu.github.io/skia-python/
BSD 3-Clause "New" or "Revised" License
237 stars 42 forks source link

rgb r and b are working in reverse fashion... #239

Open lotusquants opened 5 months ago

lotusquants commented 5 months ago

Describe the bug Skia.Color(r,g,b) paint = skia.Paint( AntiAlias=True, Color=skia.ColorSetRGB(r = 0, g = 0, b = 189), )

This should be blue..but gives red

and Color=skia.ColorSetRGB(r = 189, g = 0 b = 0), this should be red, but gives blue..

To Reproduce Steps to reproduce the behavior: Draw a rectangle with these colors and see..

Expected behavior and Color=skia.ColorSetRGB(r = 189, g = 40, b = 40),

this should be red

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

HinTak commented 5 months ago

I am not able to reproduce this with the upcoming m124 (see #236 to download artefact under the action tab) . Please supply/confirm:

I try SetRGB then ColorGetA(n) etc for the different channels, and also modified the code in #167 to draw with set colors. Looks okay.

Also, note there is no named argument matching, I think - i.e.if you do ColorSetRGB(b=..., r=..., g=...) in the wrong order, you get wrong color. It is also a bad idea to use Color as a variable name, for possible collisions...