From 50b94d3bb4cdc5d28e3469bc5d6b48b59e83eb04 Mon Sep 17 00:00:00 2001 From: Harry Jeffery Date: Mon, 30 Nov 2015 22:21:48 +0000 Subject: Document imv_viewport's methods --- src/viewport.h | 52 +++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 11 deletions(-) (limited to 'src/viewport.h') diff --git a/src/viewport.h b/src/viewport.h index 6668725..4233756 100644 --- a/src/viewport.h +++ b/src/viewport.h @@ -31,24 +31,54 @@ struct imv_viewport { int locked; }; +/* Used to signify how a a user requested a zoom */ enum imv_zoom_source { IMV_ZOOM_MOUSE, IMV_ZOOM_KEYBOARD }; +/* Initialises an instance of imv_viewport */ void imv_init_viewport(struct imv_viewport *view, SDL_Window *window); + +/* Cleans up all resources owned by a imv_viewport instance */ void imv_destroy_viewport(struct imv_viewport *view); -void imv_viewport_toggle_fullscreen(struct imv_viewport*); -void imv_viewport_toggle_playing(struct imv_viewport*); -void imv_viewport_reset(struct imv_viewport*); -void imv_viewport_move(struct imv_viewport*, int, int); -void imv_viewport_zoom(struct imv_viewport*, const struct imv_texture*, enum imv_zoom_source, int); -void imv_viewport_center(struct imv_viewport*, const struct imv_texture*); -void imv_viewport_scale_to_actual(struct imv_viewport*, const struct imv_texture*); -void imv_viewport_scale_to_window(struct imv_viewport*, const struct imv_texture*); -void imv_viewport_set_redraw(struct imv_viewport*); -void imv_viewport_set_title(struct imv_viewport*, char*); -void imv_viewport_updated(struct imv_viewport*, struct imv_texture*); +/* Toggle their viewport's fullscreen mode. Triggers a redraw */ +void imv_viewport_toggle_fullscreen(struct imv_viewport *view); + +/* Toggle playback of animated gifs */ +void imv_viewport_toggle_playing(struct imv_viewport *view); + +/* Reset the viewport to its initial settings */ +void imv_viewport_reset(struct imv_viewport *view); + +/* Pan the view by the given amounts */ +void imv_viewport_move(struct imv_viewport *view, int x, int y); + +/* Zoom the view by the given amount. imv_texture* is used to get the image + * dimensions */ +void imv_viewport_zoom(struct imv_viewport *view, const struct imv_texture *tex, + enum imv_zoom_source, int amount); + +/* Recenter the view to be in the middle of the image */ +void imv_viewport_center(struct imv_viewport *view, + const struct imv_texture *tex); + +/* Scale the view so that the image appears at its actual resolution */ +void imv_viewport_scale_to_actual(struct imv_viewport *view, + const struct imv_texture *tex); + +/* Scale the view so that the image fills the window */ +void imv_viewport_scale_to_window(struct imv_viewport *view, + const struct imv_texture *tex); + +/* Tell the viewport that it needs to be redrawn */ +void imv_viewport_set_redraw(struct imv_viewport *view); + +/* Set the title of the viewport */ +void imv_viewport_set_title(struct imv_viewport *view, char *title); + +/* Tell the viewport the window or image has changed */ +void imv_viewport_updated(struct imv_viewport *view, struct imv_texture *tex); #endif -- cgit v1.2.3