timage.h - ltk - Socket-based GUI for X11 (WIP)
HTML git clone git://lumidify.org/ltk.git (fast, but not encrypted)
HTML git clone https://lumidify.org/git/ltk.git (encrypted, but very slow)
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
timage.h (1915B)
---
1 /*
2 * Copyright (c) 2023 lumidify <nobody@lumidify.org>
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17 #ifndef LTK_IMAGE_H
18 #define LTK_IMAGE_H
19
20 /* FIXME: Files including this need to include ltk.h because that's
21 currently where the typedef for ltk_surface is. That's really ugly. */
22 #include "graphics.h"
23
24 typedef struct ltk_image ltk_image;
25
26 void ltk_image_init(ltk_renderdata *data, size_t cache_bytes);
27 /* path is only used to guess file type */
28 /* data is not taken over! */
29 ltk_image *ltk_image_create_from_mem(const char *path, const char *data, size_t sz);
30 ltk_image *ltk_image_create_cropped_scaled(
31 ltk_image *image, int src_x, int src_y,
32 int src_w, int src_h, int dst_w, int dst_h
33 );
34 void ltk_image_draw(ltk_image *image, ltk_surface *draw_surf, int x, int y);
35 void ltk_image_draw_scaled(
36 ltk_image *image, ltk_surface *draw_surf,
37 int x, int y, int w, int h
38 );
39 void ltk_image_draw_cropped_scaled(
40 ltk_image *image, ltk_surface *draw_surf,
41 int src_x, int src_y, int src_w, int src_h,
42 int dst_x, int dst_y, int dst_w, int dst_h
43 );
44 int ltk_image_get_width(ltk_image *image);
45 int ltk_image_get_height(ltk_image *image);
46 void ltk_image_destroy(ltk_image *image);
47
48 #endif /* LTK_IMAGE_H */