1 /*****************************************************************************
3 *****************************************************************************
4 * Copyright (C) 2001 the VideoLAN team
7 * Authors: Tony Castley <tcastley@mail.powerup.com.au>
8 * Stephan Aßmus <stippi@yellowbites.com>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
25 #ifndef __DRAWING_TIBITS__
26 #define __DRAWING_TIBITS__
28 #include <GraphicsDefs.h>
30 rgb_color ShiftColor(rgb_color , float );
32 bool operator==(const rgb_color &, const rgb_color &);
33 bool operator!=(const rgb_color &, const rgb_color &);
36 Color(int32 r, int32 g, int32 b, int32 alpha = 255)
47 const rgb_color kWhite = { 255, 255, 255, 255};
48 const rgb_color kBlack = { 0, 0, 0, 255};
50 const float kDarkness = 1.06;
51 const float kDimLevel = 0.6;
53 void ReplaceColor(BBitmap *bitmap, rgb_color from, rgb_color to);
54 void ReplaceTransparentColor(BBitmap *bitmap, rgb_color with);
56 // function can be used to scale the upper left part of
57 // a bitmap to fill the entire bitmap, ie fromWidth
58 // and fromHeight must be smaller or equal to the bitmaps size!
59 // only supported colorspaces are B_RGB32 and B_RGBA32
60 status_t scale_bitmap( BBitmap* bitmap,
61 uint32 fromWidth, uint32 fromHeight );
63 // bitmaps need to be the same size, or this function will fail
64 // currently supported conversions:
65 // B_YCbCr422 -> B_RGB32
68 // not yet implemented conversions:
69 // B_YCbCr420 -> B_RGB32
70 // B_YUV422 -> B_RGB32
71 status_t convert_bitmap(BBitmap* inBitmap, BBitmap* outBitmap);
73 // dims bitmap (in place) by finding the distance of
74 // the color at each pixel to the provided "center" color
75 // and shortens that distance by dimLevel
76 // (dimLevel < 1 -> less contrast)
77 // (dimLevel > 1 -> more contrast)
78 // (dimLevel < 0 -> inverted colors)
79 // currently supported colorspaces:
83 status_t dim_bitmap(BBitmap* bitmap, rgb_color center,
86 rgb_color dimmed_color_cmap8(rgb_color color, rgb_color center,
89 #endif // __DRAWING_TIBITS__