Code

made it callable by other extensions. the workaround is sorta ugly, but it should...
[inkscape.git] / share / extensions / color_grayscale.py
1 import coloreffect\r
2 \r
3 class C(coloreffect.ColorEffect):\r
4   def colmod(self,r,g,b):\r
5     #ITU-R Recommendation BT.709\r
6     #l = 0.2125 * r + 0.7154 * g + 0.0721 * b\r
7     #NTSC and PAL\r
8     l = 0.299 * r + 0.587 * g + 0.114 * b\r
9     ig=int(round(l))\r
10     #coloreffect.debug('gs '+hex(r)+' '+hex(g)+' '+hex(b)+'%02x%02x%02x' % (ig,ig,ig))\r
11     return '%02x%02x%02x' % (ig,ig,ig)\r
12 \r
13 c = C()\r
14 c.affect()