Esempio n. 1
0
 def linkRect(self, linkarea):
     """Returns a QRect encompassing the linkArea (of a link) in coordinates of our rect()."""
     left, top, right, bottom = linkarea.normalized().getCoords()
     # rotate
     if self._rotation:
         if self._rotation == popplerqt4.Poppler.Page.Rotate90:
             left, top, right, bottom = 1-bottom, left, 1-top, right
         elif self._rotation == popplerqt4.Poppler.Page.Rotate180:
             left, top, right, bottom = 1-right, 1-bottom, 1-left, 1-top
         else: # 270
             left, top, right, bottom = top, 1-right, bottom, 1-left
     rect = QRect()
     rect.setCoords(left * self.width(), top * self.height(), right * self.width(), bottom * self.height())
     rect.translate(self.pos())
     return rect
Esempio n. 2
0
 def linkRect(self, linkarea):
     """Returns a QRect encompassing the linkArea (of a link) in coordinates of our rect()."""
     left, top, right, bottom = linkarea.normalized().getCoords()
     # rotate
     if self._rotation:
         if self._rotation == popplerqt4.Poppler.Page.Rotate90:
             left, top, right, bottom = 1 - bottom, left, 1 - top, right
         elif self._rotation == popplerqt4.Poppler.Page.Rotate180:
             left, top, right, bottom = 1 - right, 1 - bottom, 1 - left, 1 - top
         else:  # 270
             left, top, right, bottom = top, 1 - right, bottom, 1 - left
     rect = QRect()
     rect.setCoords(left * self.width(), top * self.height(),
                    right * self.width(), bottom * self.height())
     rect.translate(self.pos())
     return rect
Esempio n. 3
0
 def searchRect(self, rectF):
     """Returns a QRect encompassing the given rect (in points) to our position, size and rotation."""
     rect = rectF.normalized()
     left, top, right, bottom = rect.getCoords()
     w, h = self.pageSize().width(), self.pageSize().height()
     hscale = self.width()  / float(w)
     vscale = self.height() / float(h)
     if self._rotation:
         if self._rotation == popplerqt4.Poppler.Page.Rotate90:
             left, top, right, bottom = w-bottom, left, w-top, right
         elif self._rotation == popplerqt4.Poppler.Page.Rotate180:
             left, top, right, bottom = w-right, h-bottom, w-left, h-top
         else: # 270
             left, top, right, bottom = top, h-right, bottom, h-left
     rect = QRect()
     rect.setCoords(left * hscale, top * vscale, right * hscale, bottom * vscale)
     return rect
Esempio n. 4
0
 def searchRect(self, rectF):
     """Returns a QRect encompassing the given rect (in points) to our position, size and rotation."""
     rect = rectF.normalized()
     left, top, right, bottom = rect.getCoords()
     w, h = self.pageSize().width(), self.pageSize().height()
     hscale = self.width() / float(w)
     vscale = self.height() / float(h)
     if self._rotation:
         if self._rotation == popplerqt4.Poppler.Page.Rotate90:
             left, top, right, bottom = w - bottom, left, w - top, right
         elif self._rotation == popplerqt4.Poppler.Page.Rotate180:
             left, top, right, bottom = w - right, h - bottom, w - left, h - top
         else:  # 270
             left, top, right, bottom = top, h - right, bottom, h - left
     rect = QRect()
     rect.setCoords(left * hscale, top * vscale, right * hscale,
                    bottom * vscale)
     return rect