summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <smspillaz@gmail.com>2010-08-06 22:01:07 +0800
committerSam Spilsbury <smspillaz@gmail.com>2010-08-06 22:01:07 +0800
commit0d43c491604554f5f00e558a907b4050d9fb387f (patch)
tree11a19cdcbee63de7e47388e4700291001337a135
parent0cb66d0a6579fb949854f5c2d7d3c13e7aba83b4 (diff)
downloadhoverfx-master.tar.gz
hoverfx-master.tar.bz2
Remove "levels" and add "opacity", "brightness", and "saturation"HEADmaster
-rw-r--r--hoverfx.xml.in12
-rw-r--r--src/hoverfx.cpp51
-rw-r--r--src/hoverfx.h1
3 files changed, 51 insertions, 13 deletions
diff --git a/hoverfx.xml.in b/hoverfx.xml.in
index 5555df6..722a0b4 100644
--- a/hoverfx.xml.in
+++ b/hoverfx.xml.in
@@ -12,7 +12,7 @@
<_short>Effect Type</_short>
<_long>What effect to use on hover</_long>
<min>0</min>
- <max>2</max>
+ <max>3</max>
<default>0</default>
<desc>
<value>0</value>
@@ -20,7 +20,15 @@
</desc>
<desc>
<value>1</value>
- <_name>Levels</_name>
+ <_name>Opacity</_name>
+ </desc>
+ <desc>
+ <value>2</value>
+ <_name>Brightness</_name>
+ </desc>
+ <desc>
+ <value>3</value>
+ <_name>Saturation</_name>
</desc>
</option>
<subgroup>
diff --git a/src/hoverfx.cpp b/src/hoverfx.cpp
index 401aa6e..b8fbd95 100644
--- a/src/hoverfx.cpp
+++ b/src/hoverfx.cpp
@@ -66,10 +66,12 @@ HoverScreen::handleEvent (XEvent *event)
hw->mOld = hw->mCurrent;
hw->mTarget = 1.0f;
}
- else if (optionGetEffectType () == HoverfxOptions::EffectTypeLevels)
+ else if (optionGetEffectType () == HoverfxOptions::EffectTypeOpacity ||
+ optionGetEffectType () == HoverfxOptions::EffectTypeBrightness ||
+ optionGetEffectType () == HoverfxOptions::EffectTypeSaturation)
{
hw->mOld = hw->mCurrent;
- hw->mTarget = 0.0f;
+ hw->mTarget = 100.0f;
}
hw->mAnimate = true;
hw->toggleFunctions (true);
@@ -89,13 +91,27 @@ HoverScreen::handleEvent (XEvent *event)
hw->mAnimate = true;
if (optionGetEffectType () == HoverfxOptions::EffectTypeScale)
{
+ hw->mDefault = 1.0f;
hw->mOld = hw->mCurrent;
hw->mTarget = optionGetScaleFactor ();
}
- else if (optionGetEffectType () == HoverfxOptions::EffectTypeLevels)
+ else if (optionGetEffectType () == HoverfxOptions::EffectTypeOpacity)
{
+ hw->mDefault = 1.0f;
hw->mOld = hw->mCurrent;
- hw->mTarget = 1.0f;
+ hw->mTarget = optionGetOpacity ();
+ }
+ else if (optionGetEffectType () == HoverfxOptions::EffectTypeBrightness)
+ {
+ hw->mDefault = 1.0f;
+ hw->mOld = hw->mCurrent;
+ hw->mTarget = optionGetBrightness ();
+ }
+ else if (optionGetEffectType () == HoverfxOptions::EffectTypeSaturation)
+ {
+ hw->mDefault = 1.0f;
+ hw->mOld = hw->mCurrent;
+ hw->mTarget = optionGetSaturation ();
}
hw->mIsHovered = true;
mHoveredWindows.push_back (w);
@@ -120,10 +136,12 @@ HoverScreen::handleEvent (XEvent *event)
hw->mOld = hw->mCurrent;
hw->mTarget = 1.0f;
}
- else if (optionGetEffectType () == HoverfxOptions::EffectTypeLevels)
+ else if (optionGetEffectType () == HoverfxOptions::EffectTypeOpacity ||
+ optionGetEffectType () == HoverfxOptions::EffectTypeBrightness ||
+ optionGetEffectType () == HoverfxOptions::EffectTypeSaturation)
{
hw->mOld = hw->mCurrent;
- hw->mTarget = 1.0f;
+ hw->mTarget = 100.0f;
}
hw->toggleFunctions (true);
hw->mIsHovered = false;
@@ -166,7 +184,7 @@ HoverScreen::preparePaint (int ms)
hw->mAnimate = false;
hw->mCurrent = hw->mTarget;
}
- if (hw->mCurrent == 1.0f)
+ if (hw->mCurrent == hw->mDefault)
{
hw->mAnimate = false;
mHoveredWindows.remove (w);
@@ -220,13 +238,24 @@ HoverWindow::glPaint (const GLWindowPaintAttrib &attrib,
return gWindow->glPaint (attrib, wTransform, region, mask);
}
- else if (hs->optionGetEffectType () == HoverfxOptions::EffectTypeLevels)
+ else if (hs->optionGetEffectType () == HoverfxOptions::EffectTypeOpacity)
{
GLWindowPaintAttrib wAttrib (attrib);
+ wAttrib.opacity = (float) (mCurrent * OPAQUE) / 100;
- wAttrib.brightness -= mCurrent * ((float) (100 - hs->optionGetBrightness ()) / (float) 100) * BRIGHT;
- wAttrib.opacity -= mCurrent * ((float) (100 - hs->optionGetOpacity ()) / (float) 100) * OPAQUE;
- wAttrib.saturation -= mCurrent * ((float) (100 - hs->optionGetSaturation ()) / (float) 100) * COLOR;
+ return gWindow->glPaint (wAttrib, transform, region, mask);
+ }
+ else if (hs->optionGetEffectType () == HoverfxOptions::EffectTypeBrightness)
+ {
+ GLWindowPaintAttrib wAttrib (attrib);
+ wAttrib.brightness = (float) (mCurrent * BRIGHT) / 100;
+
+ return gWindow->glPaint (wAttrib, transform, region, mask);
+ }
+ else if (hs->optionGetEffectType () == HoverfxOptions::EffectTypeSaturation)
+ {
+ GLWindowPaintAttrib wAttrib (attrib);
+ wAttrib.saturation = (float) (mCurrent * COLOR) / 100;
return gWindow->glPaint (wAttrib, transform, region, mask);
}
diff --git a/src/hoverfx.h b/src/hoverfx.h
index 6e216ab..a2ac065 100644
--- a/src/hoverfx.h
+++ b/src/hoverfx.h
@@ -62,6 +62,7 @@ class HoverWindow :
bool mIsHovered;
bool mAnimate;
+ float mDefault;
float mOld;
float mCurrent;
float mTarget;