SourceForge logo
SourceForge logo
Menu

[matplotlib-devel] colors in backend_bases.py

From: Joel B. M. <jo...@ki...> - 2014年10月20日 14:10:46
Hi,
I'm working on https://github.com/matplotlib/matplotlib/pull/3393 and 
poking around at _alpha, _forced_alpha, _rgb, and _orig_color members of 
GraphicsContextBase. I see quite a number of issues:
1) "_rgb" is (almost) always a 4 tuple which may be better named "_rgba".
2) "_orig_color" takes on many different value types -- I think it can 
be deleted and the "_rgb" variable used in the one place it is needed.
3) "get_rgb" documents that it returns a 3 or 4 tuple. In fact, I 
think it returns a 4-tuple (see point 1). backend_ps.py is a 
particularly scary example of the 3 tuple interpretation being taken 
with-out further thought.
4) I suppose there is a good reason for the existence of 
"_forced_alpha" and "_alpha", but I don't understand it. Since "_rgb" 
is a 4-tuple in common (all?) usage, why can't "set_alpha" merely set 
"_rgb[3]"?
I'm going to be pushing something more to my branch at 
https://github.com/matplotlib/matplotlib/pull/3393 -- deleting 
"_orig_color" and renaming "_rgb" to "_rgba". But even with these 
changes, the points above give me pause.
(I'm also sitting on irc right now asking these same questions).
Joel

View entire thread

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /