8000 MEP28 · matplotlib/matplotlib Wiki · GitHub
[go: up one dir, main page]

Skip to content
10000
mdehoon edited this page Jul 11, 2015 · 7 revisions

.. contents:: Table of Contents

.. author:: Michiel de Hoon

.. date:: July 11, 2015

Status

Discussion

Branches and Pull requests

None so far.

Abstract

To set the transparency (alpha component) of a graphics context, either gc.set_alpha(alpha) or gc.set_foreground(rgba, isRGBA=True) can be used. Currently, gc.set_alpha(alpha) forces the alpha value, meaning that gc.set_foreground(rgba, isRGBA=True) will ignore the alpha value of rgba if alpha was previously set through gc.set_alpha. Forcing alpha adds complexity to GraphicsContextBase as well as to the Cairo and MacOSX backends, in which this behavior is partially implemented.

Detailed description

  • Current situation
  • Actual usage of forced alpha in matplotlib
  • Comparison to other APIs (Cairo, Cocoa, Postscript, Windows?)
  • Alternatives to forced alpha.

Implementation

  • Review the current usage of gc.set_alpha and make the required changes, if any;
  • Remove the _forced_alpha sections from GraphicsContextBase, RendererCairo, GraphicsContextCairo, RendererMac, GraphicsContextMac, and _macosx.GraphicsContext.

Backward compatibility

The proposal changes the graphics context, which is part of the internal API of matplotlib and is not expected to affect end users.

Alternatives

Clone this wiki locally
0