Talustus | 3019a91 | 2013-04-06 11:50:07 +0200 | [diff] [blame] | 1 | /* |
| 2 | * -- http://android-fb2png.googlecode.com/svn/trunk/img_process.h -- |
| 3 | * |
| 4 | * Copyright 2011, Kyan He <kyan.ql.he@gmail.com> |
| 5 | * |
| 6 | * |
| 7 | * This program is free software: you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation, either version 3 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | * |
| 12 | * This program is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | * GNU General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | |
| 21 | #ifndef __IMG_PROCESS_H__ |
| 22 | #define __IMG_PROCESS_H__ |
| 23 | |
| 24 | /** |
| 25 | * rgba8888 is found on Desire HD Linux localhost 2.6.35.10-g931a37e #1 |
| 26 | * PREEMPT Wed Nov 9 14:04:03 CST 2011 armv7l GNU/Linux |
| 27 | */ |
| 28 | |
| 29 | |
| 30 | typedef struct rgb888 { |
| 31 | char r; |
| 32 | char g; |
| 33 | char b; |
| 34 | } rgb888_t; |
| 35 | |
| 36 | typedef rgb888_t rgb24_t; |
| 37 | |
| 38 | typedef struct argb8888 { |
| 39 | char a; |
| 40 | char r; |
| 41 | char g; |
| 42 | char b; |
| 43 | } argb8888_t; |
| 44 | |
| 45 | typedef struct abgr8888 { |
| 46 | char a; |
| 47 | char b; |
| 48 | char g; |
| 49 | char r; |
| 50 | } abgr8888_t; |
| 51 | |
| 52 | typedef struct bgra8888 { |
| 53 | char b; |
| 54 | char g; |
| 55 | char r; |
| 56 | char a; |
| 57 | } bgra8888_t; |
| 58 | |
| 59 | typedef struct rgba8888 { |
| 60 | char r; |
| 61 | char g; |
| 62 | char b; |
| 63 | char a; |
| 64 | } rgba8888_t; |
| 65 | |
| 66 | typedef struct rgb565 { |
| 67 | short b:5; |
| 68 | short g:6; |
| 69 | short r:5; |
| 70 | } rgb565_t; |
| 71 | |
| 72 | int rgb565_to_rgb888(const char* src, char* dst, size_t pixel); |
| 73 | |
| 74 | int argb8888_to_rgb888(const char* src, char* dst, size_t pixel); |
| 75 | |
| 76 | int abgr8888_to_rgb888(const char* src, char* dst, size_t pixel); |
| 77 | |
| 78 | int bgra8888_to_rgb888(const char* src, char* dst, size_t pixel); |
| 79 | |
| 80 | int rgba8888_to_rgb888(const char* src, char* dst, size_t pixel); |
| 81 | |
| 82 | int save_png(const char* path, const char* data, int width, int height); |
| 83 | |
| 84 | #endif |