/usr/lib/python2.6/site-packages/tablib/packages/xlwt
Edit: /usr/lib/python2.6/site-packages/tablib/packages/xlwt/Bitmap.pyc (7723B)
Ñò
}DVc @ sn d d k l Z d d k Td „ Z d „ Z d „ Z d e f d „ ƒ YZ d „ Z d e f d
„ ƒ YZ d S( iÿÿÿÿ( t
BiffRecord( t *c C s
| i | ƒ S( N( t col_width( t sheett col( ( s; /tmp/pip-build-lt8jXN/tablib/tablib/packages/xlwt/Bitmap.pyt _size_col s c C s
| i | ƒ S( N( t
row_height( R t row( ( s; /tmp/pip-build-lt8jXN/tablib/tablib/packages/xlwt/Bitmap.pyt _size_row s c C s x8 | t | | ƒ j o! | t | | ƒ 8} | d 7} q Wx8 | t | | ƒ j o! | t | | ƒ 8} | d 7} q> W| } | } | | d } | | d } x8 | t | | ƒ j o! | t | | ƒ 8} | d 7} q¡ Wx8 | t | | ƒ j o! | t | | ƒ 8} | d 7} qÜ Wt | | ƒ d j pB t | | ƒ d j p, t | | ƒ d j p t | | ƒ d j o d St t | ƒ t | | ƒ d ƒ } t t | ƒ t | | ƒ d ƒ } t t | ƒ t | | ƒ d ƒ } t t | ƒ t | | ƒ d ƒ }
| | | | | | | |
f S( sú Calculate the vertices that define the position of the image as required by
the OBJ record.
+------------+------------+
| A | B |
+-----+------------+------------+
| |(x1,y1) | |
| 1 |(A1)._______|______ |
| | | | |
| | | | |
+-----+----| BITMAP |-----+
| | | | |
| 2 | |______________. |
| | | (B2)|
| | | (x2,y2)|
+---- +------------+------------+
Example of a bitmap that covers some of the area from cell A1 to cell B2.
Based on the width and height of the bitmap we need to calculate 8 vars:
col_start, row_start, col_end, row_end, x1, y1, x2, y2.
The width and height of the cells are also variable and have to be taken into
account.
The values of col_start and row_start are passed in from the calling
function. The values of col_end and row_end are calculated by subtracting
the width and height of the bitmap from the width and height of the
underlying cells.
The vertices are expressed as a percentage of the underlying cell width as
follows (rhs values are in pixels):
x1 = X / W *1024
y1 = Y / H *256
x2 = (X-1) / W *1024
y2 = (Y-1) / H *256
Where: X is distance from the left side of the underlying cell
Y is distance from the top of the underlying cell
W is the width of the cell
H is the height of the cell
Note: the SDK incorrectly states that the height should be expressed as a
percentage of 1024.
col_start - Col containing upper left corner of object
row_start - Row containing top left corner of object
x1 - Distance to left side of object
y1 - Distance to top of object
width - Width of image frame
height - Height of image frame
i i Ni i ( R R t intt float( R t row_startt col_startt x1t y1t widtht heightt row_endt col_endt x2t y2( ( s; /tmp/pip-build-lt8jXN/tablib/tablib/packages/xlwt/Bitmap.pyt _position_image s8 5 ,,####t ObjBmpRecordc B s e Z d Z d „ Z RS( i] c 3 C sM | i | } | i | }
t | | | | | | |
ƒ } | \ } }
} } } } } } d } d } d } d } | } |
} | } | } | } | } | } | } d } d }! d }" d }# d }$ d }% d }&