some bugfixes and rescale filter
[melted] / src / modules / gtk2 / pixops.h
1 /* GdkPixbuf library - Scaling and compositing functions
2 *
3 * Copyright (C) 1999 The Free Software Foundation
4 *
5 * Author: Owen Taylor <otaylor@redhat.com>
6 * Modified for YUV422 by: Dan Dennedy <dan@dennedy.org>
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
22 */
23
24 #ifndef PIXOPS_H
25 #define PIXOPS_H
26
27 #include <glib.h>
28
29 /* Interpolation modes; must match GdkInterpType */
30 typedef enum {
31 PIXOPS_INTERP_NEAREST,
32 PIXOPS_INTERP_TILES,
33 PIXOPS_INTERP_BILINEAR,
34 PIXOPS_INTERP_HYPER
35 } PixopsInterpType;
36
37 /* Scale src_buf from src_width / src_height by factors scale_x, scale_y
38 * and composite the portion corresponding to
39 * render_x, render_y, render_width, render_height in the new
40 * coordinate system into dest_buf starting at 0, 0
41 */
42 void yuv422_scale (guchar *dest_buf,
43 int render_x0,
44 int render_y0,
45 int render_x1,
46 int render_y1,
47 int dest_rowstride,
48 int dest_channels,
49 int dest_has_alpha,
50 const guchar *src_buf,
51 int src_width,
52 int src_height,
53 int src_rowstride,
54 int src_channels,
55 int src_has_alpha,
56 double scale_x,
57 double scale_y,
58 PixopsInterpType interp_type);
59
60 #define yuv422_scale_simple( dest_buf, dest_width, dest_height, dest_rowstride, src_buf, src_width, src_height, src_rowstride, interp_type ) \
61 yuv422_scale( (dest_buf), 0, 0, \
62 (dest_width)/2, (dest_height), \
63 (dest_rowstride), 4, 0, \
64 (src_buf), (src_width)/2, (src_height), \
65 (src_rowstride), 4, 0, \
66 (double) (dest_width) / (src_width), (double) (dest_height) / (src_height), \
67 (PixopsInterpType) interp_type );
68
69 #endif