ltk

GUI toolkit for X11 (WIP)
git clone git://lumidify.org/ltk.git (fast, but not encrypted)
git clone https://lumidify.org/ltk.git (encrypted, but very slow)
git clone git://4kcetb7mo7hj6grozzybxtotsub5bempzo4lirzc3437amof2c2impyd.onion/ltk.git (over tor)
Log | Files | Refs | README | LICENSE

image.h (1855B)


      1 /*
      2  * Copyright (c) 2023-2024 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 #include <stddef.h>
     21 #include "graphics.h"
     22 
     23 typedef struct ltk_image ltk_image;
     24 
     25 void ltk_image_init(ltk_renderdata *data, size_t cache_bytes);
     26 /* path is only used to guess file type */
     27 /* data is not taken over! */
     28 ltk_image *ltk_image_create_from_mem(const char *path, const char *data, size_t sz);
     29 ltk_image *ltk_image_create_from_path(const char *path);
     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 */