当前位置: 首页>>代码示例>>Python>>正文


Python utils.apply_matrix_pt函数代码示例

本文整理汇总了Python中utils.apply_matrix_pt函数的典型用法代码示例。如果您正苦于以下问题:Python apply_matrix_pt函数的具体用法?Python apply_matrix_pt怎么用?Python apply_matrix_pt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了apply_matrix_pt函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: begin_page

 def begin_page(self, page, ctm):
     (x0,y0,x1,y1) = page.mediabox
     (x0,y0) = apply_matrix_pt(ctm, (x0,y0))
     (x1,y1) = apply_matrix_pt(ctm, (x1,y1))
     mediabox = (0, 0, abs(x0-x1), abs(y0-y1))
     self.cur_item = LTPage(self.pageno, mediabox)
     return
开发者ID:bradleyayers,项目名称:pdfminer,代码行数:7,代码来源:converter.py

示例2: __init__

 def __init__(self, name, bbox, matrix):
     self.name = name
     self.matrix = matrix
     (x, y, w, h) = bbox
     bbox = get_bound(apply_matrix_pt(matrix, (p, q)) for (p, q) in ((x, y), (x + w, y), (x, y + h), (x + w, y + h)))
     LTLayoutContainer.__init__(self, bbox)
     return
开发者ID:brechin,项目名称:pdfminer2,代码行数:7,代码来源:layout.py

示例3: __init__

 def __init__(self, id, bbox, matrix):
     (x,y,w,h) = bbox
     bbox = get_bounds( apply_matrix_pt(matrix, (p,q))
                        for (p,q) in ((x,y), (x+w,y), (x,y+h), (x+w,y+h)) )
     self.matrix = matrix
     LayoutContainer.__init__(self, id, bbox)
     return
开发者ID:ktisha,项目名称:ebook-service,代码行数:7,代码来源:layout.py

示例4: __init__

 def __init__(self, name, bbox, matrix):
     (x,y,w,h) = bbox
     bbox = get_bounds( apply_matrix_pt(matrix, (p,q))
                        for (p,q) in ((x,y), (x+w,y), (x,y+h), (x+w,y+h)) )
     LTAnalyzer.__init__(self, bbox)
     self.name = name
     self.matrix = matrix
     return
开发者ID:joshmgrant,项目名称:pdfminer,代码行数:8,代码来源:layout.py

示例5: __init__

 def __init__(self, matrix, font, fontsize, scaling, rise,
              text, textwidth, textdisp):
     LTText.__init__(self)
     self._text = text
     self.matrix = matrix
     self.fontname = font.fontname
     self.adv = textwidth * fontsize * scaling
     m0 = abs(matrix[0])
     m1 = abs(matrix[1])
     self.direction = 0 if ( m0 > .001 and m1 < .001) else \
                      1 if (m0 < .001 and m1 > .001) else 2
     # compute the boundary rectangle.
     if font.is_vertical():
         # vertical
         width = font.get_width() * fontsize
         (vx, vy) = textdisp
         if vx is None:
             vx = width//2
         else:
             vx = vx * fontsize * .001
         vy = (1000 - vy) * fontsize * .001
         tx = -vx
         ty = vy + rise
         bll = (tx, ty+self.adv)
         bur = (tx+width, ty)
     else:
         # horizontal
         height = font.get_height() * fontsize
         descent = font.get_descent() * fontsize
         ty = descent + rise
         bll = (0, ty)
         bur = (self.adv, ty+height)
     (a, b, c, d, e, f) = self.matrix
     self.upright = (0 < a*d*scaling and b*c <= 0)
     (x0, y0) = apply_matrix_pt(self.matrix, bll)
     (x1, y1) = apply_matrix_pt(self.matrix, bur)
     if x1 < x0:
         (x0, x1) = (x1, x0)
     if y1 < y0:
         (y0, y1) = (y1, y0)
     LTComponent.__init__(self, (x0, y0, x1, y1))
     if font.is_vertical():
         self.size = self.width
     else:
         self.size = self.height
     return
开发者ID:frostasm,项目名称:pdfminer,代码行数:46,代码来源:layout.py

示例6: paint_path

 def paint_path(self, gstate, stroke, fill, evenodd, path):
     shape = ''.join(x[0] for x in path)
     if shape == 'ml':
         # horizontal/vertical line
         (_,x0,y0) = path[0]
         (_,x1,y1) = path[1]
         (x0,y0) = apply_matrix_pt(self.ctm, (x0,y0))
         (x1,y1) = apply_matrix_pt(self.ctm, (x1,y1))
         if x0 == x1 or y0 == y1:
             self.cur_item.add(LTLine(gstate.linewidth, (x0,y0), (x1,y1)))
             return
     if shape == 'mlllh':
         # rectangle
         (_,x0,y0) = path[0]
         (_,x1,y1) = path[1]
         (_,x2,y2) = path[2]
         (_,x3,y3) = path[3]
         (x0,y0) = apply_matrix_pt(self.ctm, (x0,y0))
         (x1,y1) = apply_matrix_pt(self.ctm, (x1,y1))
         (x2,y2) = apply_matrix_pt(self.ctm, (x2,y2))
         (x3,y3) = apply_matrix_pt(self.ctm, (x3,y3))
         if ((x0 == x1 and y1 == y2 and x2 == x3 and y3 == y0) or
             (y0 == y1 and x1 == x2 and y2 == y3 and x3 == x0)):
             self.cur_item.add(LTRect(gstate.linewidth, (x0,y0,x2,y2)))
             return
     # other shapes
     pts = []
     for p in path:
         for i in xrange(1, len(p), 2):
             pts.append(apply_matrix_pt(self.ctm, (p[i], p[i+1])))
     self.cur_item.add(LTCurve(gstate.linewidth, pts))
     return
开发者ID:bradleyayers,项目名称:pdfminer,代码行数:32,代码来源:converter.py

示例7: __init__

 def __init__(self, matrix, font, fontsize, scaling, rise, cid):
     self.matrix = matrix
     self.font = font
     self.fontsize = fontsize
     self.adv = font.char_width(cid) * fontsize * scaling
     try:
         text = font.to_unichr(cid)
         assert isinstance(text, unicode), text
     except PDFUnicodeNotDefined:
         text = '?'
     LTText.__init__(self, text)
     # compute the boundary rectangle.
     if self.font.is_vertical():
         # vertical
         width = font.get_width() * fontsize
         (vx,vy) = font.char_disp(cid)
         if vx is None:
             vx = width/2
         else:
             vx = vx * fontsize * .001
         vy = (1000 - vy) * fontsize * .001
         tx = -vx
         ty = vy + rise
         bll = (tx, ty+self.adv)
         bur = (tx+width, ty)
     else:
         # horizontal
         height = font.get_height() * fontsize
         descent = font.get_descent() * fontsize
         ty = descent + rise
         bll = (0, ty)
         bur = (self.adv, ty+height)
     (a,b,c,d,e,f) = self.matrix
     self.upright = (0 < a*d*scaling and b*c <= 0)
     bbox = (apply_matrix_pt(self.matrix, bll) +
             apply_matrix_pt(self.matrix, bur))
     LTItem.__init__(self, bbox)
     return
开发者ID:srijib,项目名称:gae,代码行数:38,代码来源:layout.py


注:本文中的utils.apply_matrix_pt函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。