-
Notifications
You must be signed in to change notification settings - Fork 257
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
background image - respect ratio #644
Comments
This is the code of interest: # file: terminatorlib/terminal.py
def background_draw(self, widget, cr):
if self.background_image is None:
return False
# save cairo context
cr.save()
# draw background image
rect = self.vte.get_allocation()
# -----
xratio = float(rect.width) / float(self.background_image.get_width())
yratio = float(rect.height) / float(self.background_image.get_height())
# -----
cr.scale(xratio, yratio)
cr.set_source_surface(self.background_image)
cr.get_source().set_filter(cairo.Filter.FAST)
cr.paint()
# draw transparent monochrome layer
Gdk.cairo_set_source_rgba(cr, self.bgcolor)
cr.paint()
# restore cairo context
cr.restore() And in particular, how xratio and yratio are calculated. Scale and keep ratio, scale and crop, center (and don't scale I presume?) are pretty straight-forward. |
Working on this, and I'm basically done with the code. Now only the GUI has to be implemented. I have added these drawing modes: I've added a few drawing modes and three config options:
The defaults are |
The names all sound good. Good luck with the GUI stuff. |
Is your feature request related to a problem? Please describe.
My background image ratio is wrong for my terminal (when it is not maximized).
Describe the solution you'd like
Would be great to add standard options for background images: repeat / tile, scale and crop, center, scale, scale and keep proportions.
Describe alternatives you've considered
Have no idea. I want the same background image to work when the window is small and when it is large. Maybe will have to use transparent background (and move the terminal to an empty desktop).
Additional context
Version 2.1.1-3, Arch Linux.
The text was updated successfully, but these errors were encountered: