comparison libmlk-core/core/image.h @ 243:71b3b7036de7

misc: lot of cleanups, - prefix libraries with libmlk, - move assets from source directories closes #2520, - prefix header guards closes #2519
author David Demelier <markand@malikania.fr>
date Sat, 28 Nov 2020 22:37:30 +0100
parents libcore/core/image.h@dd7c8d4321a3
children c4da052c0def
comparison
equal deleted inserted replaced
242:4c24604efcab 243:71b3b7036de7
1 /*
2 * image.h -- basic image management
3 *
4 * Copyright (c) 2020 David Demelier <markand@malikania.fr>
5 *
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18
19 #ifndef MOLKO_CORE_IMAGE_H
20 #define MOLKO_CORE_IMAGE_H
21
22 /**
23 * \file image.h
24 * \brief Basic image management.
25 * \ingroup drawing
26 */
27
28 #include <stdbool.h>
29 #include <stddef.h>
30
31 struct texture;
32
33 /**
34 * Open a file from a path.
35 *
36 * \pre tex != NULL
37 * \pre path != NULL
38 * \param tex the texture to initialize
39 * \param path the path to the file
40 * \return False on errors.
41 */
42 bool
43 image_open(struct texture *tex, const char *path);
44
45 /**
46 * Open a file from a memory buffer.
47 *
48 * The buffer must be valid until the image is no longer used.
49 *
50 * \pre tex != NULL
51 * \pre buffer != NULL
52 * \param tex the texture to initialize
53 * \param buffer the memory buffer
54 * \param size the memory size
55 * \return False on errors.
56 */
57 bool
58 image_openmem(struct texture *tex, const void *buffer, size_t size);
59
60 #endif /* !MOLKO_CORE_IMAGE_H */