Package schrodinger :: Package analysis :: Module reaction :: Class _ImageCanvas
[hide private]
[frames] | no frames]

Class _ImageCanvas

object --+
         |
        _ImageCanvas

Objects of this class have an Image and a Canvas, which are accessible as the .img and .canvas properties. The initializer determines whether to use cairoCanvas, if available, or fall back to spingCanvas.

This class tries to hide some subtle incompatibilities between the two canvas classes. In particular, the Cairo canvas "owns" the image, and if someone else changes it, the underlying C library crashes! But we need to use the lower-level Image.paste() because none of the canvas classes support a paste method.

_ImageCanvas works around this issue by deferring the instantiation of the Cairo canvas until the .canvas property is accessed. Note that once the Cairo canvas has been instantiatated, changes to the underlying Image are no longer safe. In other words, the client must do all the pasting before doing any drawing.

Instance Methods [hide private]
 
__init__(self, size)
x.__init__(...) initializes x; see help(type(x)) for signature

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]
PIL.Image.Image img
rdkit.Chem.Draw.canvasbase.CanvasBase canvas

Inherited from object: __class__

Method Details [hide private]

__init__(self, size)
(Constructor)

 

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  • size (tuple of int) - size of the image/canvas as (width, height) in pixels
Overrides: object.__init__

Property Details [hide private]

img

Get Method:
unreachable.img(self)
Type:
PIL.Image.Image

canvas

Get Method:
unreachable.canvas(self)
Type:
rdkit.Chem.Draw.canvasbase.CanvasBase