mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
The new function RgbShade() (include osd.h) can be used to generate a brighter or darker version of a given color
This commit is contained in:
parent
5ee947a492
commit
41b1160f01
4
HISTORY
4
HISTORY
@ -7052,7 +7052,7 @@ Video Disk Recorder Revision History
|
||||
- Fixed handling IDLEPRIORITY in cDvbDevice::ProvidesChannel() (thanks to Frank
|
||||
Schmirler).
|
||||
|
||||
2012-05-29: Version 1.7.28
|
||||
2012-06-02: Version 1.7.28
|
||||
|
||||
- Fixed cPixmapMemory::DrawEllipse() for quadrants -1 and -4.
|
||||
- Fixed getting the maximum short channel name length in case there are no short names
|
||||
@ -7116,3 +7116,5 @@ Video Disk Recorder Revision History
|
||||
to the recording's name.
|
||||
- cVector::Clear() now reinitializes any previously used members.
|
||||
- Fixed resetting CAMs (thanks to Marco Skambraks).
|
||||
- The new function RgbShade() (include osd.h) can be used to generate a brighter or
|
||||
darker version of a given color.
|
||||
|
12
osd.c
12
osd.c
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: osd.c 2.29 2012/05/17 13:29:19 kls Exp $
|
||||
* $Id: osd.c 2.30 2012/06/02 10:42:23 kls Exp $
|
||||
*/
|
||||
|
||||
#include "osd.h"
|
||||
@ -40,6 +40,16 @@ tColor HsvToColor(double H, double S, double V)
|
||||
}
|
||||
}
|
||||
|
||||
tColor RgbShade(tColor Color, double Factor)
|
||||
{
|
||||
double f = fabs(constrain(Factor, -1.0, 1.0));
|
||||
double w = Factor > 0 ? f * 0xFF : 0;
|
||||
return (Color & 0xFF000000) |
|
||||
(min(0xFF, int((1 - f) * ((Color >> 16) & 0xFF) + w + 0.5)) << 16) |
|
||||
(min(0xFF, int((1 - f) * ((Color >> 8) & 0xFF) + w + 0.5)) << 8) |
|
||||
(min(0xFF, int((1 - f) * ( Color & 0xFF) + w + 0.5)) );
|
||||
}
|
||||
|
||||
#define USE_ALPHA_LUT
|
||||
#ifdef USE_ALPHA_LUT
|
||||
// Alpha blending with lookup table (by Reinhard Nissl <rnissl@gmx.de>)
|
||||
|
10
osd.h
10
osd.h
@ -4,7 +4,7 @@
|
||||
* See the main source file 'vdr.c' for copyright information and
|
||||
* how to reach the author.
|
||||
*
|
||||
* $Id: osd.h 2.16 2012/05/17 15:09:35 kls Exp $
|
||||
* $Id: osd.h 2.17 2012/06/02 10:32:38 kls Exp $
|
||||
*/
|
||||
|
||||
#ifndef __OSD_H
|
||||
@ -70,6 +70,14 @@ inline tColor RgbToColor(double R, double G, double B)
|
||||
return RgbToColor(uint8_t(0xFF * R), uint8_t(0xFF * G), uint8_t(0xFF * B));
|
||||
}
|
||||
|
||||
tColor RgbShade(tColor Color, double Factor);
|
||||
///< Returns a brighter (Factor > 0) or darker (Factor < 0) version
|
||||
///< of the given Color.
|
||||
///< If Factor is 0.0, the return value is the unchanged Color,
|
||||
///< If Factor is 1.0, white is returned.
|
||||
///< If Factor is -1.0, black is returned.
|
||||
///< The alpha value of Color is returned unchanged.
|
||||
|
||||
tColor HsvToColor(double H, double S, double V);
|
||||
///< Converts the given Hue (0..360), Saturation (0..1) and Value (0..1)
|
||||
///< to an RGB tColor value. The alpha value of the result is 0x00, so
|
||||
|
Loading…
Reference in New Issue
Block a user