minor changes - code style, default zoom

This commit is contained in:
LunarEclipse 2024-05-24 19:15:42 +02:00
parent e124669185
commit 25c89fd5d5
1 changed files with 6 additions and 6 deletions

View File

@ -43,7 +43,7 @@ class PdfPage(Gtk.DrawingArea):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
self.page: Page = page self.page: Page = page
pix: fitz.Pixmap = self.page.raw.get_pixmap(dpi=96) # type: ignore pix: fitz.Pixmap = self.page.raw.get_pixmap(dpi=50) # type: ignore
self.set_size_request(pix.width, pix.height) self.set_size_request(pix.width, pix.height)
self.connect("draw", self.on_draw, {}) self.connect("draw", self.on_draw, {})
@ -60,7 +60,7 @@ class PdfPage(Gtk.DrawingArea):
sctx = widget.get_style_context() sctx = widget.get_style_context()
Gtk.render_background(sctx, cr, 0, 0, width, height) Gtk.render_background(sctx, cr, 0, 0, width, height)
pix: fitz.Pixmap = self.page.raw.get_pixmap(dpi=96) # type: ignore pix: fitz.Pixmap = self.page.raw.get_pixmap(dpi=50) # type: ignore
img = PIL.Image.frombytes("RGBA" if pix.alpha else "RGB", [pix.width, pix.height], pix.samples) img = PIL.Image.frombytes("RGBA" if pix.alpha else "RGB", [pix.width, pix.height], pix.samples)
img.putalpha(1) img.putalpha(1)
img = PIL.Image.merge("RGBA", (lambda r, g, b, a: (b, g, r, a))(*img.split())) # type: ignore img = PIL.Image.merge("RGBA", (lambda r, g, b, a: (b, g, r, a))(*img.split())) # type: ignore
@ -70,10 +70,10 @@ class PdfPage(Gtk.DrawingArea):
cr.paint() cr.paint()
for sel in self.page.selections: for sel in self.page.selections:
sel_x1 = sel.bounds[0][0]*pix.width sel_x1 = sel.bounds[0][0] * pix.width
sel_y1 = sel.bounds[0][1]*pix.height sel_y1 = sel.bounds[0][1] * pix.height
sel_x2 = sel.bounds[1][0]*pix.width sel_x2 = sel.bounds[1][0] * pix.width
sel_y2 = sel.bounds[1][1]*pix.height sel_y2 = sel.bounds[1][1] * pix.height
# Base settings # Base settings
cr.set_line_cap(cairo.LINE_CAP_BUTT) cr.set_line_cap(cairo.LINE_CAP_BUTT)