2 * Copyright 2005, Jérôme Duval. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 * Inspired by SoundCapture from Be newsletter (Media Kit Basics: Consumers and Producers)
8 #ifndef __DRAWING_TIBITS__
9 #define __DRAWING_TIBITS__
11 #include <GraphicsDefs.h>
13 rgb_color
ShiftColor(rgb_color
, float );
15 bool operator==(const rgb_color
&, const rgb_color
&);
16 bool operator!=(const rgb_color
&, const rgb_color
&);
19 ShiftComponent(uchar component
, float percent
)
21 // change the color by <percent>, make sure we aren't rounding
22 // off significant bits
24 return (uchar
)(component
* (2 - percent
));
26 return (uchar
)(255 - percent
* (255 - component
));
30 Color(int32 r
, int32 g
, int32 b
, int32 alpha
= 255)
41 const rgb_color kWhite
= { 255, 255, 255, 255};
42 const rgb_color kBlack
= { 0, 0, 0, 255};
44 const float kDarkness
= 1.06;
45 const float kDimLevel
= 0.6;
47 void ReplaceColor(BBitmap
*bitmap
, rgb_color from
, rgb_color to
);
48 void ReplaceTransparentColor(BBitmap
*bitmap
, rgb_color with
);