本文整理汇总了Python中vsdblock.parse函数的典型用法代码示例。如果您正苦于以下问题:Python parse函数的具体用法?Python parse怎么用?Python parse使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parse函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Fill
def Fill (hd, size, value, off = 19):
add_iter(hd,"FillFG","%2x"%ord(value[off]),off,1,"B")
add_iter(hd,"FillFGClr","%02x%02x%02x"%(ord(value[off+1]),ord(value[off+2]),ord(value[off+3])),off+1,3,"clr")
add_iter(hd,"FillFGXparency","%d %%"%(ord(value[off+4])/2.55),off+4,1,"B")
add_iter(hd,"FillBG","%2x"%ord(value[off+5]),off+5,1,"B")
add_iter(hd,"FillBGClr","%02x%02x%02x"%(ord(value[off+6]),ord(value[off+7]),ord(value[off+8])),off+6,3,"clr")
add_iter(hd,"FillBGXparency","%d %%"%(ord(value[off+9])/2.55),off+9,1,"B")
add_iter(hd,"FillPattern","%2x"%ord(value[off+10]),off+10,1,"B")
add_iter(hd,"ShdwFG","%2x"%ord(value[off+11]),off+11,1,"B")
add_iter(hd,"ShdwFGClr","%02x%02x%02x"%(ord(value[off+12]),ord(value[off+13]),ord(value[off+14])),off+12,3,"clr")
add_iter(hd,"ShdwFGXparency","%d %%"%(ord(value[off+15])/2.56),off+15,1,"B")
add_iter(hd,"ShdwBG","%2x"%ord(value[off+16]),off+16,1,"B")
add_iter(hd,"ShdwBGClr","%02x%02x%02x"%(ord(value[off+17]),ord(value[off+18]),ord(value[off+19])),off+19,3,"clr")
add_iter(hd,"ShdwBGXparency","%d %%"%(ord(value[off+20])/2.55),off+20,1,"B")
add_iter(hd,"ShdwPattern","%2x"%ord(value[off+21]),off+21,1,"B")
add_iter(hd,"ShdwType","%2x"%ord(value[off+22]),off+22,1,"B")
if hd.version == 11:
add_iter(hd,"ShdwOffsetX","%.2f"%struct.unpack("<d",value[off+24:off+24+4]),off+24,8,"<d")
add_iter(hd,"ShdwOffsetY","%.2f"%struct.unpack("<d",value[off+33:off+33+4]),off+33,8,"<d")
add_iter(hd,"ShdwObliqueAngle","%.2f"%struct.unpack("<d",value[off+42:off+42+4]),off+42+4,8,"<d")
add_iter(hd,"ShdwScaleFactor","%.2f"%struct.unpack("<d",value[off+50:off+50+4]),off+50,8,"<d")
if hd.version == 6 and len(value)>off+25:
vsdblock.parse(hd, size, value, off+25)
elif len(value)>off+61 and hd.version == 11:
vsdblock.parse(hd, size, value, off+61)
示例2: StyleProps
def StyleProps (hd, size, value, off = 19):
add_iter(hd,"Use Line",ord(value[off]),off,1,"<B")
add_iter(hd,"Use Fill",ord(value[off+1]),off+1,1,"<B")
add_iter(hd,"Use Text",ord(value[off+2]),off+2,1,"<B")
add_iter(hd,"Hidden",ord(value[off+3]),off+3,1,"<B")
if len(value)>off+7:
vsdblock.parse(hd, size, value, off+7)
示例3: InfLine
def InfLine (hd, size, value, off = 19):
add_iter(hd,"X","%.2f"%struct.unpack("<d",value[off+1:off+1+8]),off+1,8,"<d")
add_iter(hd,"Y","%.2f"%struct.unpack("<d",value[off+10:off+10+8]),off+10,8,"<d")
add_iter(hd,"A","%.2f"%struct.unpack("<d",value[off+19:off+19+8]),off+19,8,"<d")
add_iter(hd,"B","%.2f"%struct.unpack("<d",value[off+28:off+28+8]),off+28,8,"<d")
if len(value)>off+38: # both 6 and 11 ???
vsdblock.parse(hd, size, value, off+38)
示例4: ConnPts
def ConnPts (hd, size, value, off = 19):
add_iter(hd,"X","%.2f"%struct.unpack("<d",value[off+1:off+1+8]),off+1,8,"<d")
add_iter(hd,"Y","%.2f"%struct.unpack("<d",value[off+10:off+10+8]),off+10,8,"<d")
add_iter(hd,"var1","%.2f"%struct.unpack("<d",value[off+19:off+19+8]),off+19,8,"<d")
add_iter(hd,"var2","%.2f"%struct.unpack("<d",value[off+28:off+28+8]),off+28,8,"<d")
if len(value)>off+0x30: # 11
vsdblock.parse(hd, size, value, off+0x30)
示例5: TextField
def TextField (hd, size, value, off = 19):
fmt = ord(value[off+7])
tdiff = struct.unpack("<d",value[off+8:off+8+8])[0]
dlen = 8
dfmt = "<d"
if fmt == 0x28:
dt = datetime.datetime(1899,12,30)+datetime.timedelta(tdiff)
dname = "Date"
elif fmt == 0xe8:
dt = struct.unpack("<I",value[off+8:off+8+4])[0]
dname = "Name ID"
dlen = 4
dfmt = "<I"
else:
dt = "%.2f"%tdiff
dname = "Value"
fmtidtype = ord(value[off+17])
if fmtidtype == 0xe8:
fmtid = struct.unpack("<I",value[off+18:off+18+4])[0]
fmtname = "Format ID"
fmtlen = 4
fmtfmt = "<I"
add_iter(hd,dname,dt,off+8,dlen,dfmt)
add_iter(hd,fmtname,fmtid,off+18,fmtlen,fmtfmt)
dtype = struct.unpack("<H",value[off+26:off+26+2])[0]
add_iter(hd,"Type",dtype,off+26,2,"<H")
add_iter(hd,"UICat","0x%02x"%ord(value[off+28]),off+28,1,"B")
add_iter(hd,"UICod","0x%02x"%ord(value[off+29]),off+29,1,"B")
add_iter(hd,"UIFmt","0x%02x"%ord(value[off+30]),off+30,1,"B")
if hd.version == 6 and len(value)>off+36:
vsdblock.parse(hd, size, value, off+36)
elif len(value)>off+54 and hd.version == 11:
vsdblock.parse(hd, size, value, off+54)
示例6: XForm1D
def XForm1D (hd, size, value, off = 19):
add_iter(hd,"BeginX","%.2f"%struct.unpack("<d",value[off+1:off+1+8]),off+1,8,"<d")
add_iter(hd,"BeginY","%.2f"%struct.unpack("<d",value[off+10:off+10+8]),off+10,8,"<d")
add_iter(hd,"EndX","%.2f"%struct.unpack("<d",value[off+19:off+19+8]),off+19,8,"<d")
add_iter(hd,"EndY","%.2f"%struct.unpack("<d",value[off+28:off+28+8]),off+28,8,"<d")
if len(value)>off+38: # both 6 and 11
vsdblock.parse(hd, size, value, off+38)
示例7: Geometry
def Geometry (hd, size, value, off = 19):
flags = ord(value[off])
for i in (1,2,4,8,32):
res = 'No'
if flags&i:
res = 'Yes'
add_iter(hd,bits[i],res,off,1,"txt")
if len(value)>off+3:
vsdblock.parse(hd, size, value, off+3)
示例8: EllArcTo
def EllArcTo (hd, size, value, off = 19):
add_iter(hd,"X","%.2f"%struct.unpack("<d",value[off+1:off+1+8]),off+1,8,"<d")
add_iter(hd,"Y","%.2f"%struct.unpack("<d",value[off+10:off+10+8]),off+10,8,"<d")
add_iter(hd,"A","%.2f"%struct.unpack("<d",value[off+19:off+19+8]),off+19,8,"<d")
add_iter(hd,"B","%.2f"%struct.unpack("<d",value[off+28:off+28+8]),off+28,8,"<d")
add_iter(hd,"C","%.2f"%struct.unpack("<d",value[off+37:off+37+8]),off+37,8,"<d")
add_iter(hd,"D","%.2f"%struct.unpack("<d",value[off+46:off+46+8]),off+46,8,"<d")
if len(value)>off+56: # both 6 and 11
vsdblock.parse(hd, size, value, off+56)
示例9: SplineStart
def SplineStart (hd, size, value, off = 19):
add_iter(hd,"X","%.2f"%struct.unpack("<d",value[off+1:off+1+8]),off+1,8,"<d")
add_iter(hd,"Y","%.2f"%struct.unpack("<d",value[off+10:off+10+8]),off+10,8,"<d")
add_iter(hd,"Knot","%.2f"%struct.unpack("<d",value[off+18:off+18+8]),off+18,8,"<d")
add_iter(hd,"Knot2","%.2f"%struct.unpack("<d",value[off+26:off+26+8]),off+26,8,"<d")
add_iter(hd,"Knot3","%.2f"%struct.unpack("<d",value[off+34:off+34+8]),off+34,8,"<d")
add_iter(hd,"Degree","%d"%struct.unpack("<h",value[off+42:off+42+2]),off+42,2,"<h")
if len(value)>off+46:
vsdblock.parse(hd, size, value, off+46)
示例10: Char
def Char (hd, size, value, off = 19):
add_iter(hd,"Num of Chars","%d"%struct.unpack("<I",value[off:off+4]),off,4,"<I")
add_iter(hd,"FontID","0x%02x"%struct.unpack("<H",value[off+4:off+4+2]),off+4,2,"<H")
add_iter(hd,"ColorID","0x%02x"%ord(value[off+6]),off+6,1,"B")
add_iter(hd,"Color","%02x%02x%02x"%(ord(value[off+7]),ord(value[off+8]),ord(value[off+9])),off+7,3,"clr")
add_iter(hd,"Transparency","%d%%"%(ord(value[off+10])*100/256),off+10,1,"B")
flags1 = ord(value[off+11])
ftxt = ""
if flags1&1 == 1:
ftxt += "bold "
if flags1&2== 2:
ftxt += "italic "
if flags1&4 == 4:
ftxt += "undrline "
if flags1&8 == 8:
ftxt += "smcaps "
add_iter(hd,"Font Mods1",ftxt,off+11,1,"txt")
flags2 = ord(value[off+12])
ftxt = ""
if flags2&1 == 1:
ftxt += "allcaps "
if flags2&2== 2:
ftxt += "initcaps "
add_iter(hd,"Font Mods2",ftxt,off+12,1,"txt")
flags3 = ord(value[off+13])
ftxt = ""
if flags3&1 == 1:
ftxt += "superscript "
if flags3&2== 2:
ftxt += "subscript "
add_iter(hd,"Font Mods3",ftxt,off+12,1,"txt")
add_iter(hd,"Scale","%d%%"%(struct.unpack("<h",value[off+13:off+13+2])[0]/100.),off+13,2,"<h")
add_iter(hd,"FontSize","%.2f pt"%(72*struct.unpack("<d",value[off+18:off+18+8])[0]),off+18,8,"<d")
flags4 = ord(value[off+26])
ftxt = ""
if flags4&1 == 1:
ftxt += "dblunder "
if flags4&2== 2:
ftxt += "overline "
if flags4&20 == 20:
ftxt += "dblstrike "
add_iter(hd,"Font Mods4",ftxt,off+26,1,"txt")
add_iter(hd,"Spacing","%d pt"%(struct.unpack("<h",value[off+27:off+27+2])[0]/200.),off+27,2,"<h")
if hd.version == 11:
add_iter(hd,"AsianFont","%d"%ord(value[off+37]),off+37,1,"B")
add_iter(hd,"ComplexScriptFont","%d"%ord(value[off+39]),off+39,1,"B")
add_iter(hd,"LocalizeFont","%d"%ord(value[off+41]),off+41,1,"B")
add_iter(hd,"ComplexScriptSize","%d%%"%(struct.unpack("<d",value[off+43:off+43+8])[0]*100),off+43,8,"<d")
add_iter(hd,"LangID","%d"%struct.unpack("<I",value[off+69:off+69+4]),off+69,4,"<I")
if len(value)>off+88 and hd.version == 11:
vsdblock.parse(hd, size, value, off+88)
elif hd.version == 6 and len(value)>off+35:
vsdblock.parse(hd, size, value, off+35)
示例11: Ellipse
def Ellipse (hd, size, value, off = 19):
add_iter(hd,"Center X","%.2f"%struct.unpack("<d",value[off+1:off+1+8]),off+1,8,"<d")
add_iter(hd,"Center Y","%.2f"%struct.unpack("<d",value[off+10:off+10+8]),off+10,8,"<d")
add_iter(hd,"Right X","%.2f"%struct.unpack("<d",value[off+19:off+19+8]),off+19,8,"<d")
add_iter(hd,"Right Y","%.2f"%struct.unpack("<d",value[off+28:off+28+8]),off+28,8,"<d")
add_iter(hd,"Top X","%.2f"%struct.unpack("<d",value[off+37:off+37+8]),off+37,8,"<d")
add_iter(hd,"Top Y","%.2f"%struct.unpack("<d",value[off+46:off+46+8]),off+46,8,"<d")
if len(value)>off+56: # both 6 and 11
vsdblock.parse(hd, size, value, off+56)
示例12: TxtXForm
def TxtXForm (hd, size, value, off = 19):
add_iter(hd,"TxtPinX","%.2f"%struct.unpack("<d",value[off+1:off+1+8]),off+1,8,"<d")
add_iter(hd,"TxtPinY","%.2f"%struct.unpack("<d",value[off+10:off+10+8]),off+10,8,"<d")
add_iter(hd,"TxtWidth","%.2f"%struct.unpack("<d",value[off+19:off+19+8]),off+19,8,"<d")
add_iter(hd,"TxtHeight","%.2f"%struct.unpack("<d",value[off+28:off+28+8]),off+28,8,"<d")
add_iter(hd,"TxtLocPinX","%.2f"%struct.unpack("<d",value[off+37:off+37+8]),off+37,8,"<d")
add_iter(hd,"TxtLocPinY","%.2f"%struct.unpack("<d",value[off+46:off+46+8]),off+46,8,"<d")
add_iter(hd,"TxtAngle","%.2f"%struct.unpack("<d",value[off+55:off+55+8]),off+55,8,"<d")
if len(value)>off+69: # both 6 and 11
vsdblock.parse(hd, size, value, off+69)
示例13: Control
def Control (hd, size, value, off = 19):
add_iter(hd,"X","%.3f"%struct.unpack("<d",value[off+1:off+1+8]),off+1,8,"<d")
add_iter(hd,"Y","%.3f"%struct.unpack("<d",value[off+10:off+10+8]),off+10,8,"<d")
add_iter(hd,"XDyn","%.3f"%struct.unpack("<d",value[off+19:off+19+8]),off+19,8,"<d")
add_iter(hd,"YDyn","%.3f"%struct.unpack("<d",value[off+28:off+28+8]),off+28,8,"<d")
add_iter(hd,"XCon",ord(value[off+36]),off+36,1,"<B")
add_iter(hd,"YCon",ord(value[off+37]),off+37,1,"<B")
add_iter(hd,"CanGlue",ord(value[off+38]),off+38,1,"<B")
if len(value)>off+47: # 11
vsdblock.parse(hd, size, value, off+47)
示例14: Polyline
def Polyline (hd, size, value, off = 19):
add_iter(hd,"X","%.2f"%struct.unpack("<d",value[off+1:off+1+8]),off+1,8,"<d")
add_iter(hd,"Y","%.2f"%struct.unpack("<d",value[off+10:off+10+8]),off+10,8,"<d")
sdflag = value[off+19:off+19+4]
sdtext = 'No'
if sdflag == '\x8b\x02\x00\x00':
sdtext = 'Yes'
add_iter(hd,"Use Shape Data",sdtext,off+19,4,"<I")
add_iter(hd,"ShapeData Id","%02x"%struct.unpack("<I",value[off+23:off+23+4]),off+23,4,"<I")
if len(value)>off+29:
vsdblock.parse(hd, size, value, off+29)
示例15: FrgnType
def FrgnType (hd, size, value, off = 19):
add_iter(hd,"ImgOffsetX","%.2f"%struct.unpack("<d",value[off+1:off+1+8]),off+1,8,"<d")
add_iter(hd,"ImgOffsetY","%.2f"%struct.unpack("<d",value[off+10:off+10+8]),off+10,8,"<d")
add_iter(hd,"ImgWidth","%.2f"%struct.unpack("<d",value[off+19:off+19+8]),off+19,8,"<d")
add_iter(hd,"ImgHeight","%.2f"%struct.unpack("<d",value[off+28:off+28+8]),off+28,8,"<d")
ftype = struct.unpack("<h",value[off+36:off+36+2])[0]
add_iter(hd,"Type ??","%d"%ftype,off+36,2,"<h")
add_iter(hd,"MapMode","%d"%struct.unpack("<h",value[off+38:off+38+2]),off+38,2,"<h")
if ftype == 4:
add_iter(hd,"ExtentX","%d"%struct.unpack("<h",value[off+40:off+40+2]),off+40,2,"<h")
add_iter(hd,"ExtentY","%d"%struct.unpack("<h",value[off+42:off+42+2]),off+42,2,"<h")
if len(value)>off+62:
vsdblock.parse(hd, size, value, off+62)