1 /*****************************************************************************
2 * This file is part of gfxprim library. *
4 * Gfxprim is free software; you can redistribute it and/or *
5 * modify it under the terms of the GNU Lesser General Public *
6 * License as published by the Free Software Foundation; either *
7 * version 2.1 of the License, or (at your option) any later version. *
9 * Gfxprim is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
12 * Lesser General Public License for more details. *
14 * You should have received a copy of the GNU Lesser General Public *
15 * License along with gfxprim; if not, write to the Free Software *
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
17 * Boston, MA 02110-1301 USA *
19 * Copyright (C) 2009-2013 Cyril Hrubis <metan@ucw.cz> *
21 *****************************************************************************/
23 #include "core/GP_Convert.h"
24 #include "core/GP_Debug.h"
26 #include "filters/GP_MultiTone.h"
30 static void init_sepia_tones(GP_Pixel pixels
[PIX
], GP_PixelType pixel_type
)
32 // pixels[0] = GP_RGBToPixel(56, 33, 10, pixel_type);
33 // pixels[1] = GP_RGBToPixel(255, 255, 255, pixel_type);
34 pixels
[0] = GP_RGBToPixel(0, 0, 0, pixel_type
);
35 pixels
[1] = GP_RGBToPixel(162, 116, 70, pixel_type
);
36 pixels
[2] = GP_RGBToPixel(230, 230, 230, pixel_type
);
39 int GP_FilterSepiaEx(const GP_Pixmap
*const src
,
40 GP_Coord x_src
, GP_Coord y_src
,
41 GP_Size w_src
, GP_Size h_src
,
43 GP_Coord x_dst
, GP_Coord y_dst
,
44 GP_ProgressCallback
*callback
)
48 init_sepia_tones(pixels
, dst
->pixel_type
);
50 return GP_FilterMultiToneEx(src
, x_src
, y_src
, w_src
, h_src
,
51 dst
, x_dst
, y_dst
, pixels
, PIX
, callback
);
54 GP_Pixmap
*GP_FilterSepiaExAlloc(const GP_Pixmap
*const src
,
55 GP_Coord x_src
, GP_Coord y_src
,
56 GP_Size w_src
, GP_Size h_src
,
57 GP_PixelType dst_pixel_type
,
58 GP_ProgressCallback
*callback
)
62 init_sepia_tones(pixels
, dst_pixel_type
);
64 return GP_FilterMultiToneExAlloc(src
, x_src
, y_src
, w_src
, h_src
,
65 dst_pixel_type
, pixels
, PIX
, callback
);