
`9Sc           @   s  d  Z  d d d f d d f g Z d d l Z d d l Z d d l Z d d l Z d d l m Z d d l Z d	 Z	 d
 Z
 d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z  d Z! d Z" d Z# d Z$ d Z% d Z& d Z' d Z( d Z) e) Z* d Z+ d Z, d Z- d Z. d Z/ d Z0 d Z1 d Z2 d Z3 d Z4 d Z5 d Z6 d Z7 d Z8 d Z9 d Z: d Z; d Z< d Z= d Z> d Z? d Z@ d  ZA d! ZB d ZC d" ZD d# ZE d ZF d ZG d ZH d ZI d ZJ d ZK d ZL d ZM d ZN d ZO d$ ZP d% ZQ d& ZR d' ZS d( ZT d ZU d) ZV d* ZW d* ZX d ZY d ZZ d Z[ d Z\ d Z] d Z^ d Z_ d+ Z` d Za e` e] eZ ea Zb d Zc d, Zd d- Ze d- Zf d. Zg d/ Zh d/ Zi d0 Zj d1 Zk d1 Zl d2 Zm d3 Zn d3 Zo d4 Zp d4 Zq d Zr d Zs d Zt d5 Zu d6 Zv ev Zw d7 Zx d8 Zy d9 Zz d: Z{ d; Z| d< Z} d= Z~ d> Z d? Z e Z d@ Z dA Z dB Z dC Z dD Z dE Z dF Z dG Z dH Z dI Z dJ Z dK Z dL Z dM Z dN Z dO Z dP Z dQ Z dR Z dS Z dT Z dU Z dV Z dW Z dX Z dY Z dZ Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d) Z d[ Z d5 Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d) Z d[ Z d\ Z d] Z d^ Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z d Z e Z e Z d Z d Z d Z d Z d Z d Z d Z d Z d_   Z d`   Z da   Z db f  dc     YZ dd f  de     YZ df e f dg     YZ dh f  di     YZ i  Z xW e e  D]I Z e e e e  Z e oe e  oe e e  re e e j <n  qWdj f  dk     YZ e dl k ry d dm l m Z e dn do  Z e j dp dq dr ds dt du e e j dv dq dr ds dw du e e j dx dq dy ds dz du e e j   \ Z Z Wn0 d{ f  d|     YZ e   Z e j d Z n Xe e  d k rx e D] Z e dt e j  Z e j e  e j rze j r8e d} e _ n  d~ e j GHe j e j  Z e rkd e j GHn d e j GHn  qWn e dt e j  Z e j d  n  d S(   s#  

pyemf is a pure python module that provides a cross-platform ability
to generate enhanced metafiles (.emf files), a vector graphics format
defined by the ECMA-234 standard.  Enhanced metafiles are a natively
supported image and scalable clip-art format in the OpenOffice suite
of tools and in Windows applications.

U{ECMA-234<http://www.ecma-international.org/publications/standards/Ecma-234.htm>}
is the published interface for enhanced metafiles, which is also a
file-based representation of the Windows graphics device interface.
This API follows most of the naming conventions of ECMA-234, and most
of the parameter lists of methods are the same as their ECMA-234
equivalents.  The primary difference is that pyemf has extended the
API to be object-oriented based on the class L{EMF}.  So, while in
ECMA-234 the first argument is generally the device context, here in
pyemf it is implicit in the class instance.

ECMA-234 defines a lot of constants (mostly integers that are used as
flags to various functions) that pyemf defines as module level
variables.  So, rather than pollute your global namespace, it is
recommended that you use C{import pyemf} rather than C{from pyemf
import *}.

Introduction
============

To use pyemf in your programs, you L{instantiate<EMF.__init__>} an
L{EMF} object, draw some stuff using its methods, and save the file.
An example::

  #!/usr/bin/env python

  import pyemf

  width=8.0
  height=6.0
  dpi=300

  emf=pyemf.EMF(width,height,dpi)
  thin=emf.CreatePen(pyemf.PS_SOLID,1,(0x01,0x02,0x03))
  emf.SelectObject(thin)
  emf.Polyline([(0,0),(width*dpi,height*dpi)])
  emf.Polyline([(0,height*dpi),(width*dpi,0)])
  emf.save("test-1.emf")

This small program creates a 8in x 6in EMF at 300 dots per inch, and
draws two lines connecting the opposite corners.  This simple test is
available as C{test-1.py} in the C{examples} directory of the pyemf
distribution.  There are many other small test programs to demonstrate
other features of the EMF class.


Naming Conventions in pyemf
===========================

Methods that belong to ECMA-234 are C{CamelCased} starting with a
capital letter.  Methods that apply to the operation of the L{EMF}
class itself (i.e. L{load<EMF.load>} and L{save<EMF.save>}) are
C{lower} cased.  Constants described in L{pyemf} that are used as
parameters are C{ALL_UPPER_CASE}.


Coordinate System
=================

Coordinates are addressed a coordinate system called B{page space} by
integer pixels in a horizontal range (increasing to the right) from C{0}
to C{width*density}, and vertically (from the top down) C{0} to
C{height*density}.  Density is either dots per inch if working in
english units, or dots per millimeter if working in metric.

World and Page Space
--------------------

Note that there are four coordinate spaces used by GDI: world, page,
device, and physical device.  World and page are the same, unless a
world transform (L{SetWorldTransform<EMF.SetWorldTransform>},
L{ModifyWorldTransform<EMF.ModifyWorldTransform>}) is used.  In that
case, you operate in world space (that is transformed into page space
by multiplying by the transformation matrix), and it could be scaled
differently.


Experimental Coordinate System
------------------------------

Experimental support for device coordinates is available through
L{SetMapMode<EMF.SetMapMode>} and the various Window and Viewport
methods.  Device coordinates are referenced by physical dimensions
corresponding to the mapping mode currently used.  [The methods work
correctly (in the sense that they generate the correct records in the
metafile) and the API won't change, but it's not clear to me what the
parameters should do.]


Drawing Characteristics
=======================

GDI has a concept of the B{current object} for the each of the three
drawing characteristics: line style, fill style, and font.  Once a
characteristic is made current using
L{SelectObject<EMF.SelectObject>}, it remains current until it is
replaced by another call to SelectObject.  Note that a call to
SelectObject only affects that characteristic, and not the other two,
so changing the line style doesn't effect the fill style or the font.

Additionally, there is a set of B{stock objects} retrievable with
L{GetStockObject<EMF.GetStockObject>} that should be available on any
system capable of rendering an EMF.


Colors
------

A quick note about color.  Colors in pyemf are specified one of three
ways:

  - (r,g,b) tuple, where each component is a integer between 0 and 255 inclusive.

  - (r,g,b) tuple, where each component is a float between 0.0 and 1.0 inclusive.

  - packed integer created by a call to L{RGB}


Line Styles
-----------

Line styles are created by L{CreatePen<EMF.CreatePen>} and specify the
style, width, and color.

Note that there is a NULL_PEN stock object if you don't actually want
to draw a line with a drawing primitive.


Fill Styles
-----------

Polygon fill styles are created by
L{CreateSolidBrush<EMF.CreateSolidBrush>} and theoretically
L{CreateHatchBrush<EMF.CreateHatchBrush>}, although the latter doesn't
seem to be supported currently in OpenOffice.  So, reliably we can only
use CreateSolidBrush and thus can only specify a fill color and not a
fill pattern.

Note that there is a stock object NULL_BRUSH that doesn't fill, useful
if you want to only draw an outline of a primitive that is normally
filled.

An interesting side-note is that there is no direct support for
gradients in EMF.  Examining some .emfs that do have gradients shows
that Windows produces them using clipping regions and subdividing the
object into areas of a single color an drawing slices of the
individual color.  Better support for clipping regions is the subject
of a future release of pyemf, but they also don't seem to work well in
OpenOffice, so it hasn't been a high priority.


Fonts
-----

L{CreateFont<EMF.CreateFont>} requires a large number of parameters,
the most important being the height, the rotation, and the name.  Note
that the height can either be specified as a positive or negative
integer, where negative means use that value as the average I{glyph}
height and positive means use the value as the average I{cell} height.
Since a glyph is contained within a cell, the negative value will
yield a slightly larger font when rendered on screen.

Note that the two rotation values must specify the same angle.

Also note that font color is not part of a
L{SelectObject<EMF.SelectObject>} characteristic.  It is specified
using the separate method L{SetTextColor<EMF.SetTextColor>}.
L{SetBkMode<EMF.SetBkMode>} and L{SetBkColor<EMF.SetBkColor>} are
supposed to work with text, but in my testing with OpenOffice it hasn't been
consistent.  I tend to just C{SetBkMode(pyemf.TRANSPARENT)} and leave
it at that.


Drawing
=======

The methods listed under B{Drawing Primitives} below use either the
current line style or the current fill style (or both).  Any primitive
that creates a closed figure (L{Polygon<EMF.Polygon>},
L{PolyPolygon<EMF.PolyPolygon>}, L{Rectangle<EMF.Rectangle>},
L{RoundRect<EMF.RoundRect>}, L{Ellipse<EMF.Ellipse>},
L{Chord<EMF.Chord>}, and L{Pie<EMF.Pie>}) will use both the line and
fill style.  Others (L{Polyline<EMF.Polyline>},
L{PolyPolyline<EMF.PolyPolyline>} and L{Arc<EMF.Arc>}) will only use
the line style, excepting L{SetPixel<EMF.SetPixel>} which doesn't use either.


Paths
=====

To create more complicated shapes, the B{Path Primitives} are used.  A
path is started with a call to L{BeginPath<EMF.BeginPath>} and the
initial point should be set with L{MoveTo<EMF.MoveTo>}.  Calls to
L{LineTo<EMF.LineTo>}, L{PolylineTo<EMF.PolylineTo>},
L{ArcTo<EMF.ArcTo>}, and L{PolyBezierTo<EMF.PolyBezierTo>} extend the
path.  L{CloseFigure<EMF.CloseFigure>} should be used to connect the
final point to the starting point, otherwise the path may be filled
incorrectly.  L{EndPath<EMF.EndPath>} then completes the path, and it
may be outlined with L{StrokePath<EMF.StrokePath>}, filled with
L{FillPath<EMF.FillPath>} or both with
L{StrokeAndFillPath<EMF.StrokeAndFillPath>}.

Note that OpenOffice ignores L{ArcTo<EMF.ArcTo>} in terms of path
continuity -- the arc is drawn, but it is not connected to the path.

Note that L{SelectClipPath<EMF.SelectClipPath>} is broken in OpenOffice.


Coordinate System Transformation
================================

You might have noticed that methods like L{Ellipse<EMF.Ellipse>} and
L{Rectangle<EMF.Rectangle>} can only create objects that are aligned
with the X-Y axis.  This would be a real limitation without some way
to rotate the figures.  L{SetWorldTransform<EMF.SetWorldTransform>}
and L{ModifyWorldTransform<EMF.ModifyWorldTransform>} provide this.
These methods provide a generalized linear transformation that can
translate, rotate, scale and shear subsequent graphics operations.

These methods aren't required by the ECMA-234 spec, which may explain
why their support in OpenOffice is mixed.  Drawing primitives and
paths seem to be supported and are transformed, but text is not
(though it should be).


@author: $author
@version: $version
t   gdis   GDI Commands   GDI Commandst   oos   OpenOffice SupportiN(   t   StringIOs   2.0.0s   Rob McMullens   robm@users.sourceforge.nets   http://pyemf.sourceforge.nets<   http://sourceforge.net/project/showfiles.php?group_id=148144s%   Pure Python Enhanced Metafile Librarys/   graphics, scalable, vector, image, clipart, emft   LGPLi    i   i   i   i   i   i   i   i   i	   i   i   i   i   i   i    i   i   i   i
   i   i   i   i   i   i   i   id   i   i,  i  i  iX  i  i   i  i   i   i   i   i   i   i   i   i   i   i   i   i   iM   i   i   i   i   i   i   i   i   l    l    l    l    l    l     l   @ l    l    l      l      l      l      l       l     @ l        i    i0   i@   iP   c         C   s   |  d d d S(   s   Round to the nearest multiple of 4 greater than or equal to the
    given number.  EMF records are required to be aligned to 4 byte
    boundaries.i   i   (    (   t   num(    (    s&   code\common\utils\third_party\pyemf.pyt   _round4  s    c         C   s   t  |  t  r" t d |   }  n  |  d k r7 d }  n |  d k  rL d }  n  t  | t  rn t d |  } n  | d k r d } n | d k  r d } n  t  | t  r t d |  } n  | d k r d } n | d k  r d } n  | d >| d >B|  BS(   sh  
Pack integer color values into a 32-bit integer format.

@param r: 0 - 255 or 0.0 - 1.0 specifying red
@param g: 0 - 255 or 0.0 - 1.0 specifying green
@param b: 0 - 255 or 0.0 - 1.0 specifying blue
@return: single integer that should be used when any function needs a color value
@rtype: int
@type r: int or float
@type g: int or float
@type b: int or float

i   i    i   i   (   t
   isinstancet   floatt   int(   t   rt   gt   b(    (    s&   code\common\utils\third_party\pyemf.pyt   RGB  s&     	 	 	 	 	 	c         C   sK   t  |  t  r |  St  |  t  s1 t  |  t  r; t |    St d   d S(   s   
Normalize the input into a packed integer.  If the input is a tuple,
pass it through L{RGB} to generate the color value.

@param c: color
@type c: int or (r,g,b) tuple
@return: packed integer color from L{RGB}
@rtype: int
s<   Color must be specified as packed integer or 3-tuple (r,g,b)N(   R   R   t   tuplet   listR   t	   TypeError(   t   c(    (    s&   code\common\utils\third_party\pyemf.pyt   _normalizeColor  s
    

t   _DCc           B   s\   e  Z d  Z d d d d d  Z d   Z d   Z d   Z d	 d
  Z d   Z d   Z	 RS(   s  Device Context state machine.  This is used to simulate the
    state of the GDI buffer so that some user commands can return
    information.  In a real GDI implementation, there'd be lots of
    error checking done, but here we can't do a whole bunch because
    we're outputting to a metafile.  So, in general, we assume
    success.

    Here's Microsoft's explanation of units: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/cordspac_3qsz.asp

    Window <=> Logical units <=> page space or user addressable
    integer pixel units.

    Viewport <=> Physical units <=> device units and are measured in actual
    dimensions, like .01 mm units.

    There are four coordinate spaces used by GDI: world, page, device,
    and physical device.  World and page are the same, unless a world
    transform is used.  These are addressed by integer pixels.  Device
    coordinates are referenced by physical dimensions corresponding to
    the mapping mode currently used.

    s   6.0s   4.0t   72t   inc         C   s  d |  _  d |  _ g  |  _ |  j j d   g  |  _ d |  _ d |  _ d |  _ d |  _	 d |  _
 d |  _ | d k r |  j d d t | d  t | d   n* |  j d d t | d  t | d   d |  _ d |  _ |  j d d t | |  t | |   t d d d  |  _ d |  _ d |  _ |  j
 d | |  _ |  j d | |  _ d |  _ d |  _ |  j |  _ |  j |  _ d  S(	   Ni    i   i   i@  i   t   mmid   i	  (   t   xt   yt   objectst   appendt   Nonet   objectholest   ref_pixelwidtht   ref_pixelheightt	   ref_widtht
   ref_heightt   widtht   heightt   setPhysicalSizeR   t
   pixelwidtht   pixelheightt   setPixelSizeR   t
   text_colort
   viewport_xt
   viewport_yt   viewport_ext_xt   viewport_ext_yt   window_xt   window_yt   window_ext_xt   window_ext_y(   t   selfR    R!   t   densityt   units(    (    s&   code\common\utils\third_party\pyemf.pyt   __init__J  s4    										-*		*					c         C   s   |  j  | j | j | j | j  | j d k rT | j d |  _ | j d |  _ n  | j	 d |  _ | j
 d |  _ |  j | j | j | j | j  | j |  _ | j |  _ d S(   s3   Extract the dimensions from an _EMR._HEADER record.i    i
   id   N(   R"   t   rclFrame_leftt   rclFrame_topt   rclFrame_rightt   rclFrame_bottomt   szlMicrometers_cxR   t   szlMicrometers_cyR   t   szlMillimeters_cxt   szlMillimeters_cyR%   t   rclBounds_leftt   rclBounds_topt   rclBounds_rightt   rclBounds_bottomt   szlDevice_cxR   t   szlDevice_cyR   (   R/   t   header(    (    s&   code\common\utils\third_party\pyemf.pyt	   getBounds  s    c         C   sB   | | |  _  | | |  _ | |  _ | |  _ | |  _ | |  _ d S(   sU   Set the physical (i.e. stuff you could measure with a
        meterstick) dimensions.N(   R    R!   t
   frame_leftt	   frame_topt   frame_rightt   frame_bottom(   R/   t   leftt   topt   rightt   bottom(    (    s&   code\common\utils\third_party\pyemf.pyR"     s    			c         C   sB   | | |  _  | | |  _ | |  _ | |  _ | |  _ | |  _ d S(   s%   Set the pixel-addressable dimensions.N(   R#   R$   t   bounds_leftt
   bounds_topt   bounds_rightt   bounds_bottom(   R/   RG   RH   RI   RJ   (    (    s&   code\common\utils\third_party\pyemf.pyR%     s    			ic         C   s   t  |  j  } | d k rX | | k rH |  j d g | | d 7_ n  | |  j | <n> |  j r |  j j   } | |  j | <n | } |  j j |  | S(   sR   Add an object to the handle list, so it can be retrieved
        later or deleted.i    i   N(   t   lenR   R   R   t   popR   (   R/   t   emrt   handlet   count(    (    s&   code\common\utils\third_party\pyemf.pyt	   addObject  s    !	c         C   s   | d k  s! | t  |  j  k r0 t d   n  d |  j | <t } d } x] | t  |  j  k  r | |  j | k  r |  j j | |  Pn  | d 7} qL W|  j j |  d S(   ss   Remove an object by its handle.  Handles can be reused, and
        are reused from lowest available handle number.i   s   Invalid handlei    N(   RO   R   t
   IndexErrorR   t   FalseR   t   insertR   (   R/   RR   t   foundt   i(    (    s&   code\common\utils\third_party\pyemf.pyt   removeObject  s    !c         C   s   |  j  j   d S(   s2   Remove last object.  Used mainly in case of error.N(   R   RP   (   R/   (    (    s&   code\common\utils\third_party\pyemf.pyt	   popObject  s    (
   t   __name__t
   __module__t   __doc__R2   RB   R"   R%   RT   RZ   R[   (    (    (    s&   code\common\utils\third_party\pyemf.pyR   2  s   C		
	
	t   _EMR_FORMATc           B   s&   e  Z d    Z d d  Z d   Z RS(   c         C   sb   | |  _  | |  _ g  |  _ g  |  _ d |  _ d |  _ g  |  _ i  |  _ d |  _ |  j	 |  d  S(   Nt   <i    (
   t   typedeft   idt   fmtlistt   defaultst   fmtt
   structsizet   namest   namepost   debugt	   setFormat(   R/   t   emr_idRa   (    (    s&   code\common\utils\third_party\pyemf.pyR2     s    									c         C   s   |  j  r d t |  GHn  t | t  s9 t | t  r xi | D]I } t |  d k rj | \ } } } n | \ } } |  j | | |  q@ Wn | r t d   n  t j	 |  j
  |  _ |  j  r d |  j
 |  j |  j f GHn  d  S(   Ns
   typedef=%si   s   format must be a lists$   current struct=%s size=%d
  names=%s(   Ri   t   strR   R   R   RO   t   appendFormatt   AttributeErrort   structt   calcsizeRe   Rf   Rg   (   R/   Ra   t   defaultt   itemt   typecodet   name(    (    s&   code\common\utils\third_party\pyemf.pyRj     s    	 	 c         C   sY   |  j  | 7_  |  j j |  |  j j |  t |  j  |  j | <|  j j |  d  S(   N(   Re   Rc   R   Rd   RO   Rg   Rh   (   R/   Rs   Rt   Rq   (    (    s&   code\common\utils\third_party\pyemf.pyRm     s
    N(   R\   R]   R2   R   Rj   Rm   (    (    (    s&   code\common\utils\third_party\pyemf.pyR_     s   	t   _EMR_UNKNOWNc           B   s  e  Z d  Z d Z d Z d Z d Z d   Z d   Z	 d   Z
 d   Z d   Z d	   Z d
 d
 d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z RS(    s   baseclass for EMR objectsi    t    i   c         C   s   |  j  j |  _ d |  _ d |  _ d |  _ d  |  _ d  |  _ d |  _	 |  j  j
 d  k so |  j  j |  j
 j k r |  j r d |  j  j GHn  t |  j  j |  j  j  |  j  _
 n  t j |  j  j
 j  |  _ d |  _ d  S(   Ni    s   creating format for %d(   t	   __class__Rk   t   iTypet   nSizet   verboset   datasizeR   t   datat   unhandleddatat   zerofillt   formatt   emr_typedefRa   R_   t   copyRd   t   valuest   error(   R/   (    (    s&   code\common\utils\third_party\pyemf.pyR2     s    						*	 $c         C   s   t  j |  d  } y: | | j k rK t  j |  d  } | j | } | | SWn0 t k
 r~ t d | | t |  f   n Xt d |   d S(   s   Return EMR attribute if the name exists in the typedef list
        of the object.  This is only called when the standard
        attribute lookup fails on this object, so we don't have to
        handle the case where name is an actual attribute of self.R   R   s   name=%s index=%d values=%ss   %s not defined in EMR objectN(   Ru   t   __getattribute__Rg   Rh   RU   Rl   Rn   (   R/   Rt   t   ft   vt   index(    (    s&   code\common\utils\third_party\pyemf.pyt   __getattr__-  s    #c         C   s   t  j |  d  } yR | rV | | j k rV t  j |  d  } | j | } | | | <n | |  j | <Wn0 t k
 r t d | | t |  f   n Xd S(   sk   Set a value in the object, propagating through to
        self.values[] if the name is in the typedef list.R   R   s   name=%s index=%d values=%sN(   Ru   R   Rg   Rh   t   __dict__RU   Rl   (   R/   Rt   t   valueR   R   R   (    (    s&   code\common\utils\third_party\pyemf.pyt   __setattr__<  s    c         C   s   t  S(   s|   Return true if this object has a handle that needs to be
        saved in the object array for later recall by SelectObject.(   RV   (   R/   (    (    s&   code\common\utils\third_party\pyemf.pyt	   hasHandleK  s    c         C   s8   | d |  _  | d |  _ | d |  _ | d |  _ d S(   s   Set bounds of object.  Depends on naming convention always
        defining the bounding rectangle as
        rclBounds_[left|top|right|bottom].i    i   i   i   N(   R;   R<   R=   R>   (   R/   t   bounds(    (    s&   code\common\utils\third_party\pyemf.pyt	   setBoundsP  s    c         C   s   d S(   s3   Return bounds of object, or None if not applicable.N(   R   (   R/   (    (    s&   code\common\utils\third_party\pyemf.pyRB   Y  s    ic         C   sB  | d k r! | |  _  | |  _ n t j d d  \ |  _  |  _ |  j d k r>|  j d |  _ | j |  j  |  _ |  j j d k r	|  j j t	 |  j  k r |  j j t	 |  j  |  _
 |  j d |  j
 7_ n  t t j |  j j |  j d |  j j !  |  _ n  |  j |  j j k r>|  j |  j |  j j  q>n  d S(   s   Read data from the file object and, using the format
        structure defined by the subclass, parse the data and store it
        in self.values[] list.i    s   <iii   Rv   N(   Rx   Ry   Ro   t   unpackR{   t   readR|   R   Rf   RO   R~   R   Re   R   t   unserializeExtra(   R/   t   fht   itypet   nsize(    (    s&   code\common\utils\third_party\pyemf.pyt   unserialize]  s    	4c         C   s   | d |  j  j |  j S(   s   Adjust offset to point to correct location in extra data.
        Offsets in the EMR record are from the start of the record, so
        we must subtract 8 bytes for iType and nSize, and also
        subtract the size of the format structure.i   (   R   Rf   R~   (   R/   t   offset(    (    s&   code\common\utils\third_party\pyemf.pyt   unserializeOffsett  s    c         C   s   | |  _  d S(   sl   Hook for subclasses to handle extra data in the record that
        isn't specified by the format statement.N(   R}   (   R/   R|   (    (    s&   code\common\utils\third_party\pyemf.pyR   {  s    	c         C   sV   d | | f } t  j |  } t t  j | | | | | !  } | | 7} | | f S(   Ns   <%d%s(   Ro   Rp   R   R   (   R/   Re   RS   R|   t   startt   sizet   vals(    (    s&   code\common\utils\third_party\pyemf.pyt   unserializeList  s
    #
c   	      C   s   d d | | f } t  j |  } t  j | | | | | ! } g  t d t |  d  D] } | | | | d f ^ qY } | | 7} | | f S(   Ns   <%d%si   i    i   (   Ro   Rp   R   t   rangeRO   (	   R/   Re   RS   R|   R   R   R   RY   t   pairs(    (    s&   code\common\utils\third_party\pyemf.pyt   unserializePoints  s    =
c         C   s|   | j  t j d |  j |  j   y& | j  t j |  j j |  j   Wn  t j k
 rj d G|  GH  n X|  j	 |  d  S(   Ns   <iis   !!!!!Struct error:(
   t   writeRo   t   packRx   Ry   R   Re   R   R   t   serializeExtra(   R/   R   (    (    s&   code\common\utils\third_party\pyemf.pyt	   serialize  s    "&c         C   s   d |  j  j S(   ss   Return the initial offset for any extra data that must be
        written to the record.  See L{unserializeOffset}.i   (   R   Rf   (   R/   (    (    s&   code\common\utils\third_party\pyemf.pyt   serializeOffset  s    c         C   s    |  j  r | j |  j   n  d S(   s   This is for special cases, like writing text or lists.  If
        this is not overridden by a subclass method, it will write out
        anything in the self.unhandleddata string.N(   R}   R   (   R/   R   (    (    s&   code\common\utils\third_party\pyemf.pyR     s    	c         C   s8   d | } x' | D] } | j  t j | |   q Wd  S(   Ns   <%s(   R   Ro   R   (   R/   R   Re   R   t   val(    (    s&   code\common\utils\third_party\pyemf.pyt   serializeList  s    
c         C   sC   d | } x2 | D]* } | j  t j | | d | d   q Wd  S(   Ns   <2%si    i   (   R   Ro   R   (   R/   R   Re   R   t   pair(    (    s&   code\common\utils\third_party\pyemf.pyt   serializePoints  s    
c         C   sn   t  | t  r! | j d  } n  | j |  t t |   t |  } | d k rj | j d |  n  d  S(   Ns   utf-16lei    Rv   (   R   t   unicodet   encodeR   R   RO   (   R/   R   t   txtt   extra(    (    s&   code\common\utils\third_party\pyemf.pyt   serializeString  s    c         C   s   |  j  } d |  j j |  j   |  _  |  j rW | |  j  k rW d | |  j  f G|  GHn  |  j  d d k r} d GH|  GHt  n  d  S(   Ni   s   resize: before=%d after=%di   i    s#   size error.  Must be divisible by 4(   Ry   R   Rf   t	   sizeExtraRz   R   (   R/   t   before(    (    s&   code\common\utils\third_party\pyemf.pyt   resize  s    	c         C   s   |  j  r t |  j   Sd S(   s2  Hook for subclasses before anything is serialized.  This is
        used to return the size of any extra components not in the
        format string, and also provide the opportunity to recalculate
        any changes in size that should be reflected in self.nSize
        before the record is written out.i    (   R}   RO   (   R/   (    (    s&   code\common\utils\third_party\pyemf.pyR     s    	c         C   s   d S(   s5   Hook to print out extra data that isn't in the formatt    (    (   R/   (    (    s&   code\common\utils\third_party\pyemf.pyt	   str_extra  s    c         C   s%   d | d @| d @d ?| d @d ?f S(   Ns#   red=0x%02x green=0x%02x blue=0x%02xi   i   i   i   i   (    (   R/   R   (    (    s&   code\common\utils\third_party\pyemf.pyt	   str_color  s    c         C   sX   t  j |  |  } | j d  r3 |  j |  } n! | j d  rT | j d  } n  | S(   Nt   olort   ss   utf-16le(   Ru   R   t   endswithR   t   decode(   R/   Rs   Rt   R   (    (    s&   code\common\utils\third_party\pyemf.pyt
   str_decode  s    c         C   s   t    } |  j j r x} |  j j D]l } | d } | d } |  j | |  } y | j d | | f  Wq" t k
 r | j d |  q" Xq" Wn  | j |  j    | j   S(   Ni    i   s   	%-20s: %s
s!   	%-20s: <<<BAD UNICODE STRING>>>
(   R   R   Ra   R   R   t   UnicodeEncodeErrorR   t   getvalue(   R/   R   Rr   Rs   Rt   R   (    (    s&   code\common\utils\third_party\pyemf.pyt   str_details  s    	

c         C   sb   d } |  j    } | r$ t j } n  d |  j j j d  |  j |  j |  j j	 |  j j
 | | f S(   NR   s1   **%s: iType=%s nSize=%s  struct='%s' size=%d
%s%st   _(   R   t   ost   linesepRw   R\   t   lstripRx   Ry   R   Re   Rf   (   R/   t   rett   details(    (    s&   code\common\utils\third_party\pyemf.pyt   __str__  s    >(    Nt     (    R\   R]   R^   Rk   R   R   R   t   twobytepaddingR2   R   R   R   R   RB   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   (    (    (    s&   code\common\utils\third_party\pyemf.pyRu     s:   													
							
				t   _EMRc           B   s8  e  Z d  e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d e f d	     YZ d
 e f d     YZ d e f d     YZ	 d e	 f d     YZ
 d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d  e f d!     YZ d" e f d#     YZ d$ e f d%     YZ d& e f d'     YZ d( e f d)     YZ d* e f d+     YZ d, e f d-     YZ d. e f d/     YZ d0 e f d1     YZ d2 e f d3     YZ d4 e f d5     YZ d6 e f d7     YZ d8 e f d9     YZ d: e f d;     YZ  d< e f d=     YZ! d> e f d?     YZ" d@ e f dA     YZ# dB e f dC     YZ$ dD e" f dE     YZ% dF e f dG     YZ& dH e f dI     YZ' dJ e' f dK     YZ( dL e f dM     YZ) dN e f dO     YZ* dP e* f dQ     YZ+ dR e* f dS     YZ, dT e f dU     YZ- dV e f dW     YZ. dX e f dY     YZ/ dZ e* f d[     YZ0 d\ e f d]     YZ1 d^ e f d_     YZ2 d` e f da     YZ3 db e f dc     YZ4 dd e f de     YZ5 df e5 f dg     YZ6 dh e5 f di     YZ7 dj e f dk     YZ8 dl e f dm     YZ9 dn e f do     YZ: dp e f dq     YZ; dr e f ds     YZ< dt e f du     YZ= dv e f dw     YZ> dx e> f dy     YZ? dz e f d{     YZ@ d| e@ f d}     YZA d~ e@ f d     YZB d e f d     YZC d eC f d     YZD d e	 f d     YZE d eE f d     YZF d e. f d     YZG d e. f d     YZH d e. f d     YZI d e f d     YZJ RS(   t   _HEADERc           B   s   e  Z d  Z d Z d, d- d. d/ d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 d: d; d< d= d> d? d@ dA dB dC dD dE g Z d% d&  Z d'   Z d(   Z d)   Z d*   Z	 d+   Z
 RS(F   s   Header has different fields depending on the version of
        windows.  Also note that if offDescription==0, there is no
        description string.i   RY   R;   R<   R=   R>   R3   R4   R5   R6   t
   dSignaturei EMFt   nVersioni   t   nBytesi    t   nRecordst   ht   nHandlest	   sReservedt   nDescriptiont   offDescriptiont   nPalEntriesR?   i   R@   i   R9   i@  R:   i   t   cbPixelFormatt   offPixelFormatt   bOpenGLR7   R8   R   c         C   s~   t  j |   t | t  r1 | j d  |  _ n  t |  d k rh d t j d  d | d |  _ n  t |  j  |  _ d  S(   Ns   utf-8i    u   pyemf u    u     (	   Ru   R2   R   Rl   R   t   descriptionRO   t   __version__R   (   R/   R   (    (    s&   code\common\utils\third_party\pyemf.pyR2     s    %c         C   s   |  j  r d t |  GHn  |  j d k r |  j |  j  } | | | d |  j !} | j d  |  _ |  j  r d |  j GHq n  d  S(   Ns   found %d extra bytes.i    i   s   utf-16les   str: %s(   Rz   RO   R   R   R   R   R   (   R/   R|   R   R   (    (    s&   code\common\utils\third_party\pyemf.pyR   /  s    	 	 c         C   sV   t    } | j d t |  j   | j d t j d |  j j d    | j   S(   Ns   	unicode string: %s
s   %s
t   16ss   utf-16le(   R   R   Rl   R   Ro   R   R   R   (   R/   R   (    (    s&   code\common\utils\third_party\pyemf.pyR   <  s    	)c         C   s   | j  |  _ | j |  _ | j |  _ | j |  _ | j |  _	 | j
 |  _ | j |  _ | j |  _ | r | j |  _ | j |  _ | j d |  _ | j d |  _ n8 | j |  _ | j |  _ | j d |  _ | j d |  _ |  j d |  _ |  j d |  _ d  S(   Ni
   i  (   RK   R;   RL   R<   RM   R=   RN   R>   RC   R3   RD   R4   RE   R5   RF   R6   R#   R?   R$   R@   R    R7   R!   R8   R   R   R   R   R9   R:   (   R/   t   dct   scaleheader(    (    s&   code\common\utils\third_party\pyemf.pyR   B  s&    c         C   s   |  j  d k r2 |  j d |  _  |  j d |  _ n  t |  j  |  _ |  j d k re |  j   |  _ n	 d |  _ t	 |  j d  } | S(   Ni    i  i   (
   R7   R9   R:   R8   RO   R   R   R   R   R   (   R/   t
   sizestring(    (    s&   code\common\utils\third_party\pyemf.pyR   ]  s    	c         C   s   |  j  | |  j  d  S(   N(   R   R   (   R/   R   (    (    s&   code\common\utils\third_party\pyemf.pyR   k  s    (   RY   s   rclBounds_left(   RY   s   rclBounds_top(   RY   s   rclBounds_right(   RY   s   rclBounds_bottom(   RY   s   rclFrame_left(   RY   s   rclFrame_top(   RY   s   rclFrame_right(   RY   s   rclFrame_bottom(   RY   R   i EMF(   RY   R   i   (   RY   s   nBytesi    (   RY   s   nRecordsi    (   R   s   nHandlesi    (   R   R   i    (   RY   s   nDescriptioni    (   RY   s   offDescriptioni    (   RY   R   i    (   RY   s   szlDevice_cxi   (   RY   s   szlDevice_cyi   (   RY   s   szlMillimeters_cxi@  (   RY   s   szlMillimeters_cyi   (   RY   R   i    (   RY   R   i    (   RY   R   i    (   RY   s   szlMicrometers_cx(   RY   s   szlMicrometers_cy(   R\   R]   R^   Rk   R   R2   R   R   R   R   R   (    (    (    s&   code\common\utils\third_party\pyemf.pyR     sD   					t   _POLYBEZIERc           B   s\   e  Z d  Z d d d d d g Z d Z g  d d  Z d	   Z d
   Z d   Z d   Z	 RS(   i   RY   R;   R<   R=   R>   t   cptli    c         C   s6   t  j |   |  j |  t |  |  _ | |  _ d  S(   N(   Ru   R2   R   RO   R   t   aptl(   R/   t   pointsR   (    (    s&   code\common\utils\third_party\pyemf.pyR2   y  s    c         C   s1   d } |  j  |  j |  j | |  \ } |  _ d  S(   Ni    (   R   t   emr_point_typeR   R   (   R/   R|   R   (    (    s&   code\common\utils\third_party\pyemf.pyR     s    c         C   s   t  j |  j  d |  j S(   Ni   (   Ro   Rp   R   R   (   R/   (    (    s&   code\common\utils\third_party\pyemf.pyR     s    c         C   s   |  j  | |  j |  j  d  S(   N(   R   R   R   (   R/   R   (    (    s&   code\common\utils\third_party\pyemf.pyR     s    c         C   s3   t    } d } | j d t |  j   | j   S(   Ni    s   	points: %s
(   R   R   Rl   R   R   (   R/   R   R   (    (    s&   code\common\utils\third_party\pyemf.pyR     s    	(   RY   s   rclBounds_left(   RY   s   rclBounds_top(   RY   s   rclBounds_right(   RY   s   rclBounds_bottom(   RY   s   cptl(   i    i    i    i    (
   R\   R]   Rk   R   R   R2   R   R   R   R   (    (    (    s&   code\common\utils\third_party\pyemf.pyR   p  s   				t   _POLYGONc           B   s   e  Z d  Z RS(   i   (   R\   R]   Rk   (    (    (    s&   code\common\utils\third_party\pyemf.pyR     s   t	   _POLYLINEc           B   s   e  Z d  Z RS(   i   (   R\   R]   Rk   (    (    (    s&   code\common\utils\third_party\pyemf.pyR     s   t   _POLYBEZIERTOc           B   s   e  Z d  Z d   Z RS(   i   c         C   s   |  j  |  j |  j |  j f S(   N(   R;   R<   R=   R>   (   R/   (    (    s&   code\common\utils\third_party\pyemf.pyRB     s    (   R\   R]   Rk   RB   (    (    (    s&   code\common\utils\third_party\pyemf.pyR     s   t   _POLYLINETOc           B   s   e  Z d  Z RS(   i   (   R\   R]   Rk   (    (    (    s&   code\common\utils\third_party\pyemf.pyR     s   t   _POLYPOLYLINEc           B   sb   e  Z d  Z d d d d d d g Z d Z g  g  d d	  Z d
   Z d   Z d   Z d   Z	 RS(   i   RY   R;   R<   R=   R>   t   nPolysR   i    c         C   sN   t  j |   |  j |  t |  |  _ | |  _ t |  |  _ | |  _ d  S(   N(   Ru   R2   R   RO   R   R   R   t   aPolyCounts(   R/   R   t
   polycountsR   (    (    s&   code\common\utils\third_party\pyemf.pyR2     s    	c         C   sU   d } |  j  d |  j | |  \ } |  _ |  j |  j |  j | |  \ } |  _ d  S(   Ni    RY   (   R   R   R   R   R   R   R   (   R/   R|   R   (    (    s&   code\common\utils\third_party\pyemf.pyR     s    $c         C   s/   t  j d  |  j t  j |  j  d |  j S(   NRY   i   (   Ro   Rp   R   R   R   (   R/   (    (    s&   code\common\utils\third_party\pyemf.pyR     s    c         C   s3   |  j  | d |  j  |  j | |  j |  j  d  S(   NRY   (   R   R   R   R   R   (   R/   R   (    (    s&   code\common\utils\third_party\pyemf.pyR     s    c      	   C   s   t    } d } xr t |  j  D]a } | j d | |  j | f  | j d t |  j | | |  j | !  | |  j | 7} q W| j   S(   Ni    s   	Polygon %d: %d points
s   		%s
(   R   R   R   R   R   Rl   R   R   (   R/   R   R   t   n(    (    s&   code\common\utils\third_party\pyemf.pyR     s    	,(   RY   s   rclBounds_left(   RY   s   rclBounds_top(   RY   s   rclBounds_right(   RY   s   rclBounds_bottom(   RY   s   nPolys(   RY   s   cptl(   i    i    i    i    (
   R\   R]   Rk   R   R   R2   R   R   R   R   (    (    (    s&   code\common\utils\third_party\pyemf.pyR     s   		
		t   _POLYPOLYGONc           B   s   e  Z d  Z RS(   i   (   R\   R]   Rk   (    (    (    s&   code\common\utils\third_party\pyemf.pyR     s   t   _SETWINDOWEXTEXc           B   s)   e  Z d  Z d d g Z d d d  Z RS(   i	   RY   t   szlExtent_cxt   szlExtent_cyi    c         C   s#   t  j |   | |  _ | |  _ d  S(   N(   Ru   R2   R   R   (   R/   t   cxt   cy(    (    s&   code\common\utils\third_party\pyemf.pyR2     s    	(   RY   s   szlExtent_cx(   RY   s   szlExtent_cy(   R\   R]   Rk   R   R2   (    (    (    s&   code\common\utils\third_party\pyemf.pyR     s   	t   _SETWINDOWORGEXc           B   s)   e  Z d  Z d d g Z d d d  Z RS(   i
   RY   t   ptlOrigin_xt   ptlOrigin_yi    c         C   s#   t  j |   | |  _ | |  _ d  S(   N(   Ru   R2   R   R   (   R/   R   R   (    (    s&   code\common\utils\third_party\pyemf.pyR2     s    	(   RY   s   ptlOrigin_x(   RY   s   ptlOrigin_y(   R\   R]   Rk   R   R2   (    (    (    s&   code\common\utils\third_party\pyemf.pyR     s   	t   _SETVIEWPORTEXTEXc           B   s   e  Z d  Z RS(   i   (   R\   R]   Rk   (    (    (    s&   code\common\utils\third_party\pyemf.pyR     s   t   _SETVIEWPORTORGEXc           B   s   e  Z d  Z RS(   i   (   R\   R]   Rk   (    (    (    s&   code\common\utils\third_party\pyemf.pyR     s   t   _SETBRUSHORGEXc           B   s   e  Z d  Z RS(   i   (   R\   R]   Rk   (    (    (    s&   code\common\utils\third_party\pyemf.pyR     s   t   _EOFc           B   s,   e  Z d  Z d Z d d	 d
 g Z d   Z RS(   s   End of file marker.  Usually 20 bytes long, but I have a
        Windows generated .emf file that only has a 12 byte long EOF
        record.  I don't know if that's a broken example or what, but
        both Windows progs and OpenOffice seem to handle it.i   RY   R   i    t   offPalEntriest	   nSizeLastc         C   s   t  j |   d  S(   N(   Ru   R2   (   R/   (    (    s&   code\common\utils\third_party\pyemf.pyR2     s    (   RY   s   nPalEntriesi    (   RY   R   i    (   RY   R   i    (   R\   R]   R^   Rk   R   R2   (    (    (    s&   code\common\utils\third_party\pyemf.pyR     s   	t
   _SETPIXELVc           B   s/   e  Z d  Z d d d	 g Z d d d d  Z RS(
   i   RY   t
   ptlPixel_xt
   ptlPixel_yt   crColori    c         C   s,   t  j |   | |  _ | |  _ | |  _ d  S(   N(   Ru   R2   R   R   R   (   R/   R   R   t   color(    (    s&   code\common\utils\third_party\pyemf.pyR2     s    		(   RY   s
   ptlPixel_x(   RY   s
   ptlPixel_y(   RY   s   crColor(   R\   R]   Rk   R   R2   (    (    (    s&   code\common\utils\third_party\pyemf.pyR     s
   	t   _SETMAPPERFLAGSc           B   s    e  Z d  Z d g Z d   Z RS(   i   RY   t   dwFlagsi    c         C   s   t  j |   d  S(   N(   Ru   R2   (   R/   (    (    s&   code\common\utils\third_party\pyemf.pyR2   $  s    (   RY   R   i    (   R\   R]   Rk   t
   emr_formatR2   (    (    (    s&   code\common\utils\third_party\pyemf.pyR      s   	t   _SETMAPMODEc           B   s2   e  Z d  Z d d e f g Z e d e d  Z RS(   i   RY   t   iModei    c         C   s>   t  j |   | | k  s% | | k r1 d |  _ n	 | |  _ d  S(   Ni   (   Ru   R2   R   R   (   R/   t   modet   firstt   last(    (    s&   code\common\utils\third_party\pyemf.pyR2   ,  s    (   R\   R]   Rk   t   MM_ANISOTROPICR   t   MM_MAXR2   (    (    (    s&   code\common\utils\third_party\pyemf.pyR   (  s   t
   _SETBKMODEc           B   s   e  Z d  Z e d  Z RS(   i   c         C   s   t  j j |  | d t d  S(   NR  (   R   R   R2   t   BKMODE_LAST(   R/   R   (    (    s&   code\common\utils\third_party\pyemf.pyR2   5  s    (   R\   R]   Rk   t   OPAQUER2   (    (    (    s&   code\common\utils\third_party\pyemf.pyR  3  s   t   _SETPOLYFILLMODEc           B   s   e  Z d  Z e d  Z RS(   i   c         C   s   t  j j |  | d t d  S(   NR  (   R   R   R2   t   POLYFILL_LAST(   R/   R   (    (    s&   code\common\utils\third_party\pyemf.pyR2   ;  s    (   R\   R]   Rk   t	   ALTERNATER2   (    (    (    s&   code\common\utils\third_party\pyemf.pyR  9  s   t   _SETROP2c           B   s   e  Z d  Z RS(   i   (   R\   R]   Rk   (    (    (    s&   code\common\utils\third_party\pyemf.pyR  ?  s   t   _SETSTRETCHBLTMODEc           B   s   e  Z d  Z RS(   i   (   R\   R]   Rk   (    (    (    s&   code\common\utils\third_party\pyemf.pyR  D  s   t   _SETTEXTALIGNc           B   s   e  Z d  Z e d  Z RS(   i   c         C   s   t  j j |  | d t d  S(   NR  (   R   R   R2   t   TA_MASK(   R/   R   (    (    s&   code\common\utils\third_party\pyemf.pyR2   K  s    (   R\   R]   Rk   t   TA_BASELINER2   (    (    (    s&   code\common\utils\third_party\pyemf.pyR  I  s   t   _SETTEXTCOLORc           B   s#   e  Z d  Z d g Z d d  Z RS(   i   RY   R   i    c         C   s   t  j |   | |  _ d  S(   N(   Ru   R2   R   (   R/   R   (    (    s&   code\common\utils\third_party\pyemf.pyR2   U  s    (   RY   s   crColori    (   R\   R]   Rk   R   R2   (    (    (    s&   code\common\utils\third_party\pyemf.pyR  Q  s   	t   _SETBKCOLORc           B   s   e  Z d  Z RS(   i   (   R\   R]   Rk   (    (    (    s&   code\common\utils\third_party\pyemf.pyR  Z  s   t	   _MOVETOEXc           B   s2   e  Z d  Z d d g Z d d d  Z d   Z RS(	   i   RY   t   ptl_xt   ptl_yi    c         C   s#   t  j |   | |  _ | |  _ d  S(   N(   Ru   R2   R  R  (   R/   R   R   (    (    s&   code\common\utils\third_party\pyemf.pyR2   h  s    	c         C   s   |  j  |  j |  j  |  j f S(   N(   R  R  (   R/   (    (    s&   code\common\utils\third_party\pyemf.pyRB   m  s    (   RY   s   ptl_x(   RY   s   ptl_y(   R\   R]   Rk   R   R2   RB   (    (    (    s&   code\common\utils\third_party\pyemf.pyR  b  s
   	t   _SCALEVIEWPORTEXTEXc           B   s5   e  Z d  Z d d	 d
 d g Z d d d d d  Z RS(   i   RY   t   xNumi   t   xDenomt   yNumt   yDenomc         C   s5   t  j |   | |  _ | |  _ | |  _ | |  _ d  S(   N(   Ru   R2   R  R  R  R  (   R/   t   xnt   xdt   ynt   yd(    (    s&   code\common\utils\third_party\pyemf.pyR2   }  s
    			(   RY   s   xNumi   (   RY   s   xDenomi   (   RY   s   yNumi   (   RY   s   yDenomi   (   R\   R]   Rk   R   R2   (    (    (    s&   code\common\utils\third_party\pyemf.pyR  u  s   	t   _SCALEWINDOWEXTEXc           B   s   e  Z d  Z RS(   i    (   R\   R]   Rk   (    (    (    s&   code\common\utils\third_party\pyemf.pyR    s   t   _SAVEDCc           B   s   e  Z d  Z RS(   i!   (   R\   R]   Rk   (    (    (    s&   code\common\utils\third_party\pyemf.pyR    s   t
   _RESTOREDCc           B   s#   e  Z d  Z d g Z d d  Z RS(   i"   RY   t	   iRelativeic         C   s   t  j |   | |  _ d  S(   N(   Ru   R2   R!  (   R/   t   rel(    (    s&   code\common\utils\third_party\pyemf.pyR2     s    (   RY   s	   iRelative(   R\   R]   Rk   R   R2   (    (    (    s&   code\common\utils\third_party\pyemf.pyR     s   	t   _SETWORLDTRANSFORMc           B   sA   e  Z d  Z d d d d d d g Z d d	 d	 d d	 d	 d
  Z RS(   i#   R   t   eM11t   eM12t   eM21t   eM22t   eDxt   eDyg      ?g        c         C   sG   t  j |   | |  _ | |  _ | |  _ | |  _ | |  _ | |  _ d  S(   N(   Ru   R2   R$  R%  R&  R'  R(  R)  (   R/   t   em11t   em12t   em21t   em22t   edxt   edy(    (    s&   code\common\utils\third_party\pyemf.pyR2     s    					(   R   s   eM11(   R   s   eM12(   R   s   eM21(   R   s   eM22(   R   s   eDx(   R   s   eDy(   R\   R]   Rk   R   R2   (    (    (    s&   code\common\utils\third_party\pyemf.pyR#    s   	t   _MODIFYWORLDTRANSFORMc           B   sG   e  Z d  Z d d d d d d d g Z d
 d d d
 d d e d  Z RS(   i$   R   R$  R%  R&  R'  R(  R)  RY   R   g      ?g        c         C   sP   t  j |   | |  _ | |  _ | |  _ | |  _ | |  _ | |  _ | |  _ d  S(   N(	   Ru   R2   R$  R%  R&  R'  R(  R)  R   (   R/   R*  R+  R,  R-  R.  R/  R   (    (    s&   code\common\utils\third_party\pyemf.pyR2     s    						(   R   s   eM11(   R   s   eM12(   R   s   eM21(   R   s   eM22(   R   s   eDx(   R   s   eDy(   RY   s   iMode(   R\   R]   Rk   R   t   MWT_IDENTITYR2   (    (    (    s&   code\common\utils\third_party\pyemf.pyR0    s   	t   _SELECTOBJECTc           B   s,   e  Z d  Z d Z d g Z d d d  Z RS(   s!  Select a brush, pen, font (or bitmap or region but there is
        no current user interface for those) object to be current and
        replace the previous item of that class.  Note that stock
        objects have their high order bit set, so the handle must be
        an unsigned int.i%   t   IRR   i    c         C   s   t  j |   | |  _ d  S(   N(   Ru   R2   RR   (   R/   R   RR   (    (    s&   code\common\utils\third_party\pyemf.pyR2     s    (   R3  s   handleN(   R\   R]   R^   Rk   R   R   R2   (    (    (    s&   code\common\utils\third_party\pyemf.pyR2    s   	t
   _CREATEPENc           B   s>   e  Z d  Z d d d d d g Z e d d d	  Z d
   Z RS(   i&   RY   RR   i    t
   lopn_stylet
   lopn_widtht   lopn_unusedt
   lopn_colori   c         C   s,   t  j |   | |  _ | |  _ | |  _ d  S(   N(   Ru   R2   R5  R6  R8  (   R/   t   styleR    R   (    (    s&   code\common\utils\third_party\pyemf.pyR2     s    		c         C   s   t  S(   N(   t   True(   R/   (    (    s&   code\common\utils\third_party\pyemf.pyR     s    (   RY   s   handlei    (   RY   s
   lopn_style(   RY   s
   lopn_width(   RY   R7  i    (   RY   s
   lopn_color(   R\   R]   Rk   R   t   PS_SOLIDR2   R   (    (    (    s&   code\common\utils\third_party\pyemf.pyR4    s   	t   _CREATEBRUSHINDIRECTc           B   s;   e  Z d  Z d
 d d d g Z e e d d  Z d	   Z RS(   i'   RY   RR   i    R3  t   lbStylet   lbColort   lbHatchc         C   s,   t  j |   | |  _ | |  _ | |  _ d  S(   N(   Ru   R2   R=  R>  R?  (   R/   R9  t   hatchR   (    (    s&   code\common\utils\third_party\pyemf.pyR2     s    		c         C   s   t  S(   N(   R:  (   R/   (    (    s&   code\common\utils\third_party\pyemf.pyR     s    (   RY   s   handlei    (   R3  s   lbStyle(   RY   s   lbColor(   R3  s   lbHatch(   R\   R]   Rk   R   t   BS_SOLIDt   HS_HORIZONTALR2   R   (    (    (    s&   code\common\utils\third_party\pyemf.pyR<    s   	t   _DELETEOBJECTc           B   s   e  Z d  Z RS(   i(   (   R\   R]   Rk   (    (    (    s&   code\common\utils\third_party\pyemf.pyRC    s   t	   _ANGLEARCc           B   s,   e  Z d  Z d	 d
 d d d g Z d   Z RS(   i)   RY   t   ptlCenter_xt   ptlCenter_yt   nRadiusR   t   eStartAnglet   eSweepAnglec         C   s   t  j |   d  S(   N(   Ru   R2   (   R/   (    (    s&   code\common\utils\third_party\pyemf.pyR2     s    (   RY   RE  (   RY   RF  (   RY   RG  (   R   RH  (   R   RI  (   R\   R]   Rk   R   R2   (    (    (    s&   code\common\utils\third_party\pyemf.pyRD    s   	t   _ELLIPSEc           B   s,   e  Z d  Z d d	 d
 d g Z d d  Z RS(   i*   RY   t   rclBox_leftt
   rclBox_topt   rclBox_rightt   rclBox_bottomi    c         C   sE   t  j |   | d |  _ | d |  _ | d |  _ | d |  _ d  S(   Ni    i   i   i   (   Ru   R2   RK  RL  RM  RN  (   R/   t   box(    (    s&   code\common\utils\third_party\pyemf.pyR2     s
    (   RY   s   rclBox_left(   RY   s
   rclBox_top(   RY   s   rclBox_right(   RY   s   rclBox_bottom(   i    i    i    i    (   R\   R]   Rk   R   R2   (    (    (    s&   code\common\utils\third_party\pyemf.pyRJ    s   	t
   _RECTANGLEc           B   s   e  Z d  Z RS(   i+   (   R\   R]   Rk   (    (    (    s&   code\common\utils\third_party\pyemf.pyRP    s   t
   _ROUNDRECTc           B   s8   e  Z d  Z d
 d d d d d g Z d d d d	  Z RS(   i,   RY   RK  RL  RM  RN  t   szlCorner_cxt   szlCorner_cyi    c         C   sW   t  j |   | d |  _ | d |  _ | d |  _ | d |  _ | |  _ | |  _ d  S(   Ni    i   i   i   (   Ru   R2   RK  RL  RM  RN  RR  RS  (   R/   RO  R   R   (    (    s&   code\common\utils\third_party\pyemf.pyR2   %  s    	(   RY   s   rclBox_left(   RY   s
   rclBox_top(   RY   s   rclBox_right(   RY   s   rclBox_bottom(   RY   s   szlCorner_cx(   RY   s   szlCorner_cy(   i    i    i    i    (   R\   R]   Rk   R   R2   (    (    (    s&   code\common\utils\third_party\pyemf.pyRQ    s   	t   _ARCc        	   B   sM   e  Z d  Z d d d d d d d d g Z d
 d
 d
 d
 d
 d
 d
 d
 d  Z RS(   i-   RY   RK  RL  RM  RN  t
   ptlStart_xt
   ptlStart_yt   ptlEnd_xt   ptlEnd_yi    c	   	      C   sY   t  j |   | |  _ | |  _ | |  _ | |  _ | |  _ | |  _ | |  _ | |  _	 d  S(   N(
   Ru   R2   RK  RL  RM  RN  RU  RV  RW  RX  (	   R/   RG   RH   RI   RJ   t   xstartt   ystartt   xendt   yend(    (    s&   code\common\utils\third_party\pyemf.pyR2   ;  s    							(   RY   s   rclBox_left(   RY   s
   rclBox_top(   RY   s   rclBox_right(   RY   s   rclBox_bottom(   RY   s
   ptlStart_x(   RY   s
   ptlStart_y(   RY   s   ptlEnd_x(   RY   s   ptlEnd_y(   R\   R]   Rk   R   R2   (    (    (    s&   code\common\utils\third_party\pyemf.pyRT  /  s   	t   _CHORDc           B   s   e  Z d  Z RS(   i.   (   R\   R]   Rk   (    (    (    s&   code\common\utils\third_party\pyemf.pyR]  H  s   t   _PIEc           B   s   e  Z d  Z RS(   i/   (   R\   R]   Rk   (    (    (    s&   code\common\utils\third_party\pyemf.pyR^  M  s   t   _SELECTPALETTEc           B   s    e  Z d  Z d g Z d   Z RS(   i0   RY   RR   c         C   s   t  j |   d  S(   N(   Ru   R2   (   R/   (    (    s&   code\common\utils\third_party\pyemf.pyR2   V  s    (   RY   s   handle(   R\   R]   Rk   R   R2   (    (    (    s&   code\common\utils\third_party\pyemf.pyR_  R  s   	t   _CREATEPALETTEc           B   s)   e  Z d  Z d g Z d   Z d   Z RS(   i1   RY   RR   i    c         C   s   t  j |   d  S(   N(   Ru   R2   (   R/   (    (    s&   code\common\utils\third_party\pyemf.pyR2   _  s    c         C   s   t  S(   N(   R:  (   R/   (    (    s&   code\common\utils\third_party\pyemf.pyR   b  s    (   RY   s   handlei    (   R\   R]   Rk   R   R2   R   (    (    (    s&   code\common\utils\third_party\pyemf.pyR`  [  s   		t   _LINETOc           B   s   e  Z d  Z RS(   i6   (   R\   R]   Rk   (    (    (    s&   code\common\utils\third_party\pyemf.pyRa  l  s   t   _ARCTOc           B   s   e  Z d  Z d   Z RS(   i7   c         C   s   |  j  |  j |  j |  j f S(   N(   RK  RL  RM  RN  (   R/   (    (    s&   code\common\utils\third_party\pyemf.pyRB   t  s    (   R\   R]   Rk   RB   (    (    (    s&   code\common\utils\third_party\pyemf.pyRb  q  s   t   _SETARCDIRECTIONc           B   s    e  Z d  Z d g Z d   Z RS(   i9   RY   t   iArcDirectionc         C   s   t  j |   d  S(   N(   Ru   R2   (   R/   (    (    s&   code\common\utils\third_party\pyemf.pyR2     s    (   RY   Rd  (   R\   R]   Rk   R   R2   (    (    (    s&   code\common\utils\third_party\pyemf.pyRc    s   	t
   _BEGINPATHc           B   s   e  Z d  Z RS(   i;   (   R\   R]   Rk   (    (    (    s&   code\common\utils\third_party\pyemf.pyRe    s   t   _ENDPATHc           B   s   e  Z d  Z RS(   i<   (   R\   R]   Rk   (    (    (    s&   code\common\utils\third_party\pyemf.pyRf    s   t   _CLOSEFIGUREc           B   s   e  Z d  Z RS(   i=   (   R\   R]   Rk   (    (    (    s&   code\common\utils\third_party\pyemf.pyRg    s   t	   _FILLPATHc           B   s,   e  Z d  Z d d	 d
 d g Z d d  Z RS(   i>   RY   R;   R<   R=   R>   i    c         C   s   t  j |   |  j |  d  S(   N(   Ru   R2   R   (   R/   R   (    (    s&   code\common\utils\third_party\pyemf.pyR2     s    (   RY   s   rclBounds_left(   RY   s   rclBounds_top(   RY   s   rclBounds_right(   RY   s   rclBounds_bottom(   i    i    i    i    (   R\   R]   Rk   R   R2   (    (    (    s&   code\common\utils\third_party\pyemf.pyRh    s   	t   _STROKEANDFILLPATHc           B   s   e  Z d  Z RS(   i?   (   R\   R]   Rk   (    (    (    s&   code\common\utils\third_party\pyemf.pyRi    s   t   _STROKEPATHc           B   s   e  Z d  Z RS(   i@   (   R\   R]   Rk   (    (    (    s&   code\common\utils\third_party\pyemf.pyRj    s   t   _FLATTENPATHc           B   s   e  Z d  Z RS(   iA   (   R\   R]   Rk   (    (    (    s&   code\common\utils\third_party\pyemf.pyRk    s   t
   _WIDENPATHc           B   s   e  Z d  Z RS(   iB   (   R\   R]   Rk   (    (    (    s&   code\common\utils\third_party\pyemf.pyRl    s   t   _SELECTCLIPPATHc           B   s    e  Z d  Z d Z e d  Z RS(   s~   Select the current path and make it the clipping region.
        Must be a closed path.

        @gdi: SelectClipPath
        iC   c         C   s#   t  j j |  | d t d t d  S(   NR  R  (   R   R   R2   t   RGN_MINt   RGN_MAX(   R/   R   (    (    s&   code\common\utils\third_party\pyemf.pyR2     s    (   R\   R]   R^   Rk   t   RGN_COPYR2   (    (    (    s&   code\common\utils\third_party\pyemf.pyRm    s   t
   _ABORTPATHc           B   s   e  Z d  Z d Z RS(   sK   Discards any current path, whether open or closed.

        @gdi: AbortPathiD   (   R\   R]   R^   Rk   (    (    (    s&   code\common\utils\third_party\pyemf.pyRq    s   t   _STRETCHDIBITSc           B   sY   e  Z d  Z d Z d d d d d d d d d d d  d! d" d# d$ d% d& d' g Z d   Z RS((   s   Copies the image from the source image to the destination
        image.  DIB is currently an opaque format to me, but
        apparently it has been extented recently to allow JPG and PNG
        images...

        @gdi: StretchDIBits
        iQ   RY   R;   R<   R=   R>   t   xDestt   yDestt   xSrct   ySrct   cxSrct   cySrct	   offBmiSrct   cbBmiSrct
   offBitsSrct	   cbBitsSrct	   iUsageSrct   dwRopt   cxDestt   cyDestc         C   s   t  j |   d  S(   N(   Ru   R2   (   R/   (    (    s&   code\common\utils\third_party\pyemf.pyR2     s    (   RY   s   rclBounds_left(   RY   s   rclBounds_top(   RY   s   rclBounds_right(   RY   s   rclBounds_bottom(   RY   s   xDest(   RY   s   yDest(   RY   s   xSrc(   RY   s   ySrc(   RY   s   cxSrc(   RY   s   cySrc(   RY   s	   offBmiSrc(   RY   s   cbBmiSrc(   RY   s
   offBitsSrc(   RY   s	   cbBitsSrc(   RY   s	   iUsageSrc(   RY   s   dwRop(   RY   s   cxDest(   RY   s   cyDest(   R\   R]   R^   Rk   R   R2   (    (    (    s&   code\common\utils\third_party\pyemf.pyRr    s*   	t   _EXTCREATEFONTINDIRECTWc        #   B   s   e  Z d  Z d. d/ d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 d: d; d< d d d d f d d d d f d= d> d? d@ dA dB dC dD dE dF dG dH dI dJ dK dL g! Z d d d d e d d d e e e e e	 e
 Bd+ d,  Z d-   Z RS(M   iR   RY   RR   t   lfHeightt   lfWidtht   lfEscapementt   lfOrientationt   lfWeightt   Bt   lfItalict   lfUnderlinet   lfStrikeOutt	   lfCharSett   lfOutPrecisiont   lfClipPrecisiont	   lfQualityt   lfPitchAndFamilyt   64st
   lfFaceNamet   128st   elfFullNameRv   i   t   elfStylei@   t
   elfVersioni    t   elfStyleSizet   elfMatcht   elfReservedt   elfVendorIdt
   elfCulturet   elfPanose_bFamilyTypei   t   elfPanose_bSerifStylet   elfPanose_bWeightt   elfPanose_bProportiont   elfPanose_bContrastt   elfPanose_bStrokeVariationt   elfPanose_bArmStylet   elfPanose_bLetterformt   elfPanose_bMidlinet   elfPanose_bXHeights   Times New Romanc         C   s   t  j |   | |  _ | |  _ | |  _ | |  _ | |  _ | |  _ | |  _ | |  _	 |	 |  _
 |
 |  _ | |  _ | |  _ | |  _ t  j |  _ t |  d k r | d d !} n | d d t |  7} | j d  j d  |  _ d  S(   Ni    i    Rv   s   utf-8s   utf-16le(   Ru   R2   R  R  R  R  R  R  R  R  R  R  R  R  R  R   R}   RO   R   R   R  (   R/   R!   R    t
   escapementt   orientationt   weightt   italict	   underlinet
   strike_outt   charsett   out_precisiont   clip_precisiont   qualityt   pitch_familyRt   (    (    s&   code\common\utils\third_party\pyemf.pyR2   "  s&    													c         C   s   t  S(   N(   R:  (   R/   (    (    s&   code\common\utils\third_party\pyemf.pyR   B  s    (   RY   s   handle(   RY   s   lfHeight(   RY   s   lfWidth(   RY   s   lfEscapement(   RY   s   lfOrientation(   RY   s   lfWeight(   R  s   lfItalic(   R  s   lfUnderline(   R  s   lfStrikeOut(   R  s	   lfCharSet(   R  s   lfOutPrecision(   R  s   lfClipPrecision(   R  s	   lfQuality(   R  s   lfPitchAndFamily(   R  s
   lfFaceName(   RY   R  i    (   RY   R  i    (   RY   R  i    (   RY   R  i    (   RY   R  i    (   RY   R  i    (   R  R  i   (   R  R  i   (   R  R  i   (   R  R  i   (   R  R  i   (   R  R  i   (   R  R  i   (   R  R  i   (   R  R  i   (   R  R  i   (   R\   R]   Rk   R   t	   FW_NORMALt   ANSI_CHARSETt   OUT_DEFAULT_PRECISt   CLIP_DEFAULT_PRECISt   DEFAULT_QUALITYt   DEFAULT_PITCHt   FF_DONTCARER2   R   (    (    (    s&   code\common\utils\third_party\pyemf.pyR    sR   	t   _EXTTEXTOUTAc           B   s   e  Z d  Z d d d d  d d e f d! d" d# d$ d% d& d' d( d) d* d+ d, g Z d d d d  Z d   Z d   Z d   Z d   Z	 RS(-   iS   RY   R;   i    R<   R=   iR>   t   iGraphicsModeR   t   exScaleg      ?t   eyScalet   ptlReference_xt   ptlReference_yt   nCharst	   offStringt   fOptionst   rcl_leftt   rcl_topt	   rcl_rightt
   rcl_bottomt   offDxR   c         C   sb   t  j |   | |  _ | |  _ t | t  rC | j d  |  _ n	 | |  _ d |  _ g  |  _	 d  S(   Ns   utf-16lei   (
   Ru   R2   R  R  R   R   R   t   stringt   charsizet   dx(   R/   R   R   R   (    (    s&   code\common\utils\third_party\pyemf.pyR2   Z  s    				c         C   s   d } |  j  d k rN |  j |  j   } |  j d |  j | |  \ } |  _ n	 g  |  _ |  j d k r |  j |  j  } | | | |  j |  j !|  _ n	 d |  _ d  S(   Ni    RY   R   (   R  R   R   R  R  R  R  R  (   R/   R|   R   (    (    s&   code\common\utils\third_party\pyemf.pyR   e  s    '	!c         C   s   |  j    } d } d } t |  j  d k rr t |  j  |  j |  _ | |  _ t |  j |  j  } | | 7} n  t |  j  d k r | |  _ t	 j
 d  |  j } | | 7} n  | | S(   Ni    RY   (   R   RO   R  R  R  R  R   R  R  Ro   Rp   (   R/   R   t   sizedxR   (    (    s&   code\common\utils\third_party\pyemf.pyR   y  s    		c         C   sQ   |  j  d k r% |  j | |  j  n  |  j d k rM |  j | d |  j  n  d  S(   Ni    RY   (   R  R   R  R  R   R  (   R/   R   (    (    s&   code\common\utils\third_party\pyemf.pyR     s    c         C   s|   t    } | j d t |  j   |  j d k rX | j d t |  j j d    n | j d t |  j   | j   S(   Ns   	dx: %s
i   s   	unicode string: %s
s   utf-16les   	ascii string: %s
(   R   R   Rl   R  R  R  R   R   (   R/   R   (    (    s&   code\common\utils\third_party\pyemf.pyR     s    	&(   RY   s   rclBounds_lefti    (   RY   s   rclBounds_topi    (   RY   s   rclBounds_righti(   RY   s   rclBounds_bottomi(   R   R  g      ?(   R   R  g      ?(   RY   s   ptlReference_x(   RY   s   ptlReference_y(   RY   s   nChars(   RY   s	   offString(   RY   R  i    (   RY   R  i    (   RY   R  i    (   RY   R  i(   RY   R  i(   RY   s   offDxi    (
   R\   R]   Rk   t   GM_COMPATIBLER   R2   R   R   R   R   (    (    (    s&   code\common\utils\third_party\pyemf.pyR  F  s.   				t   _EXTTEXTOUTWc           B   s    e  Z d  Z d d d d  Z RS(   iT   i    u    c         C   s&   t  j j |  | | |  d |  _ d  S(   Ni   (   R   R  R2   R  (   R/   R   R   R   (    (    s&   code\common\utils\third_party\pyemf.pyR2     s    (   R\   R]   Rk   R2   (    (    (    s&   code\common\utils\third_party\pyemf.pyR    s   t   _POLYBEZIER16c           B   s   e  Z d  Z d Z RS(   iU   R   (   R\   R]   Rk   R   (    (    (    s&   code\common\utils\third_party\pyemf.pyR    s   t
   _POLYGON16c           B   s   e  Z d  Z RS(   iV   (   R\   R]   Rk   (    (    (    s&   code\common\utils\third_party\pyemf.pyR    s   t   _POLYLINE16c           B   s   e  Z d  Z RS(   iW   (   R\   R]   Rk   (    (    (    s&   code\common\utils\third_party\pyemf.pyR    s   t   _POLYBEZIERTO16c           B   s   e  Z d  Z d Z RS(   iX   R   (   R\   R]   Rk   R   (    (    (    s&   code\common\utils\third_party\pyemf.pyR    s   t   _POLYLINETO16c           B   s   e  Z d  Z RS(   iY   (   R\   R]   Rk   (    (    (    s&   code\common\utils\third_party\pyemf.pyR    s   t   _POLYPOLYLINE16c           B   s   e  Z d  Z d Z RS(   iZ   R   (   R\   R]   Rk   R   (    (    (    s&   code\common\utils\third_party\pyemf.pyR    s   t   _POLYPOLYGON16c           B   s   e  Z d  Z RS(   i[   (   R\   R]   Rk   (    (    (    s&   code\common\utils\third_party\pyemf.pyR    s   t   _CREATEMONOBRUSHc           B   s   e  Z d  Z RS(   i]   (   R\   R]   Rk   (    (    (    s&   code\common\utils\third_party\pyemf.pyR    s   t   _CREATEDIBPATTERNBRUSHPTc           B   s   e  Z d  Z RS(   i^   (   R\   R]   Rk   (    (    (    s&   code\common\utils\third_party\pyemf.pyR    s   t   _EXTCREATEPENc           B   s   e  Z d  Z RS(   i_   (   R\   R]   Rk   (    (    (    s&   code\common\utils\third_party\pyemf.pyR    s   t   _SETICMMODEc           B   s    e  Z d  Z d Z e d  Z RS(   sR   Set or query the current color management mode.

        @gdi: SetICMMode
        ib   c         C   s#   t  j j |  | d t d t d  S(   NR  R  (   R   R   R2   t   ICM_MINt   ICM_MAX(   R/   R   (    (    s&   code\common\utils\third_party\pyemf.pyR2     s    (   R\   R]   R^   Rk   t   ICM_OFFR2   (    (    (    s&   code\common\utils\third_party\pyemf.pyR    s   (K   R\   R]   Ru   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R  R  R  R  R  R  R  R  R  R  R  R   R#  R0  R2  R4  R<  RC  RD  RJ  RP  RQ  RT  R]  R^  R_  R`  Ra  Rb  Rc  Re  Rf  Rg  Rh  Ri  Rj  Rk  Rl  Rm  Rq  Rr  R  R  R  R  R  R  R  R  R  R  R  R  R  R  (    (    (    s&   code\common\utils\third_party\pyemf.pyR     s   r$.			!LW
	t   EMFc           B   s  e  Z d  Z d d d d d e d  Z dN d  Z d   Z d	   Z d
   Z	 dN d  Z
 d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d    Z d!   Z  d"   Z! d#   Z" d$   Z# d%   Z$ d&   Z% d'   Z& d(   Z' d) d* d* d) d* d* d+  Z( d) d* d* d) d* d* d,  Z) d-   Z* d.   Z+ d/   Z, d0   Z- d1   Z. d2   Z/ d3   Z0 d4   Z1 d5   Z2 d6   Z3 d7   Z4 d8   Z5 d9   Z6 d:   Z7 d;   Z8 d<   Z9 d=   Z: d>   Z; d?   Z< d@   Z= dA   Z> dB   Z? dC   Z@ eA dD  ZB dE   ZC dF   ZD dG   ZE dH   ZF dI dI dI eG dI dI dI eH eI eJ eK dJ dK dL  ZL dM   ZM RS(O   s  
Reference page of the public API for enhanced metafile creation.  See
L{pyemf} for an overview / mini tutorial.

@group Creating Metafiles: __init__, load, save
@group Drawing Parameters: GetStockObject, SelectObject, DeleteObject, CreatePen, CreateSolidBrush, CreateHatchBrush, SetBkColor, SetBkMode, SetPolyFillMode
@group Drawing Primitives: SetPixel, Polyline, PolyPolyline, Polygon, PolyPolygon, Rectangle, RoundRect, Ellipse, Arc, Chord, Pie, PolyBezier
@group Path Primatives: BeginPath, EndPath, MoveTo, LineTo, PolylineTo, ArcTo,
 PolyBezierTo, CloseFigure, FillPath, StrokePath, StrokeAndFillPath
@group Clipping: SelectClipPath
@group Text: CreateFont, SetTextAlign, SetTextColor, TextOut
@group Coordinate System Transformation: SaveDC, RestoreDC, SetWorldTransform, ModifyWorldTransform
@group **Experimental** -- Viewport Manipulation: SetMapMode, SetViewportOrgEx, GetViewportOrgEx, SetWindowOrgEx, GetWindowOrgEx, SetViewportExtEx, ScaleViewportExtEx, GetViewportExtEx, SetWindowExtEx, ScaleWindowExtEx, GetWindowExtEx

g      @g      @i,  R   s   pyemf.sf.netc         C   s   d |  _ t | | | |  |  _ g  |  _ d |  _ | |  _ t |  _ t	 j
 |  } |  j |  |  j s |  j t  |  j |  j j |  j j  |  j t |  j j d |  j j |  j j  t |  j j d |  j j |  j j   n  d S(   s  
Create an EMF structure in memory.  The size of the resulting image is
specified in either inches or millimeters depending on the value of
L{units}.  Width and height are floating point values, but density
must be an integer because this becomes the basis for the coordinate
system in the image.  Density is the number of individually
addressible pixels per unit measurement (dots per inch or dots per
millimeter, depending on the units system) in the image.  A
consequence of this is that each pixel is specified by a pair of
integer coordinates.

@param width: width of EMF image in inches or millimeters
@param height: height of EMF image in inches or millimeters
@param density: dots (pixels) per unit measurement
@param units: string indicating the unit measurement, one of:
 - 'in'
 - 'mm'
@type width: float
@type height: float
@type density: int
@type units: string
@param description: optional string to specify a description of the image
@type description: string

i    g      Y@N(   R   t   filenameR   R   t   recordst	   pathstartRz   R:  R   R   R   t   _appendt
   SetMapModeR  t   SetWindowExtExR#   R$   t   SetViewportExtExR   R    R   R   R!   R   R   (   R/   R    R!   R0   R1   R   Rz   RQ   (    (    s&   code\common\utils\third_party\pyemf.pyR2     s    						'c         C   sg   | r | |  _  n  |  j  rc t |  j   } g  |  _ |  j |  t |  _ |  j j |  j d  n  d S(   s  
Read an existing EMF file.  If any records exist in the current
object, they will be overwritten by the records from this file.

@param filename: filename to load
@type filename: string
@returns: True for success, False for failure.
@rtype: Boolean
        i    N(   R  t   openR  t   _unserializeRV   R   R   RB   (   R/   R  R   (    (    s&   code\common\utils\third_party\pyemf.pyt   loadO  s    
			c         C   s<  y$d } x| d k r"| j  d  } t |  } | d k r t j d |  \ } } |  j rr d | | f GHn  | t k r t |   } n	 t   } | j | | |  |  j j	 |  | j
   r |  j j | | j  n( t | t j  r|  j j | j  n  |  j rd G| GHqq q WWn t k
 r7n Xd  S(   Ni   i    i   s   <iis   EMF:  iType=%d nSize=%ds   Unserializing: (   R   RO   Ro   R   Rz   t   _emrmapRu   R   R  R   R   R   RT   RR   R   R   RC  RZ   t   EOFError(   R/   R   RS   R|   Rx   Ry   t   e(    (    s&   code\common\utils\third_party\pyemf.pyR  e  s.    	 		c         C   s6   | j  s2 |  j r d G| GHn  |  j j |  d Sd S(   s`   Append an EMR to the record list, unless the record has
        been flagged as having an error.s   Appending: i   i    (   R   Rz   R  R   (   R/   R  (    (    s&   code\common\utils\third_party\pyemf.pyR    s    		c         C   s   |  j  d } t | t j  sL |  j r0 d GHn  t j   } |  j |  n  |  j  d } | j |  j |  j  t	 |  j   | _
 t	 |  j j  | _ d } x( |  j  D] } | j   | | j 7} q W| | _ d S(   s  
Append an EOF record and compute header information.  The header needs
to know the number of records, number of handles, bounds, and size of
the entire metafile before it can be written out, so we have to march
through all the records and gather info.
        is   adding EOF recordi    N(   R  R   R   R   Rz   R  R   R   R   RO   R   R   R   R   Ry   R   (   R/   t   endR  RA   R   (    (    s&   code\common\utils\third_party\pyemf.pyt   _end  s    	 
c         C   sk   |  j    | r | |  _ n  |  j rg y1 t |  j d  } |  j |  | j   t SWqg   t SXn  t S(   s   
Write the EMF to disk.

@param filename: filename to write
@type filename: string
@returns: True for success, False for failure.
@rtype: Boolean
        t   wb(   R  R  R  t
   _serializet   closeR:  RV   (   R/   R  R   (    (    s&   code\common\utils\third_party\pyemf.pyt   save  s    

	
c         C   s6   x/ |  j  D]$ } |  j r! | GHn  | j |  q
 Wd  S(   N(   R  Rz   R   (   R/   R   R  (    (    s&   code\common\utils\third_party\pyemf.pyR    s    	 c         C   s   d  S(   N(    (   R/   R    R!   t   dots_per_unitR1   (    (    s&   code\common\utils\third_party\pyemf.pyt   _create  s    c         C   s   | d d } | } | d d } | } xl | d D]` \ } } | | k  rT | } n | | k ri | } n  | | k  r~ | } q3 | | k r3 | } q3 q3 W| | | | f S(   s5   Get the bounding rectangle for this list of 2-tuples.i    i   (    (   R/   R   RG   RI   RH   RJ   R   R   (    (    s&   code\common\utils\third_party\pyemf.pyt
   _getBounds  s    			c         C   s   | r | d | d k  r+ | d | d <n  | d | d k  rP | d | d <n  | d | d k ru | d | d <n  | d | d k r | d | d <q n  d  S(   Ni    i   i   i   (    (   R/   R   t
   itembounds(    (    s&   code\common\utils\third_party\pyemf.pyt   _mergeBounds  s        c         C   s   d } | | d d g } xF t  |  j t |  j   D]) } |  j | } |  j | | j    q4 W| d | k r~ d | d <n  | d | k r d | d <n  | S(   s}   Get the bounding rectangle for the list of EMR records
        starting from the last saved path start to the current record.i@B ii    i   (   R   R  RO   R  R  RB   (   R/   t   bigR   RY   R  (    (    s&   code\common\utils\third_party\pyemf.pyt   _getPathBounds  s    "  c         C   sT   d } d } | d | k rP | d | k rP | d | k rP | d | k rP t  St S(   s   Determine if we can use the shorter 16-bit EMR structures.
        If all the numbers can fit within 16 bit integers, return
        true.  The bounds 4-tuple is (left,top,right,bottom).i i  i    i   i   i   (   R:  RV   (   R/   R   t   SHRT_MINt   SHRT_MAX(    (    s&   code\common\utils\third_party\pyemf.pyt	   _useShort  s
    @c         C   sV   |  j  |  } |  j |  r0 | | |  } n | | |  } |  j |  sR d Sd S(   Ni    i   (   R  R  R  (   R/   R   t   cls16t   clsR   R  (    (    s&   code\common\utils\third_party\pyemf.pyt   _appendOptimize16  s    c         C   s   g  } g  } xI | D]A } d } x% | D] } | j  |  | d 7} q& W| j  |  q W|  j |  }	 |  j |	  r | | | |	  }
 n | | | |	  }
 |  j |
  s d Sd S(   s   polylist is a list of lists of points, where each inner
        list represents a single polygon or line.  The number of
        polygons is the size of the outer list.i    i   (   R   R  R  R  (   R/   t   polylistR  R  R   R   t   polygonRS   t   pointR   R  (    (    s&   code\common\utils\third_party\pyemf.pyt   _appendOptimizePoly16	  s    c         C   s?   |  j  j |  } |  j |  s2 |  j  j   d S| | _ | S(   Ni    (   R   RT   R  R[   RR   (   R/   R  RR   (    (    s&   code\common\utils\third_party\pyemf.pyt   _appendHandle	  s    	c         C   s0   | d k r  | t  k r  | d BSt d   d S(   s  

Retrieve the handle for a predefined graphics object. Stock objects
include (at least) the following:

 - WHITE_BRUSH
 - LTGRAY_BRUSH
 - GRAY_BRUSH
 - DKGRAY_BRUSH
 - BLACK_BRUSH
 - NULL_BRUSH
 - HOLLOW_BRUSH
 - WHITE_PEN
 - BLACK_PEN
 - NULL_PEN
 - OEM_FIXED_FONT
 - ANSI_FIXED_FONT
 - ANSI_VAR_FONT
 - SYSTEM_FONT
 - DEVICE_DEFAULT_FONT
 - DEFAULT_PALETTE
 - SYSTEM_FIXED_FONT
 - DEFAULT_GUI_FONT

@param    obj:  	number of stock object.

@return:    handle of stock graphics object.
@rtype: int
@type obj: int

        i    l        s   Undefined stock object.N(   t
   STOCK_LASTRU   (   R/   t   obj(    (    s&   code\common\utils\third_party\pyemf.pyt   GetStockObject"	  s     c         C   s   |  j  t j |  j |   S(   s   

Make the given graphics object current.

@param handle: handle of graphics object to make current.

@return:
    the handle of the current graphics object which obj replaces.

@rtype: int
@type handle: int

        (   R  R   R2  R   (   R/   RR   (    (    s&   code\common\utils\third_party\pyemf.pyt   SelectObjectF	  s    c         C   s2   t  j |  j |  } |  j j |  |  j |  S(   s(  

Delete the given graphics object. Note that, now, only those contexts
into which the object has been selected get a delete object
records.

@param    handle:  	handle of graphics object to delete.

@return:    true if the object was successfully deleted.
@rtype: int
@type handle: int

        (   R   RC  R   RZ   R  (   R/   RR   R  (    (    s&   code\common\utils\third_party\pyemf.pyt   DeleteObjectV	  s    c         C   s"   |  j  t j | | t |    S(   s  

Create a pen, used to draw lines and path outlines.


@param    style:  	the style of the new pen, one of:
 - PS_SOLID
 - PS_DASH
 - PS_DOT
 - PS_DASHDOT
 - PS_DASHDOTDOT
 - PS_NULL
 - PS_INSIDEFRAME
 - PS_USERSTYLE
 - PS_ALTERNATE
@param    width:  	the width of the new pen.
@param    color:  	(r,g,b) tuple or the packed integer L{color<RGB>} of the new pen.

@return:    handle to the new pen graphics object.
@rtype: int
@type style: int
@type width: int
@type color: int

        (   R  R   R4  R   (   R/   R9  R    R   (    (    s&   code\common\utils\third_party\pyemf.pyt	   CreatePenh	  s    c         C   s   |  j  t j d t |    S(   s   

Create a solid brush used to fill polygons.
@param color: the L{color<RGB>} of the solid brush.
@return: handle to brush graphics object.

@rtype: int
@type color: int

        R   (   R  R   R<  R   (   R/   R   (    (    s&   code\common\utils\third_party\pyemf.pyt   CreateSolidBrush	  s    c         C   s%   |  j  t j d | d t |    S(   s  

Create a hatched brush used to fill polygons.

B{Note:} Currently appears unsupported in OpenOffice.

@param hatch: integer representing type of fill:
 - HS_HORIZONTAL
 - HS_VERTICAL
 - HS_FDIAGONAL
 - HS_BDIAGONAL
 - HS_CROSS
 - HS_DIAGCROSS
@type hatch: int
@param color: the L{color<RGB>} of the 'on' pixels of the brush.
@return: handle to brush graphics object.

@rtype: int
@type color: int

        R@  R   (   R  R   R<  R   (   R/   R@  R   (    (    s&   code\common\utils\third_party\pyemf.pyt   CreateHatchBrush	  s    c         C   s,   t  j t |   } |  j |  s( d Sd S(   s  

Set the background color used for any transparent regions in fills or
hatched brushes.

B{Note:} Currently appears sporadically supported in OpenOffice.

@param color: background L{color<RGB>}.
@return: previous background L{color<RGB>}.
@rtype: int
@type color: int

        i    i   (   R   R  R   R  (   R/   R   R  (    (    s&   code\common\utils\third_party\pyemf.pyt
   SetBkColor	  s    c         C   s&   t  j |  } |  j |  s" d Sd S(   sX  

Set the background mode for interaction between transparent areas in
the region to be drawn and the existing background.

The choices for mode are:
 - TRANSPARENT
 - OPAQUE

B{Note:} Currently appears sporadically supported in OpenOffice.

@param mode: background mode.
@return: previous background mode.
@rtype: int
@type mode: int

        i    i   (   R   R  R  (   R/   R   R  (    (    s&   code\common\utils\third_party\pyemf.pyt	   SetBkMode	  s    c         C   s&   t  j |  } |  j |  s" d Sd S(   s  

Set the polygon fill mode.  Generally these modes produce
different results only when the edges of the polygons overlap
other edges.

@param mode: fill mode with the following options:
 - ALTERNATE - fills area between odd and even numbered sides
 - WINDING - fills all area as long as a point is between any two sides
@return: previous fill mode.
@rtype: int
@type mode: int

        i    i   (   R   R  R  (   R/   R   R  (    (    s&   code\common\utils\third_party\pyemf.pyt   SetPolyFillMode	  s    c         C   s&   t  j |  } |  j |  s" d Sd S(   ss  

Set the window mapping mode.  This is the mapping between pixels in page space to pixels in device space.  Page space is the coordinate system that is used for all the drawing commands -- it is how pixels are identified and figures are placed in the metafile.  They are integer units.

Device space is the coordinate system of the final output, measured in physical dimensions such as mm, inches, or twips.  It is this coordinate system that provides the scaling that makes metafiles into a scalable graphics format.
 - MM_TEXT: each unit in page space is mapped to one pixel
 - MM_LOMETRIC: 1 page unit = .1 mm in device space
 - MM_HIMETRIC: 1 page unit = .01 mm in device space
 - MM_LOENGLISH: 1 page unit = .01 inch in device space
 - MM_HIENGLISH: 1 page unit = .001 inch in device space
 - MM_TWIPS: 1 page unit = 1/20 point (or 1/1440 inch)
 - MM_ISOTROPIC: 1 page unit = user defined ratio, but axes equally scaled
 - MM_ANISOTROPIC: 1 page unit = user defined ratio, axes may be independently scaled
@param mode: window mapping mode.
@return: previous window mapping mode, or zero if error.
@rtype: int
@type mode: int
        i    i   (   R   R   R  (   R/   R   R  (    (    s&   code\common\utils\third_party\pyemf.pyR  	  s    c         C   sY   t  j | |  } |  j |  s% d S|  j j |  j j f } | |  j _ | |  j _ | S(   s  

Set the origin of the viewport, which translates the origin of the
coordinate system by (xv,yv).  A pixel drawn at (x,y) in the new
coordinate system will be displayed at (x+xv,y+yv) in terms of the
previous coordinate system.

Contrast this with L{SetWindowOrgEx}, which seems to be the opposite
translation.  So, if in addition, the window origin is set to (xw,yw)
using L{SetWindowOrgEx}, a pixel drawn at (x,y) will be displayed at
(x-xw+xv,y-yw+yv) in terms of the original coordinate system.


@param xv: new x position of the viewport origin.
@param yv: new y position of the viewport origin.
@return: previous viewport origin
@rtype: 2-tuple (x,y) if successful, or None if unsuccessful
@type xv: int
@type yv: int
        N(   R   R   R  R   R   R'   R(   (   R/   t   xvt   yvR  t   old(    (    s&   code\common\utils\third_party\pyemf.pyt   SetViewportOrgEx	  s    c         C   s   |  j  j |  j  j f S(   sn   

Get the origin of the viewport.
@return: returns the current viewport origin.
@rtype: 2-tuple (x,y)
        (   R   R'   R(   (   R/   (    (    s&   code\common\utils\third_party\pyemf.pyt   GetViewportOrgEx
  s    c         C   sY   t  j | |  } |  j |  s% d S|  j j |  j j f } | |  j _ | |  j _ | S(   s  

Set the origin of the window, which translates the origin of the
coordinate system by (-xw,-yw).  A pixel drawn at (x,y) in the new
coordinate system will be displayed at (x-xw,y-yw) in terms of the
previous coordinate system.

Contrast this with L{SetViewportOrgEx}, which seems to be the opposite
translation.  So, if in addition, the viewport origin is set to
(xv,yv) using L{SetViewportOrgEx}, a pixel drawn at (x,y) will be
displayed at (x-xw+xv,y-yw+yv) in terms of the original coordinate
system.

@param xw: new x position of the window origin.
@param yw: new y position of the window origin.
@return: previous window origin
@rtype: 2-tuple (x,y) if successful, or None if unsuccessful
@type xw: int
@type yw: int
        N(   R   R   R  R   R   R+   R,   (   R/   t   xwt   ywR  R  (    (    s&   code\common\utils\third_party\pyemf.pyt   SetWindowOrgEx%
  s    c         C   s   |  j  j |  j  j f S(   sl   

Get the origin of the window.
@return: returns the current window  origin.
@rtype: 2-tuple (x,y)

        (   R   R+   R,   (   R/   (    (    s&   code\common\utils\third_party\pyemf.pyt   GetWindowOrgExB
  s    c         C   sY   t  j | |  } |  j |  s% d S|  j j |  j j f } t |  j _ t |  j _ | S(   s/  
Set the dimensions of the viewport in device units.  Device units are
physical dimensions, in millimeters.  The total extent is equal to the
width is millimeters multiplied by the density of pixels per
millimeter in that dimension.

Note: this is only usable when L{SetMapMode} has been set to
MM_ISOTROPIC or MM_ANISOTROPIC.

@param x: new width of the viewport.
@param y: new height of the viewport.
@return: returns the previous size of the viewport.
@rtype: 2-tuple (width,height) if successful, or None if unsuccessful
@type x: int
@type y: int
        N(	   R   R   R  R   R   R)   R*   R
  R  (   R/   R   R   R  R  (    (    s&   code\common\utils\third_party\pyemf.pyR  L
  s    c         C   sz   t  j  j | | | |  } |  j |  s. d S|  j j |  j j f } | d | | |  j _ | d | | |  j _ | S(   s~  

Scale the dimensions of the viewport.
@param x_num: numerator of x scale
@param x_den: denominator of x scale
@param y_num: numerator of y scale
@param y_den: denominator of y scale
@return: returns the previous size of the viewport.
@rtype: 2-tuple (width,height) if successful, or None if unsuccessful
@type x_num: int
@type x_den: int
@type y_num: int
@type y_den: int
        i    i   N(   R   R  R  R   R   R)   R*   (   R/   t   x_numt   x_dent   y_numt   y_denR  R  (    (    s&   code\common\utils\third_party\pyemf.pyt   ScaleViewportExtExe
  s    c         C   s   |  j  j |  j  j f } | S(   s   

Get the dimensions of the viewport in device units (i.e. physical dimensions).
@return: returns the size of the viewport.
@rtype: 2-tuple (width,height)

        (   R   R)   R*   (   R/   R  (    (    s&   code\common\utils\third_party\pyemf.pyt   GetViewportExtEx|
  s    c         C   sY   t  j | |  } |  j |  s% d S|  j j |  j j f } | |  j _ | |  j _ | S(   s  

Set the dimensions of the window.  Window size is measured in integer
numbers of pixels (logical units).

Note: this is only usable when L{SetMapMode} has been set to
MM_ISOTROPIC or MM_ANISOTROPIC.

@param x: new width of the window.
@param y: new height of the window.
@return: returns the previous size of the window.
@rtype: 2-tuple (width,height) if successful, or None if unsuccessful
@type x: int
@type y: int
        N(   R   R   R  R   R   R-   R.   (   R/   R   R   R  R  (    (    s&   code\common\utils\third_party\pyemf.pyR  
  s    c         C   sw   t  j | | | |  } |  j |  s+ d S|  j j |  j j f } | d | | |  j _ | d | | |  j _ | S(   sz  

Scale the dimensions of the window.
@param x_num: numerator of x scale
@param x_den: denominator of x scale
@param y_num: numerator of y scale
@param y_den: denominator of y scale
@return: returns the previous size of the window.
@rtype: 2-tuple (width,height) if successful, or None if unsuccessful
@type x_num: int
@type x_den: int
@type y_num: int
@type y_den: int
        i    i   N(   R   R  R  R   R   R-   R.   (   R/   R  R  R  R  R  R  (    (    s&   code\common\utils\third_party\pyemf.pyt   ScaleWindowExtEx
  s    c         C   s   |  j  j |  j  j f } | S(   s   

Get the dimensions of the window in logical units (integer numbers of pixels).
@return: returns the size of the window.
@rtype: 2-tuple (width,height)
        (   R   R-   R.   (   R/   R  (    (    s&   code\common\utils\third_party\pyemf.pyt   GetWindowExtEx
  s    g      ?g        c         C   s%   |  j  t j | | | | | |   S(   s  
Set the world coordinate to logical coordinate linear transform for
subsequent operations.  With this matrix operation, you can translate,
rotate, scale, shear, or a combination of all four.  The matrix
operation is defined as follows where (x,y) are the original
coordinates and (x',y') are the transformed coordinates::

 | x |   | m11 m12 0 |   | x' |
 | y | * | m21 m22 0 | = | y' |
 | 0 |   | dx  dy  1 |   | 0  |

or, the same thing defined as a system of linear equations::

 x' = x*m11 + y*m21 + dx
 y' = x*m12 + y*m22 + dy

http://msdn.microsoft.com/library/en-us/gdi/cordspac_0inn.asp
says that the offsets are in device coordinates, not pixel
coordinates.

B{Note:} Currently partially supported in OpenOffice.

@param m11: matrix entry
@type m11: float
@param m12: matrix entry
@type m12: float
@param m21: matrix entry
@type m21: float
@param m22: matrix entry
@type m22: float
@param dx: x shift
@type dx: float
@param dy: y shift
@type dy: float
@return: status
@rtype: boolean

        (   R  R   R#  (   R/   t   m11t   m12t   m21t   m22R  t   dy(    (    s&   code\common\utils\third_party\pyemf.pyt   SetWorldTransform
  s    'c      	   C   s(   |  j  t j | | | | | | |   S(   s  
Change the current linear transform.  See L{SetWorldTransform} for a
description of the matrix parameters.  The new transform may be
modified in one of three ways, set by the mode parameter:

 - MWT_IDENTITY: reset the transform to the identity matrix (the matrix parameters are ignored).
 - MWT_LEFTMULTIPLY: multiply the matrix represented by these parameters by the current world transform to get the new transform.
 - MWT_RIGHTMULTIPLY: multiply the current world tranform by the matrix represented here to get the new transform.

The reason that there are two different multiplication types is that
matrix multiplication is not commutative, which means the order of
multiplication makes a difference.

B{Note:} The parameter order was changed from GDI standard so that I
could make the matrix parameters optional in the case of MWT_IDENTITY.

B{Note:} Currently appears unsupported in OpenOffice.

@param mode: MWT_IDENTITY, MWT_LEFTMULTIPLY, or MWT_RIGHTMULTIPLY
@type mode: int
@param m11: matrix entry
@type m11: float
@param m12: matrix entry
@type m12: float
@param m21: matrix entry
@type m21: float
@param m22: matrix entry
@type m22: float
@param dx: x shift
@type dx: float
@param dy: y shift
@type dy: float
@return: status
@rtype: boolean

        (   R  R   R0  (   R/   R   R  R  R  R  R  R  (    (    s&   code\common\utils\third_party\pyemf.pyt   ModifyWorldTransform
  s    %c         C   s"   |  j  t j | | t |    S(   s   

Set the pixel to the given color.
@param x: the horizontal position.
@param y: the vertical position.
@param color: the L{color<RGB>} to set the pixel.
@type x: int
@type y: int
@type color: int or (r,g,b) tuple

        (   R  R   R   R   (   R/   R   R   R   (    (    s&   code\common\utils\third_party\pyemf.pyt   SetPixel  s    c         C   s   |  j  | t j t j  S(   s   

Draw a sequence of connected lines.
@param points: list of x,y tuples
@return: true if polyline is successfully rendered.
@rtype: int
@type points: tuple

        (   R  R   R  R   (   R/   R   (    (    s&   code\common\utils\third_party\pyemf.pyt   Polyline   s    
c         C   s   |  j  | t j t j  S(   s-  

Draw multiple polylines.  The polylines argument is a list of lists,
where each inner list represents a single polyline.  Each polyline is
described by a list of x,y tuples as in L{Polyline}.  For example::

  lines=[[(100,100),(200,100)],
         [(300,100),(400,100)]]
  emf.PolyPolyline(lines)

draws two lines, one from 100,100 to 200,100, and another from 300,100
to 400,100.

@param polylines: list of lines, where each line is a list of x,y tuples
@type polylines: list
@return: true if polypolyline is successfully rendered.
@rtype: int

        (   R  R   R  R   (   R/   t	   polylines(    (    s&   code\common\utils\third_party\pyemf.pyt   PolyPolyline-  s    c         C   s  t  |  d k r| d d | d d k r | d d | d d k r | d d | d d k r | d d | d d k r |  j r d GHn  |  j | d d | d d | d d | d d  S| d d | d d k r| d d | d d k r| d d | d d k r| d d | d d k r|  j rJd GHn  |  j | d d | d d | d d | d d  Sn  |  j | t j t j  S(   sJ  

Draw a closed figure bounded by straight line segments.  A polygon is
defined by a list of points that define the endpoints for a series of
connected straight line segments.  The end of the last line segment is
automatically connected to the beginning of the first line segment,
the border is drawn with the current pen, and the interior is filled
with the current brush.  See L{SetPolyFillMode} for the fill effects
when an overlapping polygon is defined.

@param points: list of x,y tuples
@return: true if polygon is successfully rendered.
@rtype: int
@type points: tuple

        i   i    i   i   i   s"   converting to rectangle, option 1:s"   converting to rectangle, option 2:(   RO   Rz   t	   RectangleR  R   R  R   (   R/   R   (    (    s&   code\common\utils\third_party\pyemf.pyt   PolygonD  s    p	 6p	 9c         C   s   |  j  | t j t j  S(   s  

Draw multiple polygons.  The polygons argument is a list of lists,
where each inner list represents a single polygon.  Each polygon is
described by a list of x,y tuples as in L{Polygon}.  For example::

  lines=[[(100,100),(200,100),(200,200),(100,200)],
         [(300,100),(400,100),(400,200),(300,200)]]
  emf.PolyPolygon(lines)

draws two squares.

B{Note:} Currently partially supported in OpenOffice.  The line width
is ignored and the polygon border is not closed (the final point is
not connected to the starting point in each polygon).

@param polygons: list of polygons, where each polygon is a list of x,y tuples
@type polygons: list
@return: true if polypolygon is successfully rendered.
@rtype: int

        (   R  R   R  R   (   R/   t   polygons(    (    s&   code\common\utils\third_party\pyemf.pyt   PolyPolygon_  s    c         C   s"   |  j  t j | | | | f   S(   s  

Draw an ellipse using the current pen.
@param left: x position of left side of ellipse bounding box.
@param top: y position of top side of ellipse bounding box.
@param right: x position of right edge of ellipse bounding box.
@param bottom: y position of bottom edge of ellipse bounding box.
@return: true if rectangle was successfully rendered.
@rtype: int
@type left: int
@type top: int
@type right: int
@type bottom: int

        (   R  R   RJ  (   R/   RG   RH   RI   RJ   (    (    s&   code\common\utils\third_party\pyemf.pyt   Ellipsey  s    c         C   s"   |  j  t j | | | | f   S(   s  

Draw a rectangle using the current pen.
@param left: x position of left side of ellipse bounding box.
@param top: y position of top side of ellipse bounding box.
@param right: x position of right edge of ellipse bounding box.
@param bottom: y position of bottom edge of ellipse bounding box.
@return: true if rectangle was successfully rendered.
@rtype: int
@type left: int
@type top: int
@type right: int
@type bottom: int

        (   R  R   RP  (   R/   RG   RH   RI   RJ   (    (    s&   code\common\utils\third_party\pyemf.pyR&    s    c         C   s(   |  j  t j | | | | | | f   S(   sq  

Draw a rectangle with rounded corners using the current pen.
@param left: x position of left side of ellipse bounding box.
@param top: y position of top side of ellipse bounding box.
@param right: x position of right edge of ellipse bounding box.
@param bottom: y position of bottom edge of ellipse bounding box.
@param cornerwidth: width of the ellipse that defines the roundness of the corner.
@param cornerheight: height of ellipse
@return: true if rectangle was successfully rendered.
@rtype: int
@type left: int
@type top: int
@type right: int
@type bottom: int
@type cornerwidth: int
@type cornerheight: int

        (   R  R   RQ  (   R/   RG   RH   RI   RJ   t   cornerwidtht   cornerheight(    (    s&   code\common\utils\third_party\pyemf.pyt	   RoundRect  s    c	   	   
   C   s+   |  j  t j | | | | | | | |   S(   s  

Draw an arc of an ellipse.  The ellipse is specified by its bounding
rectange and two lines from its center to indicate the start and end
angles.  left, top, right, bottom describe the bounding rectangle of
the ellipse.  The start point given by xstart,ystert defines a ray
from the center of the ellipse through the point and out to infinity.
The point at which this ray intersects the ellipse is the starting
point of the arc.  Similarly, the infinite radial ray from the center
through the end point defines the end point of the ellipse.  The arc
is drawn in a counterclockwise direction, and if the start and end
rays are coincident, a complete ellipse is drawn.

@param left: x position of left edge of arc box.
@param top: y position of top edge of arc box.
@param right: x position of right edge of arc box.
@param bottom: y position bottom edge of arc box.
@param xstart: x position of arc start.
@param ystart: y position of arc start.
@param xend: x position of arc end.
@param yend: y position of arc end.
@return: true if arc was successfully rendered.
@rtype: int
@type left: int
@type top: int
@type right: int
@type bottom: int
@type xstart: int
@type ystart: int
@type xend: int
@type yend: int

        (   R  R   RT  (	   R/   RG   RH   RI   RJ   RY  RZ  R[  R\  (    (    s&   code\common\utils\third_party\pyemf.pyt   Arc  s    "c	   	   
   C   s+   |  j  t j | | | | | | | |   S(   s  

Draw a chord of an ellipse.  A chord is a closed region bounded by an
arc and the [straight] line between the two points that define the arc
start and end.  The arc start and end points are defined as in L{Arc}.

@param left: x position of left edge of arc box.
@param top: y position of top edge of arc box.
@param right: x position of right edge of arc box.
@param bottom: y position bottom edge of arc box.
@param xstart: x position of arc start.
@param ystart: y position of arc start.
@param xend: x position of arc end.
@param yend: y position of arc end.
@return: true if arc was successfully rendered.
@rtype: int
@type left: int
@type top: int
@type right: int
@type bottom: int
@type xstart: int
@type ystart: int
@type xend: int
@type yend: int

        (   R  R   R]  (	   R/   RG   RH   RI   RJ   RY  RZ  R[  R\  (    (    s&   code\common\utils\third_party\pyemf.pyt   Chord  s    c	   
   
   C   sg   | | k r6 | | k r6 t  j | | | | f  }	 n$ t  j | | | | | | | |  }	 |  j |	  S(   s  

Draw a pie slice of an ellipse.  The ellipse is specified as in
L{Arc}, and it is filled with the current brush.

@param left: x position of left edge of arc box.
@param top: y position of top edge of arc box.
@param right: x position of right edge of arc box.
@param bottom: y position bottom edge of arc box.
@param xstart: x position of arc start.
@param ystart: y position of arc start.
@param xend: x position of arc end.
@param yend: y position of arc end.
@return: true if arc was successfully rendered.
@rtype: int
@type left: int
@type top: int
@type right: int
@type bottom: int
@type xstart: int
@type ystart: int
@type xend: int
@type yend: int

        (   R   RJ  R^  R  (
   R/   RG   RH   RI   RJ   RY  RZ  R[  R\  R  (    (    s&   code\common\utils\third_party\pyemf.pyt   Pie  s    $c         C   s   |  j  | t j t j  S(   sS  

Draw cubic Bezier curves using the list of points as both endpoints
and control points.  The first point is used as the starting point,
the second and thrird points are control points, and the fourth point
is the end point of the first curve.  Subsequent curves need three
points each: two control points and an end point, as the ending point
of the previous curve is used as the starting point for the next
curve.

@param points: list of x,y tuples that are either end points or control points
@return: true if bezier curve was successfully rendered.
@rtype: int
@type points: tuple

        (   R  R   R  R   (   R/   R   (    (    s&   code\common\utils\third_party\pyemf.pyt
   PolyBezier  s    c         C   s%   t  |  j  |  _ |  j t j    S(   sw   

Begin defining a path.  Any previous unclosed paths are discarded.
@return: true if successful.
@rtype: int

        (   RO   R  R  R  R   Re  (   R/   (    (    s&   code\common\utils\third_party\pyemf.pyt	   BeginPath,  s    	c         C   s   |  j  t j    S(   sM   

End the path definition.
@return: true if successful.
@rtype: int

        (   R  R   Rf  (   R/   (    (    s&   code\common\utils\third_party\pyemf.pyt   EndPath8  s    c         C   s   |  j  t j | |   S(   s   

Move the current point to the given position and implicitly begin a
new figure or path.

@param x: new x position.
@param y: new y position.
@return: true if position successfully changed (can this fail?)
@rtype: int
@type x: int
@type y: int
        (   R  R   R  (   R/   R   R   (    (    s&   code\common\utils\third_party\pyemf.pyt   MoveToB  s    c         C   s   |  j  t j | |   S(   s   

Draw a straight line using the current pen from the current point to
the given position.

@param x: x position of line end.
@param y: y position of line end.
@return: true if line is drawn (can this fail?)
@rtype: int
@type x: int
@type y: int

        (   R  R   Ra  (   R/   R   R   (    (    s&   code\common\utils\third_party\pyemf.pyt   LineToQ  s    c         C   s   |  j  | t j t j  S(   s   

Draw a sequence of connected lines starting from the current
position and update the position to the final point in the list.

@param points: list of x,y tuples
@return: true if polyline is successfully rendered.
@rtype: int
@type points: tuple

        (   R  R   R  R   (   R/   R   (    (    s&   code\common\utils\third_party\pyemf.pyt
   PolylineToa  s    c	   	   
   C   s+   |  j  t j | | | | | | | |   S(   s  

Draw an arc and update the current position.  The arc is drawn as
described in L{Arc}, but in addition the start of the arc will be
connected to the previous position and the current position is updated
to the end of the arc so subsequent path operations such as L{LineTo},
L{PolylineTo}, etc. will connect to the end.

B{Note:} Currently appears unsupported in OpenOffice.

@param left: x position of left edge of arc box.
@param top: y position of top edge of arc box.
@param right: x position of right edge of arc box.
@param bottom: y position bottom edge of arc box.
@param xstart: x position of arc start.
@param ystart: y position of arc start.
@param xend: x position of arc end.
@param yend: y position of arc end.
@return: true if arc was successfully rendered.
@rtype: int
@type left: int
@type top: int
@type right: int
@type bottom: int
@type xstart: int
@type ystart: int
@type xend: int
@type yend: int

        (   R  R   Rb  (	   R/   RG   RH   RI   RJ   RY  RZ  R[  R\  (    (    s&   code\common\utils\third_party\pyemf.pyt   ArcToo  s    c         C   s   |  j  | t j t j  S(   s  

Draw cubic Bezier curves, as described in L{PolyBezier}, but in
addition draw a line from the previous position to the start of the
curve.  If the arc is successfully rendered, the current position is
updated so that subsequent path operations such as L{LineTo},
L{PolylineTo}, etc. will follow from the end of the curve.

@param points: list of x,y tuples that are either end points or control points
@return: true if bezier curve was successfully rendered.
@rtype: int
@type points: tuple

        (   R  R   R  R   (   R/   R   (    (    s&   code\common\utils\third_party\pyemf.pyt   PolyBezierTo  s    c         C   s   |  j  t j    S(   s   

Close a currently open path, which connects the current position to the starting position of a figure.  Usually the starting position is the most recent call to L{MoveTo} after L{BeginPath}.

@return: true if successful

@rtype: int

        (   R  R   Rg  (   R/   (    (    s&   code\common\utils\third_party\pyemf.pyt   CloseFigure  s    
c         C   s"   |  j    } |  j t j |   S(   s   

Close any currently open path and fills it using the currently
selected brush and polygon fill mode.

@return: true if successful.
@rtype: int

        (   R  R  R   Rh  (   R/   R   (    (    s&   code\common\utils\third_party\pyemf.pyt   FillPath  s    
c         C   s"   |  j    } |  j t j |   S(   s   

Close any currently open path and outlines it using the currently
selected pen.

@return: true if successful.
@rtype: int

        (   R  R  R   Rj  (   R/   R   (    (    s&   code\common\utils\third_party\pyemf.pyt
   StrokePath  s    
c         C   s"   |  j    } |  j t j |   S(   s  

Close any currently open path, outlines it using the currently
selected pen, and fills it using the current brush.  Same as stroking
and filling using both the L{FillPath} and L{StrokePath} options,
except that the pixels that would be in the overlap region to be both
stroked and filled are optimized to be only stroked.

B{Note:} Supported in OpenOffice 2.*, unsupported in OpenOffice 1.*.

@return: true if successful.
@rtype: int

        (   R  R  R   Ri  (   R/   R   (    (    s&   code\common\utils\third_party\pyemf.pyt   StrokeAndFillPath  s    c         C   s   |  j  t j |   S(   s  

Use the current path as the clipping path.  The current path must be a
closed path (i.e. with L{CloseFigure} and L{EndPath})

B{Note:} Currently unsupported in OpenOffice -- it apparently uses the
bounding rectangle of the path as the clip area, not the path itself.

@param mode: one of the following values that specifies how to modify the clipping path
 - RGN_AND: the new clipping path becomes the intersection of the old path and the current path
 - RGN_OR: the new clipping path becomes the union of the old path and the current path
 - RGN_XOR: the new clipping path becomes the union of the old path and the current path minus the intersection of the old and current path
 - RGN_DIFF: the new clipping path becomes the old path where any overlapping region of the current path is removed
 - RGN_COPY: the new clipping path is set to the current path and the old path is thrown away

@return: true if successful.
@rtype: int

        (   R  R   Rm  (   R/   R   (    (    s&   code\common\utils\third_party\pyemf.pyt   SelectClipPath  s    c         C   s   |  j  t j    S(   s  

Saves the current state of the graphics mode (such as line and fill
styles, font, clipping path, drawing mode and any transformations) to
a stack.  This state can be restored by L{RestoreDC}.

B{Note:} Currently unsupported in OpenOffice -- it apparently uses the
bounding rectangle of the path as the clip area, not the path itself.

@return: value of the saved state.
@rtype: int

        (   R  R   R  (   R/   (    (    s&   code\common\utils\third_party\pyemf.pyt   SaveDC  s    c         C   s   |  j  t j d   S(   s  

Restores the state of the graphics mode to a stack.  The L{stackid}
parameter is either a value returned by L{SaveDC}, or if negative, is
the number of states relative to the top of the save stack.  For
example, C{stackid == -1} is the most recently saved state.

B{Note:} If the retrieved state is not at the top of the stack, any
saved states above it are thrown away.

B{Note:} Currently unsupported in OpenOffice -- it apparently uses the
bounding rectangle of the path as the clip area, not the path itself.

@param stackid: stack id number from L{SaveDC} or negative number for relative stack location
@type stackid: int
@return: nonzero for success
@rtype: int

        i(   R  R   R   (   R/   t   stackid(    (    s&   code\common\utils\third_party\pyemf.pyt	   RestoreDC   s    c         C   s   |  j  t j |   S(   s  

Set the subsequent alignment of drawn text. You can also pass a flag
indicating whether or not to update the current point to the end of the
text. Alignment may have the (sum of) values:
 - TA_NOUPDATECP
 - TA_UPDATECP
 - TA_LEFT
 - TA_RIGHT
 - TA_CENTER
 - TA_TOP
 - TA_BOTTOM
 - TA_BASELINE
 - TA_RTLREADING
@param alignment: new text alignment.
@return: previous text alignment value.
@rtype: int
@type alignment: int

        (   R  R   R  (   R/   t	   alignment(    (    s&   code\common\utils\third_party\pyemf.pyt   SetTextAlign  s    c         C   s,   t  j t |   } |  j |  s( d Sd S(   s   

Set the text foreground color.
@param color: text foreground L{color<RGB>}.
@return: previous text foreground L{color<RGB>}.
@rtype: int
@type color: int

        i    i   (   R   R  R   R  (   R/   R   R  (    (    s&   code\common\utils\third_party\pyemf.pyt   SetTextColor-  s    
i    s   DEFAULT_PITCH|FF_DONTCAREs   Times New Romanc         C   s=   |  j  t j | | | | | | | | |	 |
 | | | |   S(   s  

Create a new font object. Presumably, when rendering the EMF the
system tries to find a reasonable approximation to all the requested
attributes.

@param height: specified one of two ways:
 - if height>0: locate the font using the specified height as the typical cell height
 - if height<0: use the absolute value of the height as the typical glyph height.
@param width: typical glyph width.  If zero, the typical aspect ratio of the font is used.
@param escapement: angle, in degrees*10, of rendered string rotation.  Note that escapement and orientation must be the same.
@param orientation: angle, in degrees*10, of rendered string rotation.  Note that escapement and orientation must be the same.
@param weight: weight has (at least) the following values:
 - FW_DONTCARE
 - FW_THIN
 - FW_EXTRALIGHT
 - FW_ULTRALIGHT
 - FW_LIGHT
 - FW_NORMAL
 - FW_REGULAR
 - FW_MEDIUM
 - FW_SEMIBOLD
 - FW_DEMIBOLD
 - FW_BOLD
 - FW_EXTRABOLD
 - FW_ULTRABOLD
 - FW_HEAVY
 - FW_BLACK
@param italic: non-zero means try to find an italic version of the face.
@param underline: non-zero means to underline the glyphs.
@param strike_out: non-zero means to strike-out the glyphs.
@param charset: select the character set from the following list:
 - ANSI_CHARSET
 - DEFAULT_CHARSET
 - SYMBOL_CHARSET
 - SHIFTJIS_CHARSET
 - HANGEUL_CHARSET
 - HANGUL_CHARSET
 - GB2312_CHARSET
 - CHINESEBIG5_CHARSET
 - GREEK_CHARSET
 - TURKISH_CHARSET
 - HEBREW_CHARSET
 - ARABIC_CHARSET
 - BALTIC_CHARSET
 - RUSSIAN_CHARSET
 - EE_CHARSET
 - EASTEUROPE_CHARSET
 - THAI_CHARSET
 - JOHAB_CHARSET
 - MAC_CHARSET
 - OEM_CHARSET
@param out_precision: the precision of the face may have on of the
following values:
 - OUT_DEFAULT_PRECIS
 - OUT_STRING_PRECIS
 - OUT_CHARACTER_PRECIS
 - OUT_STROKE_PRECIS
 - OUT_TT_PRECIS
 - OUT_DEVICE_PRECIS
 - OUT_RASTER_PRECIS
 - OUT_TT_ONLY_PRECIS
 - OUT_OUTLINE_PRECIS
@param clip_precision: the precision of glyph clipping may have one of the
following values:
 - CLIP_DEFAULT_PRECIS
 - CLIP_CHARACTER_PRECIS
 - CLIP_STROKE_PRECIS
 - CLIP_MASK
 - CLIP_LH_ANGLES
 - CLIP_TT_ALWAYS
 - CLIP_EMBEDDED
@param quality: (subjective) quality of the font. Choose from the following
values:
 - DEFAULT_QUALITY
 - DRAFT_QUALITY
 - PROOF_QUALITY
 - NONANTIALIASED_QUALITY
 - ANTIALIASED_QUALITY
@param pitch_family: the pitch and family of the font face if the named font can't be found. Combine the pitch and style using a binary or.
 - Pitch:
   - DEFAULT_PITCH
   - FIXED_PITCH
   - VARIABLE_PITCH
   - MONO_FONT
 - Style:
   - FF_DONTCARE
   - FF_ROMAN
   - FF_SWISS
   - FF_MODERN
   - FF_SCRIPT
   - FF_DECORATIVE
@param name: ASCII string containing the name of the font face.
@return: handle of font.
@rtype: int
@type height: int
@type width: int
@type escapement: int
@type orientation: int
@type weight: int
@type italic: int
@type underline: int
@type strike_out: int
@type charset: int
@type out_precision: int
@type clip_precision: int
@type quality: int
@type pitch_family: int
@type name: string

        (   R  R   R  (   R/   R!   R    R  R  R  R  R  R  R  R  R  R  R  Rt   (    (    s&   code\common\utils\third_party\pyemf.pyt
   CreateFont<  s    pc         C   s,   t  j | | |  } |  j |  s( d Sd S(   s5  

Draw a string of text at the given position using the current FONT and
other text attributes.
@param x: x position of text.
@param y: y position of text.
@param text: ASCII text string to render.
@return: true of string successfully drawn.

@rtype: int
@type x: int
@type y: int
@type text: string

        i    i   (   R   R  R  (   R/   R   R   t   textR  (    (    s&   code\common\utils\third_party\pyemf.pyt   TextOut  s    N(N   R\   R]   R^   RV   R2   R   R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R	  R  R  R  R  R  R  R  R  R  R  R  R   R!  R"  R#  R%  R'  R)  R*  R&  R-  R.  R/  R0  R1  R2  R3  R4  R5  R6  R7  R8  R9  R:  R;  R<  Rp  R=  R>  R@  RB  RC  R  R  R  R  R  RD  RF  (    (    (    s&   code\common\utils\third_party\pyemf.pyR    s   1										
			$														
						)(									%		"			
				"									0rt   __main__(   t   OptionParsert   usages#   usage: %prog [options] emf-files...s   -vt   actiont
   store_truet   destRz   Rq   s   -sR  s   -ot   storet
   outputfileR|   c           B   s   e  Z e Z e Z d  Z RS(   N(   R\   R]   R:  Rz   R  R   RN  (    (    (    s&   code\common\utils\third_party\pyemf.pyR|     s   s   .out.emfs   Saving %s...s   %s saved successfully.s   problem saving %s!s   new.emf(   R^   t   __extra_epydoc_fields__R   t   syst   reRo   t	   cStringIOR   R   R   t
   __author__t   __author_email__t   __url__t   __download_url__t   __description__t   __keywords__t   __license__RA  t   BS_NULLt	   BS_HOLLOWt
   BS_HATCHEDt
   BS_PATTERNt
   BS_INDEXEDt   BS_DIBPATTERNt   BS_DIBPATTERNPTt   BS_PATTERN8X8t   BS_DIBPATTERN8X8t   BS_MONOPATTERNRB  t   HS_VERTICALt   HS_FDIAGONALt   HS_BDIAGONALt   HS_CROSSt   HS_DIAGCROSSt   MM_TEXTt   MM_LOMETRICt   MM_HIMETRICt   MM_LOENGLISHt   MM_HIENGLISHt   MM_TWIPSt   MM_ISOTROPICR  R  t   TRANSPARENTR  R  R
  t   WINDINGR	  R;  t   PS_DASHt   PS_DOTt
   PS_DASHDOTt   PS_DASHDOTDOTt   PS_NULLt   PS_INSIDEFRAMEt   PS_USERSTYLEt   PS_ALTERNATEt   PS_STYLE_MASKt   PS_ENDCAP_ROUNDt   PS_ENDCAP_SQUAREt   PS_ENDCAP_FLATt   PS_ENDCAP_MASKt   PS_JOIN_ROUNDt   PS_JOIN_BEVELt   PS_JOIN_MITERt   PS_JOIN_MASKt   PS_COSMETICt   PS_GEOMETRICt   PS_TYPE_MASKt   WHITE_BRUSHt   LTGRAY_BRUSHt
   GRAY_BRUSHt   DKGRAY_BRUSHt   BLACK_BRUSHt
   NULL_BRUSHt   HOLLOW_BRUSHt	   WHITE_PENt	   BLACK_PENt   NULL_PENt   OEM_FIXED_FONTt   ANSI_FIXED_FONTt   ANSI_VAR_FONTt   SYSTEM_FONTt   DEVICE_DEFAULT_FONTt   DEFAULT_PALETTEt   SYSTEM_FIXED_FONTt   DEFAULT_GUI_FONTR  t   TA_NOUPDATECPt   TA_UPDATECPt   TA_LEFTt   TA_RIGHTt	   TA_CENTERt   TA_TOPt	   TA_BOTTOMR  t   TA_RTLREADINGR  t   FW_DONTCAREt   FW_THINt   FW_EXTRALIGHTt   FW_ULTRALIGHTt   FW_LIGHTR  t
   FW_REGULARt	   FW_MEDIUMt   FW_SEMIBOLDt   FW_DEMIBOLDt   FW_BOLDt   FW_EXTRABOLDt   FW_ULTRABOLDt   FW_HEAVYt   FW_BLACKR  t   DEFAULT_CHARSETt   SYMBOL_CHARSETt   SHIFTJIS_CHARSETt   HANGEUL_CHARSETt   HANGUL_CHARSETt   GB2312_CHARSETt   CHINESEBIG5_CHARSETt   GREEK_CHARSETt   TURKISH_CHARSETt   HEBREW_CHARSETt   ARABIC_CHARSETt   BALTIC_CHARSETt   RUSSIAN_CHARSETt
   EE_CHARSETt   EASTEUROPE_CHARSETt   THAI_CHARSETt   JOHAB_CHARSETt   MAC_CHARSETt   OEM_CHARSETt   VISCII_CHARSETt   TCVN_CHARSETt   KOI8_CHARSETt   ISO3_CHARSETt   ISO4_CHARSETt   ISO10_CHARSETt   CELTIC_CHARSETt	   FS_LATIN1t	   FS_LATIN2t   FS_CYRILLICt   FS_GREEKt
   FS_TURKISHt	   FS_HEBREWt	   FS_ARABICt	   FS_BALTICt   FS_VIETNAMESEt   FS_THAIt   FS_JISJAPANt   FS_CHINESESIMPt
   FS_WANSUNGt   FS_CHINESETRADt   FS_JOHABt	   FS_SYMBOLR  t   OUT_STRING_PRECISt   OUT_CHARACTER_PRECISt   OUT_STROKE_PRECISt   OUT_TT_PRECISt   OUT_DEVICE_PRECISt   OUT_RASTER_PRECISt   OUT_TT_ONLY_PRECISt   OUT_OUTLINE_PRECISR  t   CLIP_CHARACTER_PRECISt   CLIP_STROKE_PRECISt	   CLIP_MASKt   CLIP_LH_ANGLESt   CLIP_TT_ALWAYSt   CLIP_EMBEDDEDR  t   DRAFT_QUALITYt   PROOF_QUALITYt   NONANTIALIASED_QUALITYt   ANTIALIASED_QUALITYR  t   FIXED_PITCHt   VARIABLE_PITCHt	   MONO_FONTR  t   FF_ROMANt   FF_SWISSt	   FF_MODERNt	   FF_SCRIPTt   FF_DECORATIVER  t   GM_ADVANCEDt   GM_LASTt   AD_COUNTERCLOCKWISEt   AD_CLOCKWISEt	   RGN_ERRORt   RGN_ANDt   RGN_ORt   RGN_XORt   RGN_DIFFRp  Rn  Ro  R  t   ICM_ONt	   ICM_QUERYR  R  R1  t   MWT_LEFTMULTIPLYt   MWT_RIGHTMULTIPLYR   R   R   R   R_   t   objectRu   R   R  t   dirRt   t   getattrR   R  t   callablet
   issubclassRk   R  R\   t   optparseRH  t   parsert
   add_optionRV   t
   parse_argst   optionst   argsR|   t   argvRO   R  Rz   R  R  R  RN  R   (    (    (    s&   code\common\utils\third_party\pyemf.pyt   <module>   s  $			)    	!     		
