#NEWLINE# def drawImage( self , img , * args ) : #NEWLINE# #INDENT# if isinstance ( img , Widget ) : #NEWLINE# #INDENT# img = img . getElement ( ) #NEWLINE# #UNINDENT# fullWidth = img . width #NEWLINE# fullHeight = img . height #NEWLINE# if ( len ( args ) == 8 ) : #NEWLINE# #INDENT# sourceX = args [ 0 ] #NEWLINE# sourceY = args [ 1 ] #NEWLINE# sourceWidth = args [ 2 ] #NEWLINE# sourceHeight = args [ 3 ] #NEWLINE# destX = args [ 4 ] #NEWLINE# destY = args [ 5 ] #NEWLINE# destWidth = args [ 6 ] #NEWLINE# destHeight = args [ 7 ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( len ( args ) == 4 ) : #NEWLINE# #INDENT# sourceX = 0 #NEWLINE# sourceY = 0 #NEWLINE# sourceWidth = fullWidth #NEWLINE# sourceHeight = fullHeight #NEWLINE# destX = args [ 0 ] #NEWLINE# destY = args [ 1 ] #NEWLINE# destWidth = args [ 2 ] #NEWLINE# destHeight = args [ 3 ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( len ( args ) == 2 ) : #NEWLINE# #INDENT# sourceX = 0 #NEWLINE# sourceY = 0 #NEWLINE# sourceWidth = fullWidth #NEWLINE# sourceHeight = fullHeight #NEWLINE# destX = args [ 0 ] #NEWLINE# destY = args [ 1 ] #NEWLINE# destWidth = fullWidth #NEWLINE# destHeight = fullHeight #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# vmlStr = [ ] #NEWLINE# vmlStr . append ( '<v:group style="position:absolute;width:10;height:10;' ) #NEWLINE# dX = self . getCoordX ( self . matrix , destX , destY ) #NEWLINE# dY = self . getCoordY ( self . matrix , destX , destY ) #NEWLINE# if ( ( self . context . matrix [ 0 ] != 1 ) or ( self . context . matrix [ 1 ] != 0 ) ) : #NEWLINE# #INDENT# vmlStr . append ( 'padding-right:' ) #NEWLINE# vmlStr . append ( ( str ( self . parentWidth ) + 'px;' ) ) #NEWLINE# vmlStr . append ( 'padding-bottom:' ) #NEWLINE# vmlStr . append ( ( str ( self . parentHeight ) + 'px;' ) ) #NEWLINE# vmlStr . append ( "filter:progid:DXImageTransform.Microsoft.Matrix(M11='" ) #NEWLINE# vmlStr . append ( ( '' + str ( self . matrix [ 0 ] ) ) ) #NEWLINE# vmlStr . append ( "'," ) #NEWLINE# vmlStr . append ( "M12='" ) #NEWLINE# vmlStr . append ( ( '' + str ( self . matrix [ 1 ] ) ) ) #NEWLINE# vmlStr . append ( "'," ) #NEWLINE# vmlStr . append ( "M21='" ) #NEWLINE# vmlStr . append ( str ( self . matrix [ 3 ] ) ) #NEWLINE# vmlStr . append ( "'," ) #NEWLINE# vmlStr . append ( "M22='" ) #NEWLINE# vmlStr . append ( str ( self . matrix [ 4 ] ) ) #NEWLINE# vmlStr . append ( "'," ) #NEWLINE# vmlStr . append ( "Dx='" ) #NEWLINE# vmlStr . append ( str ( math . floor ( ( dX / 10 ) ) ) ) #NEWLINE# vmlStr . append ( "'," ) #NEWLINE# vmlStr . append ( "Dy='" ) #NEWLINE# vmlStr . append ( str ( math . floor ( ( dY / 10 ) ) ) ) #NEWLINE# vmlStr . append ( "', SizingMethod='clip');" ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# vmlStr . append ( 'left:' ) #NEWLINE# vmlStr . append ( ( '%dpx;' % int ( ( dX / 10 ) ) ) ) #NEWLINE# vmlStr . append ( 'top:' ) #NEWLINE# vmlStr . append ( ( '%dpx' % int ( ( dY / 10 ) ) ) ) #NEWLINE# #UNINDENT# vmlStr . append ( '" coordsize="100,100" coordorigin="0,0"><v:image src="' ) #NEWLINE# vmlStr . append ( DOM . getAttribute ( img , 'src' ) ) #NEWLINE# vmlStr . append ( '" style="' ) #NEWLINE# vmlStr . append ( 'width:' ) #NEWLINE# vmlStr . append ( str ( int ( ( destWidth * 10 ) ) ) ) #NEWLINE# vmlStr . append ( ';height:' ) #NEWLINE# vmlStr . append ( str ( int ( ( destHeight * 10 ) ) ) ) #NEWLINE# vmlStr . append ( ';" cropleft="' ) #NEWLINE# vmlStr . append ( str ( ( sourceX / fullWidth ) ) ) #NEWLINE# vmlStr . append ( '" croptop="' ) #NEWLINE# vmlStr . append ( str ( ( sourceY / fullHeight ) ) ) #NEWLINE# vmlStr . append ( '" cropright="' ) #NEWLINE# vmlStr . append ( str ( ( ( ( fullWidth - sourceX ) - sourceWidth ) / fullWidth ) ) ) #NEWLINE# vmlStr . append ( '" cropbottom="' ) #NEWLINE# vmlStr . append ( str ( ( ( ( fullHeight - sourceY ) - sourceHeight ) / fullHeight ) ) ) #NEWLINE# vmlStr . append ( '"/></v:group>' ) #NEWLINE# self . insert ( 'BeforeEnd' , '' . join ( vmlStr ) )