本文整理汇总了Python中utils.mult_matrix函数的典型用法代码示例。如果您正苦于以下问题:Python mult_matrix函数的具体用法?Python mult_matrix怎么用?Python mult_matrix使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mult_matrix函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: do_Do
def do_Do(self, xobjid):
xobjid = literal_name(xobjid)
try:
xobj = stream_value(self.xobjmap[xobjid])
except KeyError:
if STRICT:
raise PDFInterpreterError('Undefined xobject id: %r' % xobjid)
return
if 1 <= self.debug:
print >>sys.stderr, 'Processing xobj: %r' % xobj
subtype = xobj.get('Subtype')
if subtype is LITERAL_FORM and 'BBox' in xobj:
interpreter = self.dup()
bbox = list_value(xobj['BBox'])
matrix = list_value(xobj.get('Matrix', MATRIX_IDENTITY))
# According to PDF reference 1.7 section 4.9.1, XObjects in
# earlier PDFs (prior to v1.2) use the page's Resources entry
# instead of having their own Resources entry.
resources = dict_value(xobj.get('Resources')) or self.resources.copy()
self.device.begin_figure(xobjid, bbox, matrix)
interpreter.render_contents(resources, [xobj], ctm=mult_matrix(matrix, self.ctm))
self.device.end_figure(xobjid)
elif subtype is LITERAL_IMAGE and 'Width' in xobj and 'Height' in xobj:
self.device.begin_figure(xobjid, (0,0,1,1), MATRIX_IDENTITY)
self.device.render_image(xobjid, xobj)
self.device.end_figure(xobjid)
else:
# unsupported xobject type.
pass
return
开发者ID:srbbins,项目名称:ETD_Processing_Scripts,代码行数:30,代码来源:pdfinterp_altered.py
示例2: do_Do
def do_Do(self, xobjid):
xobjid = literal_name(xobjid)
try:
xobj = stream_value(self.xobjmap[xobjid])
except KeyError:
if STRICT:
raise PDFInterpreterError("Undefined xobject id: %r" % xobjid)
return
if 1 <= self.debug:
print >> stderr, "Processing xobj: %r" % xobj
subtype = xobj.dic.get("Subtype")
if subtype is LITERAL_FORM and "BBox" in xobj.dic:
interpreter = self.dup()
(x0, y0, x1, y1) = list_value(xobj.dic["BBox"])
ctm = mult_matrix(list_value(xobj.dic.get("Matrix", MATRIX_IDENTITY)), self.ctm)
(x0, y0) = apply_matrix(ctm, (x0, y0))
(x1, y1) = apply_matrix(ctm, (x1, y1))
bbox = (x0, y0, x1, y1)
self.device.begin_figure(xobjid, bbox)
interpreter.render_contents(dict_value(xobj.dic.get("Resources")), [xobj], ctm=ctm)
self.device.end_figure(xobjid)
elif subtype is LITERAL_IMAGE and "Width" in xobj.dic and "Height" in xobj.dic:
(x0, y0) = apply_matrix(self.ctm, (0, 0))
(x1, y1) = apply_matrix(self.ctm, (1, 1))
self.device.begin_figure(xobjid, (x0, y0, x1, y1))
(w, h) = (xobj.dic["Width"], xobj.dic["Height"])
self.device.render_image(xobj, (w, h), self.ctm)
self.device.end_figure(xobjid)
else:
# unsupported xobject type.
pass
return
开发者ID:marc-truitt,项目名称:pypes,代码行数:32,代码来源:pdfinterp.py
示例3: render_string
def render_string(self, textstate, seq):
matrix = mult_matrix(textstate.matrix, self.ctm)
font = textstate.font
fontsize = textstate.fontsize
scaling = textstate.scaling * .01
charspace = textstate.charspace * scaling
wordspace = textstate.wordspace * scaling
if font.is_multibyte():
wordspace = 0
dxscale = .001 * fontsize * scaling
if font.is_vertical():
textstate.linematrix = self.render_string_vertical(
seq, matrix, textstate.linematrix, font, fontsize, scaling, charspace, wordspace, dxscale)
else:
textstate.linematrix = self.render_string_horizontal(
seq, matrix, textstate.linematrix, font, fontsize, scaling, charspace, wordspace, dxscale)
return
开发者ID:joshmgrant,项目名称:pdfminer,代码行数:17,代码来源:pdfdevice.py
示例4: render_string
def render_string(self, textstate, textmatrix, seq):
font = textstate.font
text = []
textmatrix = mult_matrix(textmatrix, self.ctm)
for x in seq:
if isinstance(x, int) or isinstance(x, float):
text.append((None, None, x))
else:
chars = font.decode(x)
for cid in chars:
try:
char = font.to_unicode(cid)
except PDFUnicodeNotDefined, e:
(cidcoding, cid) = e.args
char = self.handle_undefined_char(cidcoding, cid)
text.append((char, cid, font.char_disp(cid)))
if cid == 32 and not font.is_multibyte():
if text:
item = TextItem(textmatrix, font, textstate.fontsize, textstate.charspace, textstate.scaling, text)
self.cur_item.add(item)
(dx,dy) = item.adv
dx += textstate.wordspace * textstate.scaling * .01
textmatrix = translate_matrix(textmatrix, (dx, dy))
text = []
开发者ID:Big-Data,项目名称:pypes,代码行数:24,代码来源:pdfdevice.py
示例5: begin_figure
def begin_figure(self, name, bbox, matrix):
self._stack.append(self.cur_item)
self.cur_item = LTFigure(name, bbox, mult_matrix(matrix, self.ctm))
return
开发者ID:bradleyayers,项目名称:pdfminer,代码行数:4,代码来源:converter.py
示例6: do_Do
def do_Do(self, xobjid):
xobjid = literal_name(xobjid)
try:
xobj = stream_value(self.xobjmap[xobjid])
except KeyError:
if STRICT:
raise PDFInterpreterError('Undefined xobject id: %r' % xobjid)
return
if 1 <= self.debug:
print >>stderr, 'Processing xobj: %r' % xobj
subtype = xobj.get('Subtype')
if subtype is LITERAL_FORM and 'BBox' in xobj:
interpreter = self.dup()
bbox = list_value(xobj['BBox'])
matrix = list_value(xobj.get('Matrix', MATRIX_IDENTITY))
self.device.begin_figure(xobjid, bbox, matrix)
interpreter.render_contents(dict_value(xobj.get('Resources')), [xobj], ctm=mult_matrix(matrix, self.ctm))
self.device.end_figure(xobjid)
elif subtype is LITERAL_IMAGE and 'Width' in xobj and 'Height' in xobj:
self.device.begin_figure(xobjid, (0,0,1,1), MATRIX_IDENTITY)
self.device.render_image(xobjid, xobj)
self.device.end_figure(xobjid)
else:
# unsupported xobject type.
pass
return
开发者ID:ktisha,项目名称:ebook-service,代码行数:26,代码来源:pdfinterp.py
示例7: do_cm
def do_cm(self, a1, b1, c1, d1, e1, f1):
self.ctm = mult_matrix((a1,b1,c1,d1,e1,f1), self.ctm)
self.device.set_ctm(self.ctm)
return
开发者ID:ktisha,项目名称:ebook-service,代码行数:4,代码来源:pdfinterp.py
示例8: do_cm
def do_cm(self, a1, b1, c1, d1, e1, f1):
"""concat-matrix"""
self.ctm = mult_matrix((a1,b1,c1,d1,e1,f1), self.ctm)
self.device.set_ctm(self.ctm)
开发者ID:mcs07,项目名称:pdfminer,代码行数:4,代码来源:pdfinterp.py
注:本文中的utils.mult_matrix函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论