def DibCreatePatternBrush(ctx, page, i): h, biWidth, biHeight, biSize, bshift, data = page.cmds[i].args eo = mfpage.mfobj() eo.type = 2 eo.style = 3 ## pattern brush eo.data = biWidth, biHeight, biSize, bshift, data ## temporary assume 1 bpp image page.mfobjs[h] = eo
def DibCreatePatternBrush(ctx,page,i): h,biWidth,biHeight,biSize,bshift,data = page.cmds[i].args eo = mfpage.mfobj() eo.type = 2 eo.style = 3 ## pattern brush eo.data = biWidth,biHeight,biSize,bshift,data ## temporary assume 1 bpp image page.mfobjs[h]=eo
def CreateBrushIndirect(ctx,page,i): bgclr = mfpage.color() h,bgclr.r,bgclr.g,bgclr.b = page.cmds[i].args eo = mfpage.mfobj() eo.type = 2 eo.clr = bgclr page.mfobjs[h]=eo print i,'Brush: ',bgclr.r,bgclr.g,bgclr.b,' Handle: ',h
def CreatePalette(ctx, page, i): h, numofclr, data = page.cmds[i].args eo = mfpage.mfobj() eo.type = 4 for j in range(numofclr): clr = mfpage.color() clr.r, clr.g, clr.b = data[j * 4], data[j * 4 + 1], data[j * 4 + 2] page.palette[j] = clr page.mfobjs[h] = eo
def CreatePalette(ctx,page,i): h,numofclr,data = page.cmds[i].args eo = mfpage.mfobj() eo.type = 4 for j in range(numofclr): clr = mfpage.color() clr.r,clr.g,clr.b = data[j*4],data[j*4+1],data[j*4+2] page.palette[j]=clr page.mfobjs[h]=eo
def ExtCreatePen(ctx,page,i): fgclr = mfpage.color() h,fgclr.r,fgclr.g,fgclr.b = page.cmds[i].args eo = mfpage.mfobj() eo.type = 1 eo.clr = fgclr eo.width = 5. ## what is default? page.mfobjs[h]=eo print i,'ExtPen: ',fgclr.r,fgclr.g,fgclr.b,' Handle: ',h
def CreatePen(ctx,page,i): fgclr = mfpage.color() h,fgclr.r,fgclr.g,fgclr.b,width = page.cmds[i].args eo = mfpage.mfobj() eo.type = 1 eo.clr = fgclr eo.width = width page.mfobjs[h]=eo print i,'Pen: ',fgclr.r,fgclr.g,fgclr.b,' Handle: ',h
def CreateBrushIndirect(ctx, page, i): bgclr = mfpage.color() h, bgclr.r, bgclr.g, bgclr.b, flag, lbStyle, lbHatch = page.cmds[i].args eo = mfpage.mfobj() eo.type = 2 eo.clr = bgclr eo.style = lbStyle eo.hatch = lbHatch eo.flag = flag page.mfobjs[h] = eo
def CreatePen(ctx, page, i): fgclr = mfpage.color() h, fgclr.r, fgclr.g, fgclr.b, flag, width, style = page.cmds[i].args eo = mfpage.mfobj() eo.type = 1 eo.clr = fgclr eo.width = width eo.style = style eo.flag = flag page.mfobjs[h] = eo
def CreateBrushIndirect(ctx,page,i): bgclr = mfpage.color() h,bgclr.r,bgclr.g,bgclr.b,flag,lbStyle,lbHatch = page.cmds[i].args eo = mfpage.mfobj() eo.type = 2 eo.clr = bgclr eo.style = lbStyle eo.hatch = lbHatch eo.flag = flag page.mfobjs[h]=eo
def CreatePen(ctx,page,i): fgclr = mfpage.color() h,fgclr.r,fgclr.g,fgclr.b,flag,width,style = page.cmds[i].args eo = mfpage.mfobj() eo.type = 1 eo.clr = fgclr eo.width = width eo.style = style eo.flag = flag page.mfobjs[h]=eo
def ExtCreateFontIndirectW(ctx,page,i): h = page.cmds[i].args[0] size = page.cmds[i].args[1] if size <0: size = -size weight = page.cmds[i].args[5] italic = page.cmds[i].args[6] font = page.cmds[i].args[14] font = unicode(font,'utf-16').encode('utf-8') pos = font.find('\x00') font = font[0:pos] eo = mfpage.mfobj() eo.type = 3 eo.font = font eo.italic = italic eo.size = size eo.weight = weight page.mfobjs[h]=eo print i,'Font: ',font,italic,weight,page.cmds[i].args[1],' Handle: ',h
def CreateFontIndirect(ctx, page, i): h = page.cmds[i].args[0] eo = mfpage.mfobj() eo.type = 3 size = page.cmds[i].args[1][0] if size < 0: size = -size if size == 0: size = 12 eo.size = size eo.weight = page.cmds[i].args[1][4] eo.escape = page.cmds[i].args[1][2] eo.orient = page.cmds[i].args[1][3] eo.italic = page.cmds[i].args[1][5] eo.under = page.cmds[i].args[1][6] eo.strike = page.cmds[i].args[1][7] eo.charset = page.cmds[i].args[1][8] font = page.cmds[i].args[2] pos = font.find('\x00') font = font[0:pos] eo.font = font page.mfobjs[h] = eo
def CreateFontIndirect(ctx,page,i): h = page.cmds[i].args[0] eo = mfpage.mfobj() eo.type = 3 size = page.cmds[i].args[1][0] if size < 0: size = -size if size == 0: size = 12 eo.size = size eo.weight = page.cmds[i].args[1][4] eo.escape = page.cmds[i].args[1][2] eo.orient = page.cmds[i].args[1][3] eo.italic = page.cmds[i].args[1][5] eo.under = page.cmds[i].args[1][6] eo.strike = page.cmds[i].args[1][7] eo.charset = page.cmds[i].args[1][8] font = page.cmds[i].args[2] pos = font.find('\x00') font = font[0:pos] eo.font = font page.mfobjs[h]=eo
def CreateFontIndirect(ctx,page,i): h = page.cmds[i].args[0] eo = mfpage.mfobj() eo.type = 3 size = page.cmds[i].args[1] if size < 0: size = -size if size == 0: size = 12 eo.size = size eo.weight = page.cmds[i].args[5] eo.escape = page.cmds[i].args[3] ##!!!!! eo.orient = page.cmds[i].args[4] ##!!!!! eo.italic = page.cmds[i].args[6] eo.under = page.cmds[i].args[7] eo.strike = page.cmds[i].args[8] font = page.cmds[i].args[14] font = unicode(font,'utf-16').encode('utf-8') pos = font.find('\x00') font = font[0:pos] eo.font = font page.mfobjs[h]=eo print 'CreateFontIndirect'