mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
a0adbf150b
commit
ff5dc4b039
@ -306,8 +306,8 @@ class PdfEngine(QPaintEngine):
|
|||||||
image = pixmap.toImage()
|
image = pixmap.toImage()
|
||||||
ref = self.add_image(image, pixmap.cacheKey())
|
ref = self.add_image(image, pixmap.cacheKey())
|
||||||
if ref is not None:
|
if ref is not None:
|
||||||
self.pdf.draw_image(rect.x(), rect.y(), rect.width(), rect.height(),
|
self.pdf.draw_image(rect.x(), rect.height()+rect.y(), rect.width(),
|
||||||
ref)
|
-rect.height(), ref)
|
||||||
|
|
||||||
@store_error
|
@store_error
|
||||||
def drawImage(self, rect, image, source_rect, flags=Qt.AutoColor):
|
def drawImage(self, rect, image, source_rect, flags=Qt.AutoColor):
|
||||||
@ -316,8 +316,8 @@ class PdfEngine(QPaintEngine):
|
|||||||
image.copy(source_rect))
|
image.copy(source_rect))
|
||||||
ref = self.add_image(image, image.cacheKey())
|
ref = self.add_image(image, image.cacheKey())
|
||||||
if ref is not None:
|
if ref is not None:
|
||||||
self.pdf.draw_image(rect.x(), rect.y(), rect.width(), rect.height(),
|
self.pdf.draw_image(rect.x(), rect.height()+rect.y(), rect.width(),
|
||||||
ref)
|
-rect.height(), ref)
|
||||||
|
|
||||||
def add_image(self, img, cache_key):
|
def add_image(self, img, cache_key):
|
||||||
if img.isNull(): return
|
if img.isNull(): return
|
||||||
|
@ -423,10 +423,9 @@ class PDFStream(object):
|
|||||||
self.objects.commit(r, self.stream)
|
self.objects.commit(r, self.stream)
|
||||||
return r
|
return r
|
||||||
|
|
||||||
def draw_image(self, x, y, w, h, imgref):
|
def draw_image(self, x, y, xscale, yscale, imgref):
|
||||||
name = self.current_page.add_image(imgref)
|
name = self.current_page.add_image(imgref)
|
||||||
sx, sy = w, h
|
self.current_page.write('q %g 0 0 %g %g %g cm '%(xscale, yscale, x, y))
|
||||||
self.current_page.write('q %g 0 0 %g %g %g cm '%(sx, -sy, x, y+h))
|
|
||||||
serialize(Name(name), self.current_page)
|
serialize(Name(name), self.current_page)
|
||||||
self.current_page.write_line(' Do Q')
|
self.current_page.write_line(' Do Q')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user