BTRFS: Implement BTree::Path and change _Find.
[haiku.git] / src / apps / soundrecorder / DrawingTidbits.h
blob417f60ac3d41b2e707ea94ae92307ed8c4242151
1 /*
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)
6 */
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 &);
18 inline uchar
19 ShiftComponent(uchar component, float percent)
21 // change the color by <percent>, make sure we aren't rounding
22 // off significant bits
23 if (percent >= 1)
24 return (uchar)(component * (2 - percent));
25 else
26 return (uchar)(255 - percent * (255 - component));
29 inline rgb_color
30 Color(int32 r, int32 g, int32 b, int32 alpha = 255)
32 rgb_color result;
33 result.red = r;
34 result.green = g;
35 result.blue = b;
36 result.alpha = alpha;
38 return result;
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);
50 #endif