skia-python icon indicating copy to clipboard operation
skia-python copied to clipboard

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

Open lotusquants opened this issue 1 year ago • 2 comments

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):

  • OS: ubuntu 22.04
  • Python: 3.10.12
  • skia-python version: 87.5

Additional context Add any other context about the problem here.

lotusquants avatar Apr 13 '24 10:04 lotusquants

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

  • a full example
  • your arch - I am on x86_64 - are you running ubuntu on a pi (aarch64) or something unusual?
  • try m124 if you can - we'd unlikely to go back to m87.

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...

HinTak avatar Apr 16 '24 12:04 HinTak

https://github.com/kyamagu/skia-python/issues/191 Maybe you can do this to solve the problem

Polyisoprene avatar Oct 09 '24 08:10 Polyisoprene