]> git.sesse.net Git - vlc/blob - modules/gui/beos/DrawingTidbits.h
Make Zorglub less unhappy
[vlc] / modules / gui / beos / DrawingTidbits.h
1 /*****************************************************************************
2  * DrawingTidbits.h
3  *****************************************************************************
4  * Copyright (C) 2001 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Tony Castley <tcastley@mail.powerup.com.au>
8  *          Stephan Aßmus <stippi@yellowbites.com>
9  *
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.
14  *
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.
19  *
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., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
23  *****************************************************************************/
24
25 #ifndef __DRAWING_TIBITS__
26 #define __DRAWING_TIBITS__
27
28 #include <GraphicsDefs.h>
29
30 rgb_color ShiftColor(rgb_color , float );
31
32 bool operator==(const rgb_color &, const rgb_color &);
33 bool operator!=(const rgb_color &, const rgb_color &);
34
35 inline rgb_color
36 Color(int32 r, int32 g, int32 b, int32 alpha = 255)
37 {
38         rgb_color result;
39         result.red = r;
40         result.green = g;
41         result.blue = b;
42         result.alpha = alpha;
43
44         return result;
45 }
46
47 const rgb_color kWhite = { 255, 255, 255, 255};
48 const rgb_color kBlack = { 0, 0, 0, 255};
49
50 const float kDarkness = 1.06;
51 const float kDimLevel = 0.6;
52
53 void ReplaceColor(BBitmap *bitmap, rgb_color from, rgb_color to);
54 void ReplaceTransparentColor(BBitmap *bitmap, rgb_color with);
55
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 );
62
63 // bitmaps need to be the same size, or this function will fail
64 // currently supported conversions:
65 //   B_YCbCr422 -> B_RGB32
66 //   B_RGB32    -> B_RGB32
67 //   B_RGB16    -> 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);
72
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:
80 //   B_RGB32
81 //   B_RGBA32
82 //   B_CMAP8
83 status_t dim_bitmap(BBitmap* bitmap, rgb_color center,
84                                         float dimLevel);
85
86 rgb_color dimmed_color_cmap8(rgb_color color, rgb_color center,
87                                                          float dimLevel);
88
89 #endif  // __DRAWING_TIBITS__