Files
FWS-Kitty/kitty/png-reader.h
T
BlackAngelTV 3d174c45a4 chore: import official kitty sources from upstream
Bring the kovidgoyal/kitty codebase in as the base of FWS-Kitty, vendored at upstream commit 91fb38a without its git history.
2026-11-04 11:35:59 +01:00

33 lines
936 B
C

/*
* Copyright (C) 2018 Kovid Goyal <kovid at kovidgoyal.net>
*
* Distributed under terms of the GPL3 license.
*/
#pragma once
#include <stdint.h>
#include <stdbool.h>
#include <png.h>
typedef struct png_read_data png_read_data;
typedef void (*png_error_handler_func)(png_read_data *d, const char *, const char *);
typedef struct png_read_data {
uint8_t *decompressed;
bool ok;
png_bytep *row_pointers;
int width, height;
size_t sz;
png_error_handler_func err_handler;
struct {
char *buf;
size_t used, capacity;
} error;
} png_read_data;
void inflate_png_inner(png_read_data *d, const uint8_t *buf, size_t bufsz, int max_image_dimension);
const char *png_from_32bit_rgba(const char *data, size_t width, size_t height, size_t *out_size, bool flip_vertically);
const char *png_from_24bit_rgb(const char *data, size_t width, size_t height, size_t *out_size, bool flip_vertically);