11#ifndef __TYPEEVALUATOR__H__
12#define __TYPEEVALUATOR__H__
15#include <helper/obj-ref-impl.hpp>
16#include <helper/SColor.h>
29inline T
Evaluate(
float fraction,
const T &start,
const T &end)
31 return (T)(start + fraction * (end - start));
168 startA = GetAValue(start) / 255.0f;
169 startR = GetRValue(start) / 255.0f;
170 startG = GetGValue(start) / 255.0f;
171 startB = GetBValue(start) / 255.0f;
184 endA = GetAValue(end) / 255.0f;
185 endR = GetRValue(end) / 255.0f;
186 endG = GetGValue(end) / 255.0f;
187 endB = GetBValue(end) / 255.0f;
201 return (
int)floor(v + 0.5f);
219 r = (float)pow(r, 1.0f / 2.2f) * 255.0f;
220 g = (float)pow(g, 1.0f / 2.2f) * 255.0f;
221 b = (float)pow(b, 1.0f / 2.2f) * 255.0f;
263inline RECT
Evaluate(
float fraction,
const RECT &mStart,
const RECT &mEnd)
266 ret.left =
Evaluate(fraction, mStart.left, mEnd.left);
267 ret.top =
Evaluate(fraction, mStart.top, mEnd.top);
268 ret.right =
Evaluate(fraction, mStart.right, mEnd.right);
269 ret.bottom =
Evaluate(fraction, mStart.bottom, mEnd.bottom);
281inline POINT
Evaluate(
float fraction,
const POINT &mStart,
const POINT &mEnd)
284 ret.x =
Evaluate(fraction, mStart.x, mEnd.x);
285 ret.y =
Evaluate(fraction, mStart.y, mEnd.y);
297inline SIZE
Evaluate(
float fraction,
const SIZE &mStart,
const SIZE &mEnd)
300 ret.cx =
Evaluate(fraction, mStart.cx, mEnd.cx);
301 ret.cy =
Evaluate(fraction, mStart.cy, mEnd.cy);
SNSBEGIN T Evaluate(float fraction, const T &start, const T &end)
Template function for linearly interpolating values.
void setStart(COLORREF start)
Sets the starting COLORREF value.
float endB
Ending blue value.
float endA
Ending alpha value.
float startA
Starting alpha value.
int round(float v) const
Rounds a float value to the nearest integer.
void setEnd(COLORREF end)
Sets the ending COLORREF value.
void copy(const TypeEvaluator< COLORREF > *src)
Copies the properties of another TypeEvaluator<COLORREF>.
float startR
Starting red value.
COLORREF evaluate(float fraction) const
Evaluates the interpolated COLORREF value between the start and end values.
void setRange(COLORREF from, COLORREF to)
Sets the range for the interpolation.
float startB
Starting blue value.
float startG
Starting green value.
float endR
Ending red value.
float endG
Ending green value.
TypeEvaluator(COLORREF start, COLORREF end)
Constructor initializing the start and end COLORREF values.
T mEnd
Ending value for the interpolation.
TypeEvaluator(T start, T end)
Constructor initializing the start and end values.
T mStart
Starting value for the interpolation.
void setRange(T start, T end)
Sets the range for the interpolation.
void copy(const TypeEvaluator< T > *src)
Copies the properties of another TypeEvaluator.
T evaluate(float fraction) const
Evaluates the interpolated value between the start and end values.
TypeEvaluator()
Default constructor.