.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2018 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc

.. currentmodule:: wx.svg

.. highlight:: python



.. _wx.svg.SVGimage:

==========================================================================================================================================
|phoenix_title|  **wx.svg.SVGimage**
==========================================================================================================================================

The SVGimage class provides various ways to load and use SVG images
in wxPython applications.



|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>SVGimage</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.svg.SVGimage_inheritance.png" alt="Inheritance diagram of SVGimage" usemap="#dummy" class="inheritance"/></center>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.svg.SVGimage.html" title="wx.svg.SVGimage" alt="" coords="55,83,195,112"/> <area shape="rect" id="node2" href="wx.svg._nanosvg.SVGimageBase.html" title="wx.svg._nanosvg.SVGimageBase" alt="" coords="5,5,244,35"/> </map> 
   </p>
   </div>

|


|super_classes| Known Superclasses
==================================

:class:`wx.svg._nanosvg.SVGimageBase`

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.svg.SVGimage.ConvertToBitmap`                                         Creates a :class:`wx.Bitmap` containing a rasterized version of the SVG image.
:meth:`~wx.svg.SVGimage.ConvertToScaledBitmap`                                   Automatically scales the SVG image so it will fit in the given size,
:meth:`~wx.svg.SVGimage.RenderToGC`                                              Draw the collection of shapes and paths in the SVG image
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: SVGimage(SVGimageBase)

   The SVGimage class provides various ways to load and use SVG images
   in wxPython applications.

   .. method:: ConvertToBitmap(self, tx=0.0, ty=0.0, scale=1.0, width=-1, height=-1, stride=-1)

      Creates a :class:`wx.Bitmap` containing a rasterized version of the SVG image.
      
      :param float `tx`: Image horizontal offset (applied after scaling)
      :param float `ty`: Image vertical offset (applied after scaling)
      :param float `scale`: Image scale
      :param int `width`: width of the image to render, defaults to width from the SVG file
      :param int `height`: height of the image to render, defaults to height from the SVG file
      :param int `stride`: number of bytes per scan line in the destination buffer, typically ``width * 4``
      
      :returns: :class:`wx.Bitmap`


   .. method:: ConvertToScaledBitmap(self, size, window=None)

      Automatically scales the SVG image so it will fit in the given size,
      and creates a :class:`wx.Bitmap` of that size, containing a rasterized
      version of the SVG image. If a window is passed then the size of the
      bitmap will automatically be adjusted to the content scale factor of
      that window. For example, if a (32,32) pixel bitmap is requested for a
      window on a Retina display, then a (64,64) pixel bitmap will be created.
      
      :param wx.Size `size`: Size of the bitmap to create, in pixels
      :param wx.Window `window`: Adjust the size by this window's content scale factor, if supported on the platform
      
      :returns: :class:`wx.Bitmap`


   .. method:: RenderToGC(self, ctx, scale=None, size=None)

      Draw the collection of shapes and paths in the SVG image
      onto the given :class:`wx.GraphicsContext` using the drawing primitives
      provided by the context. The Context's state is saved and restored so
      any transformations done while rendering the SVG will be undone.
      
      :param wx.GraphicsContext `ctx`: The context to draw upon
      :param float `scale`: If given, apply to the context's scale.
      :param (float, float) `size`: If given, scale the image's width and height
          to that provided in this parameter. Ignored if ``scale`` is also specified.
      
      .. note::
          Some GraphicsContext backends perform better than others.
          The default GDI+ backend on Windows is the most glitchy, but the
          Direct2D backend works well.


