'''
Copyright (C) 2011 Karlisson Bezerra <contact@hacktoon.com>
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
'''
import inkex
import simplestyle
class Canvas:
"""Canvas API helper class"""
html = """
<!DOCTYPE html>
<html>
<head>
<title>Inkscape Output</title>
</head>
<body>
<canvas id='canvas' width='%d' height='%d'></canvas>
<script>
var %s = document.getElementById("canvas").getContext("2d");
%s
</script>
</body>
</html>
"""
"""Checks if the last style used is the same or there's no style yet"""
return True
return True
(%f,%f,%f,%f,%f,%f);" % data)
a = float(a)
if a < 1:
return "'rgba(%d, %d, %d, %.1f)'" % (r, g, b, a)
else:
return "'rgb(%d, %d, %d)'" % (r, g, b)
"""
for stop in gstops:
style = simplestyle.parseStyle(stop.get("style"))
stop_color = style["stop-color"]
opacity = style["stop-opacity"]
color = self.getColor(stop_color, opacity)
pos = float(stop.get("offset"))
self.addColorStop(href, pos, color)
"""
return None #href
try:
except:
alpha = 1
try:
except:
alpha = 1
#rounded rectangle, starts top-left anticlockwise
else:
#self.write("%s.closePath();" % self.obj)