MCPcopy Create free account
hub / github.com/PageBot/PageBot / _getAlpha

Method _getAlpha

Lib/pagebot/elements/imagedata.py:111–118  ·  view source on GitHub ↗

Use alpha channel of the fill color as opacity of the image.

(self)

Source from the content-addressed store, hash-verified

109 return self.doc.context.imagePixelColor(self.path, p)
110
111 def _getAlpha(self):
112 """Use alpha channel of the fill color as opacity of the image."""
113 sFill = self.css('fill', noColor)
114 if isinstance(sFill, (tuple, list)) and len(sFill) == 4:
115 _, _, _, alpha = sFill
116 else:
117 alpha = 1
118 return alpha
119
120 def build(self, view, origin=ORIGIN, **kwargs):
121 """Draw the image in the calculated scale. Since we need to use the

Callers 1

buildMethod · 0.95

Calls 1

cssMethod · 0.45

Tested by

no test coverage detected