Latest work on the bmp on-load scaler:
[maemo-rb.git] / apps / recorder / resize.h
blob451830742e4d213b237e7ed288fc67a7b1ed45f6
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2008 by Akio Idehara
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
21 #ifndef _RESIZE_H_
22 #define _RESIZE_H_
24 #include "config.h"
25 #include "lcd.h"
26 #include "inttypes.h"
28 /****************************************************************
29 * resize_on_load()
31 * resize bitmap on load with scaling
33 * If HAVE_LCD_COLOR then this func use smooth scaling algorithm
34 * - downscaling both way use "Area Sampling"
35 * if IMG_RESIZE_BILINER or IMG_RESIZE_NEAREST is NOT set
36 * - otherwise "Bilinear" or "Nearest Neighbour"
38 * If !(HAVE_LCD_COLOR) then use simple scaling algorithm "Nearest Neighbour"
40 * return -1 for error
41 ****************************************************************/
43 /* nothing needs the on-stack buffer right now */
44 #define MAX_SC_STACK_ALLOC 0
45 #define HAVE_UPSCALER 1
47 struct img_part {
48 int len;
49 #if !defined(HAVE_LCD_COLOR) && \
50 (LCD_DEPTH > 1 || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1))
51 uint8_t *buf;
52 #else
53 struct uint8_rgb* buf;
54 #endif
57 #ifdef HAVE_LCD_COLOR
58 /* intermediate type used by the scaler for color output. greyscale version
59 uses uint32_t
61 struct uint32_rgb {
62 uint32_t r;
63 uint32_t g;
64 uint32_t b;
66 #endif
68 int recalc_dimension(struct dim *dst, struct dim *src);
70 int resize_on_load(struct bitmap *bm, bool dither,
71 struct dim *src, struct rowset *tmp_row,
72 unsigned char *buf, unsigned int len,
73 struct img_part* (*store_part)(void *args),
74 void *args);
75 #endif /* _RESIZE_H_ */