mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-20 10:12:06 +00:00
Add color and transparency support to rgbgfx
In addition, fix various bugs. Among them are minor memory issues and edge cases with certain inputs. Signed-off-by: obskyr <powpowd@gmail.com>
This commit is contained in:
@@ -12,14 +12,14 @@
|
||||
#include <stdint.h>
|
||||
#include "gfx/main.h"
|
||||
|
||||
void png_to_gb(const struct PNGImage png, struct GBImage *gb);
|
||||
void output_file(const struct Options opts, const struct GBImage gb);
|
||||
void raw_to_gb(const struct RawIndexedImage *raw_image, struct GBImage *gb);
|
||||
void output_file(const struct Options *opts, const struct GBImage *gb);
|
||||
int get_tile_index(uint8_t *tile, uint8_t **tiles, int num_tiles,
|
||||
int tile_size);
|
||||
void create_tilemap(const struct Options opts, struct GBImage *gb,
|
||||
struct Tilemap *tilemap);
|
||||
void output_tilemap_file(const struct Options opts,
|
||||
const struct Tilemap tilemap);
|
||||
void output_palette_file(const struct Options opts, const struct PNGImage png);
|
||||
|
||||
int tile_size);
|
||||
void create_tilemap(const struct Options *opts, struct GBImage *gb,
|
||||
struct Tilemap *tilemap);
|
||||
void output_tilemap_file(const struct Options *opts,
|
||||
const struct Tilemap *tilemap);
|
||||
void output_palette_file(const struct Options *opts,
|
||||
const struct RawIndexedImage *raw_image);
|
||||
#endif
|
||||
|
||||
@@ -31,6 +31,21 @@ struct Options {
|
||||
char *infile;
|
||||
};
|
||||
|
||||
struct RGBColor {
|
||||
uint8_t red;
|
||||
uint8_t green;
|
||||
uint8_t blue;
|
||||
};
|
||||
|
||||
struct ImageOptions {
|
||||
bool horizontal;
|
||||
int trim;
|
||||
char *mapfile;
|
||||
bool mapout;
|
||||
char *palfile;
|
||||
bool palout;
|
||||
};
|
||||
|
||||
struct PNGImage {
|
||||
png_struct *png;
|
||||
png_info *info;
|
||||
@@ -39,12 +54,14 @@ struct PNGImage {
|
||||
int height;
|
||||
png_byte depth;
|
||||
png_byte type;
|
||||
bool horizontal;
|
||||
int trim;
|
||||
char *mapfile;
|
||||
bool mapout;
|
||||
char *palfile;
|
||||
bool palout;
|
||||
};
|
||||
|
||||
struct RawIndexedImage {
|
||||
uint8_t **data;
|
||||
struct RGBColor *palette;
|
||||
int num_colors;
|
||||
int width;
|
||||
int height;
|
||||
};
|
||||
|
||||
struct GBImage {
|
||||
|
||||
@@ -11,10 +11,11 @@
|
||||
|
||||
#include "gfx/main.h"
|
||||
|
||||
void input_png_file(const struct Options opts, struct PNGImage *img);
|
||||
void get_text(struct PNGImage *png);
|
||||
void set_text(const struct PNGImage *png);
|
||||
void output_png_file(const struct Options opts, const struct PNGImage *png);
|
||||
void free_png_data(const struct PNGImage *png);
|
||||
struct RawIndexedImage *input_png_file(const struct Options *opts,
|
||||
struct ImageOptions *png_options);
|
||||
void output_png_file(const struct Options *opts,
|
||||
const struct ImageOptions *png_options,
|
||||
const struct RawIndexedImage *raw_image);
|
||||
void destroy_raw_image(struct RawIndexedImage **raw_image_ptr_ptr);
|
||||
|
||||
#endif /* RGBDS_GFX_PNG_H */
|
||||
|
||||
Reference in New Issue
Block a user