ASPiK SDK
bitmapsaturator.h
1 // This file is part of VSTGUI. It is subject to the license terms
2 // in the LICENSE file found in the top-level directory of this
3 // distribution and at http://github.com/steinbergmedia/vstgui/LICENSE
4 
5 #ifndef __bitmapsaturator__
6 #define __bitmapsaturator__
7 
8 #include "vstgui/lib/cbitmap.h"
9 
10 namespace VSTGUI {
11 namespace Bitmap {
12 
13 //------------------------------------------------------------------------
14 static bool hueSaturateValue (CBitmap* bitmap, double hueAngle, double saturation, double value)
15 {
16  bool result = false;
17  CBitmapPixelAccess* accessor = CBitmapPixelAccess::create (bitmap);
18  if (accessor)
19  {
20  CColor c;
21  double h,s,v;
22  do
23  {
24  accessor->getColor (c);
25  c.toHSV (h, s, v);
26  h += hueAngle;
27  s += saturation;
28  v += value;
29  c.fromHSV (h, s, v);
30  accessor->setColor (c);
31  } while (++*accessor);
32  accessor->forget ();
33  result = true;
34  }
35  return result;
36 }
37 
38 } } // namespaces
39 
40 #endif
static CBitmapPixelAccess * create(CBitmap *bitmap, bool alphaPremultiplied=true)
Definition: cbitmap.cpp:285
Definition: customcontrols.cpp:8