aboutsummaryrefslogtreecommitdiff
path: root/src/viewport.h
diff options
context:
space:
mode:
authorSebastian Parborg <darkdefende@gmail.com>2019-08-25 13:58:49 +0200
committerHarry Jeffery <harry@exec64.co.uk>2019-08-25 21:35:15 +0100
commit498c35c28831cf89cc60a773a5c2513c97bc08a3 (patch)
treea706d16e5deaf2019d24830269986d437a61300b /src/viewport.h
parentcd67aca62d1c1169bb35e580e3f4d9ddf708235d (diff)
downloadimv-498c35c28831cf89cc60a773a5c2513c97bc08a3.tar.gz
Added crop scaling method
Added a method that scales and crop the image so that the image will fill the whole window. Also made viewport update respect the current scaling mode.
Diffstat (limited to 'src/viewport.h')
-rw-r--r--src/viewport.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/viewport.h b/src/viewport.h
index 0b9519f..5e5bc24 100644
--- a/src/viewport.h
+++ b/src/viewport.h
@@ -6,6 +6,14 @@
struct imv_viewport;
+enum scaling_mode {
+ SCALING_NONE,
+ SCALING_DOWN,
+ SCALING_FULL,
+ SCALING_CROP,
+ SCALING_MODE_COUNT
+};
+
/* Used to signify how a a user requested a zoom */
enum imv_zoom_source {
IMV_ZOOM_MOUSE,
@@ -55,10 +63,18 @@ void imv_viewport_center(struct imv_viewport *view,
void imv_viewport_scale_to_actual(struct imv_viewport *view,
const struct imv_image *image);
-/* Scale the view so that the image fills the window */
+/* Scale the view so that the image fits in the window */
void imv_viewport_scale_to_window(struct imv_viewport *view,
const struct imv_image *image);
+/* Scale the view so that the image fills the window */
+void imv_viewport_crop_to_window(struct imv_viewport *view,
+ const struct imv_image *image);
+
+/* Rescale the view with the chosen scaling method */
+void imv_viewport_rescale(struct imv_viewport *view, const struct imv_image *image,
+ enum scaling_mode);
+
/* Tell the viewport that it needs to be redrawn */
void imv_viewport_set_redraw(struct imv_viewport *view);
@@ -66,7 +82,7 @@ void imv_viewport_set_redraw(struct imv_viewport *view);
void imv_viewport_update(struct imv_viewport *view,
int window_width, int window_height,
int buffer_width, int buffer_height,
- struct imv_image *image);
+ struct imv_image *image, enum scaling_mode);
/* Poll whether we need to redraw */
int imv_viewport_needs_redraw(struct imv_viewport *view);