cake
/
libg1m
Archived
1
0
Fork 0
This repository has been archived on 2024-03-16. You can view files and clone it, but cannot push or open issues or pull requests.
libg1m/include/libg1m/picture.h

70 lines
2.9 KiB
C

/* *****************************************************************************
* libg1m/picture.h -- libg1m picture formats.
* Copyright (C) 2017 Thomas "Cakeisalie5" Touhey <thomas@touhey.fr>
*
* This file is part of libg1m.
* libg1m is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 3.0 of the License,
* or (at your option) any later version.
*
* libg1m is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with libg1m; if not, see <http://www.gnu.org/licenses/>.
* ************************************************************************** */
#ifndef LIBG1M_PICTURE_H
# define LIBG1M_PICTURE_H
/* ************************************************************************** */
/* Picture formats */
/* ************************************************************************** */
/* picture format */
typedef int g1m_pictureformat_t;
# define g1m_pictureformat_1bit 0x0100
# define g1m_pictureformat_1bit_r 0x0101
# define g1m_pictureformat_1bit_packed 0x0110
# define g1m_pictureformat_1bit_packed_r 0x0111
# define g1m_pictureformat_1bit_packed_old 0x0120
# define g1m_pictureformat_2bit_dual 0x0200
# define g1m_pictureformat_4bit_rgb 0x0400
# define g1m_pictureformat_4bit_code 0x0410
# define g1m_pictureformat_4bit_color 0x0420
# define g1m_pictureformat_4bit_mono 0x0430
# define g1m_pictureformat_16bit 0x1000
/* ************************************************************************** */
/* Picture sizes */
/* ************************************************************************** */
# define g1m_picturesize_1bit(W, H) \
((((W) / 8) + !!((W) % 8)) * (H))
# define g1m_picturesize_1bit_packed(W, H) \
((W) * (H) / 8)
# define g1m_picturesize_1bit_packed_r(W, H) \
g1m_picturesize_1bit_packed(W, H)
# define g1m_picturesize_1bit_packed_old(W, H) \
g1m_picturesize_1bit_packed(W, H)
# define g1m_picturesize_4bit_color(W, H) \
(4 * g1m_picturesize_1bit_packed_old(W, H))
# define g1m_picturesize_4bit_mono(W, H) \
g1m_picturesize_4bit_color(W, H)
# define g1m_picturesize_2bit_dual(W, H) \
(((W) * (H) / 4) * 2)
# define g1m_picturesize_4bit(W, H) \
((W) * (H) / 2)
# define g1m_picturesize_4bit_rgb(W, H) \
g1m_picturesize_4bit(W, H)
# define g1m_picturesize_4bit_code(W, H) \
g1m_picturesize_4bit(W, H)
# define g1m_picturesize_16bit(W, H) \
((W) * (H) * 2)
#endif /* LIBG1M_PICTURE_H */