Python rsvg.Handle() Examples
The following are 23
code examples of rsvg.Handle().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
rsvg
, or try the search function
.
Example #1
Source File: svgitem.py From ns3-802.11ad with GNU General Public License v2.0 | 6 votes |
def __init__(self, x, y, rsvg_handle, **kwargs): """ Initializer @param self this object """ super(SvgItem, self).__init__(**kwargs) assert isinstance(rsvg_handle, rsvg.Handle) self.x = x self.y = y self.sx = 1.0 self.sy = 1.0 self.handle = rsvg_handle self.width = self.handle.props.width self.height = self.handle.props.height self.custom_width = None self.custom_height = None
Example #2
Source File: svg2png.py From godot-themes with MIT License | 6 votes |
def svg2png(svg_file, output_file, scale=1): # Get the svg files content svg_data = open(svg_file).read() # Get the width / height inside of the SVG doc = minidom.parseString(svg_data) width = [path.getAttribute('width') for path in doc.getElementsByTagName('svg')][0] height = [path.getAttribute('height') for path in doc.getElementsByTagName('svg')][0] width = int(round(float(re.compile('(\d+\.*\d*)\w*').findall(width)[0]))) height = int(round(float(re.compile('(\d+\.*\d*)\w*').findall(height)[0]))) doc.unlink() # Create the png img = cairo.ImageSurface( cairo.FORMAT_ARGB32, width * scale, height * scale) ctx = cairo.Context(img) ctx.scale(scale, scale) handler = rsvg.Handle(None, str(svg_data)) handler.render_cairo(ctx) img.write_to_png(output_file) print("{} ==> {}".format(svg_file, output_file))
Example #3
Source File: svgitem.py From royal-chaos with MIT License | 6 votes |
def __init__(self, x, y, rsvg_handle, **kwargs): """ Initializer @param self this object """ super(SvgItem, self).__init__(**kwargs) assert isinstance(rsvg_handle, rsvg.Handle) self.x = x self.y = y self.sx = 1.0 self.sy = 1.0 self.handle = rsvg_handle self.width = self.handle.props.width self.height = self.handle.props.height self.custom_width = None self.custom_height = None
Example #4
Source File: svgitem.py From royal-chaos with MIT License | 5 votes |
def rsvg_handle_factory(base_file_name): try: return _rsvg_cache[base_file_name] except KeyError: full_path = os.path.join(os.path.dirname(__file__), 'resource', base_file_name) rsvg_handle = rsvg.Handle(full_path) _rsvg_cache[base_file_name] = rsvg_handle return rsvg_handle
Example #5
Source File: svgitem.py From Tocino with GNU General Public License v2.0 | 5 votes |
def rsvg_handle_factory(base_file_name): try: return _rsvg_cache[base_file_name] except KeyError: full_path = os.path.join(os.path.dirname(__file__), 'resource', base_file_name) rsvg_handle = rsvg.Handle(full_path) _rsvg_cache[base_file_name] = rsvg_handle return rsvg_handle
Example #6
Source File: svgitem.py From Tocino with GNU General Public License v2.0 | 5 votes |
def __init__(self, x, y, rsvg_handle, **kwargs): super(SvgItem, self).__init__(**kwargs) assert isinstance(rsvg_handle, rsvg.Handle) self.x = x self.y = y self.sx = 1.0 self.sy = 1.0 self.handle = rsvg_handle self.width = self.handle.props.width self.height = self.handle.props.height self.custom_width = None self.custom_height = None
Example #7
Source File: svgitem.py From ns3-802.11ad with GNU General Public License v2.0 | 5 votes |
def rsvg_handle_factory(base_file_name): try: return _rsvg_cache[base_file_name] except KeyError: full_path = os.path.join(os.path.dirname(__file__), 'resource', base_file_name) rsvg_handle = rsvg.Handle(full_path) _rsvg_cache[base_file_name] = rsvg_handle return rsvg_handle
Example #8
Source File: svgitem.py From ns3-ecn-sharp with GNU General Public License v2.0 | 5 votes |
def rsvg_handle_factory(base_file_name): try: return _rsvg_cache[base_file_name] except KeyError: full_path = os.path.join(os.path.dirname(__file__), 'resource', base_file_name) rsvg_handle = rsvg.Handle(full_path) _rsvg_cache[base_file_name] = rsvg_handle return rsvg_handle
Example #9
Source File: svgitem.py From ns3-ecn-sharp with GNU General Public License v2.0 | 5 votes |
def __init__(self, x, y, rsvg_handle, **kwargs): super(SvgItem, self).__init__(**kwargs) assert isinstance(rsvg_handle, rsvg.Handle) self.x = x self.y = y self.sx = 1.0 self.sy = 1.0 self.handle = rsvg_handle self.width = self.handle.props.width self.height = self.handle.props.height self.custom_width = None self.custom_height = None
Example #10
Source File: svgitem.py From CRE-NS3 with GNU General Public License v2.0 | 5 votes |
def rsvg_handle_factory(base_file_name): try: return _rsvg_cache[base_file_name] except KeyError: full_path = os.path.join(os.path.dirname(__file__), 'resource', base_file_name) rsvg_handle = rsvg.Handle(full_path) _rsvg_cache[base_file_name] = rsvg_handle return rsvg_handle
Example #11
Source File: svgitem.py From CRE-NS3 with GNU General Public License v2.0 | 5 votes |
def __init__(self, x, y, rsvg_handle, **kwargs): super(SvgItem, self).__init__(**kwargs) assert isinstance(rsvg_handle, rsvg.Handle) self.x = x self.y = y self.sx = 1.0 self.sy = 1.0 self.handle = rsvg_handle self.width = self.handle.props.width self.height = self.handle.props.height self.custom_width = None self.custom_height = None
Example #12
Source File: svgitem.py From ns-3-dev-git with GNU General Public License v2.0 | 5 votes |
def rsvg_handle_factory(base_file_name): try: return _rsvg_cache[base_file_name] except KeyError: full_path = os.path.join(os.path.dirname(__file__), 'resource', base_file_name) rsvg_handle = rsvg.Handle(full_path) _rsvg_cache[base_file_name] = rsvg_handle return rsvg_handle
Example #13
Source File: svgitem.py From ns-3-dev-git with GNU General Public License v2.0 | 5 votes |
def __init__(self, x, y, rsvg_handle, **kwargs): super(SvgItem, self).__init__(**kwargs) assert isinstance(rsvg_handle, rsvg.Handle) self.x = x self.y = y self.sx = 1.0 self.sy = 1.0 self.handle = rsvg_handle self.width = self.handle.props.width self.height = self.handle.props.height self.custom_width = None self.custom_height = None
Example #14
Source File: svgitem.py From ntu-dsi-dcn with GNU General Public License v2.0 | 5 votes |
def __init__(self, x, y, rsvg_handle, **kwargs): super(SvgItem, self).__init__(**kwargs) assert isinstance(rsvg_handle, rsvg.Handle) self.x = x self.y = y self.sx = 1.0 self.sy = 1.0 self.handle = rsvg_handle self.width = self.handle.props.width self.height = self.handle.props.height self.custom_width = None self.custom_height = None
Example #15
Source File: svgitem.py From ns3-rdma with GNU General Public License v2.0 | 5 votes |
def rsvg_handle_factory(base_file_name): try: return _rsvg_cache[base_file_name] except KeyError: full_path = os.path.join(os.path.dirname(__file__), 'resource', base_file_name) rsvg_handle = rsvg.Handle(full_path) _rsvg_cache[base_file_name] = rsvg_handle return rsvg_handle
Example #16
Source File: svgitem.py From ns3-rdma with GNU General Public License v2.0 | 5 votes |
def __init__(self, x, y, rsvg_handle, **kwargs): super(SvgItem, self).__init__(**kwargs) assert isinstance(rsvg_handle, rsvg.Handle) self.x = x self.y = y self.sx = 1.0 self.sy = 1.0 self.handle = rsvg_handle self.width = self.handle.props.width self.height = self.handle.props.height self.custom_width = None self.custom_height = None
Example #17
Source File: svgitem.py From 802.11ah-ns3 with GNU General Public License v2.0 | 5 votes |
def rsvg_handle_factory(base_file_name): try: return _rsvg_cache[base_file_name] except KeyError: full_path = os.path.join(os.path.dirname(__file__), 'resource', base_file_name) rsvg_handle = rsvg.Handle(full_path) _rsvg_cache[base_file_name] = rsvg_handle return rsvg_handle
Example #18
Source File: svgitem.py From 802.11ah-ns3 with GNU General Public License v2.0 | 5 votes |
def __init__(self, x, y, rsvg_handle, **kwargs): super(SvgItem, self).__init__(**kwargs) assert isinstance(rsvg_handle, rsvg.Handle) self.x = x self.y = y self.sx = 1.0 self.sy = 1.0 self.handle = rsvg_handle self.width = self.handle.props.width self.height = self.handle.props.height self.custom_width = None self.custom_height = None
Example #19
Source File: svgitem.py From ns3-load-balance with GNU General Public License v2.0 | 5 votes |
def rsvg_handle_factory(base_file_name): try: return _rsvg_cache[base_file_name] except KeyError: full_path = os.path.join(os.path.dirname(__file__), 'resource', base_file_name) rsvg_handle = rsvg.Handle(full_path) _rsvg_cache[base_file_name] = rsvg_handle return rsvg_handle
Example #20
Source File: svgitem.py From ns3-load-balance with GNU General Public License v2.0 | 5 votes |
def __init__(self, x, y, rsvg_handle, **kwargs): super(SvgItem, self).__init__(**kwargs) assert isinstance(rsvg_handle, rsvg.Handle) self.x = x self.y = y self.sx = 1.0 self.sy = 1.0 self.handle = rsvg_handle self.width = self.handle.props.width self.height = self.handle.props.height self.custom_width = None self.custom_height = None
Example #21
Source File: svgitem.py From IEEE-802.11ah-ns-3 with GNU General Public License v2.0 | 5 votes |
def rsvg_handle_factory(base_file_name): try: return _rsvg_cache[base_file_name] except KeyError: full_path = os.path.join(os.path.dirname(__file__), 'resource', base_file_name) rsvg_handle = rsvg.Handle(full_path) _rsvg_cache[base_file_name] = rsvg_handle return rsvg_handle
Example #22
Source File: svgitem.py From IEEE-802.11ah-ns-3 with GNU General Public License v2.0 | 5 votes |
def __init__(self, x, y, rsvg_handle, **kwargs): super(SvgItem, self).__init__(**kwargs) assert isinstance(rsvg_handle, rsvg.Handle) self.x = x self.y = y self.sx = 1.0 self.sy = 1.0 self.handle = rsvg_handle self.width = self.handle.props.width self.height = self.handle.props.height self.custom_width = None self.custom_height = None
Example #23
Source File: svgitem.py From ntu-dsi-dcn with GNU General Public License v2.0 | 5 votes |
def rsvg_handle_factory(base_file_name): try: return _rsvg_cache[base_file_name] except KeyError: full_path = os.path.join(os.path.dirname(__file__), 'resource', base_file_name) rsvg_handle = rsvg.Handle(full_path) _rsvg_cache[base_file_name] = rsvg_handle return rsvg_handle