Changeset 63 for trunk/src/helpers/gpih.c
- Timestamp:
- Apr 25, 2001, 8:55:35 PM (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/gpih.c
r56 r63 196 196 197 197 /* 198 * HackColor: 199 * 200 */ 201 202 VOID HackColor(PBYTE pb, double dFactor) 203 { 204 ULONG ul = (ULONG)((double)(*pb) * dFactor); 205 if (ul > 255) 206 *pb = 255; 207 else 208 *pb = (BYTE)ul; 209 } 210 211 /* 198 212 *@@ gpihManipulateRGB: 199 213 * this changes an RGB color value 200 214 * by multiplying each color component 201 * (red, green, blue) with bMultiplier 202 * and dividing it by bDivisor afterwards. 215 * (red, green, blue) with dFactor. 203 216 * 204 217 * Each color component is treated separately, 205 * so if overflows occur (because bMultiplier218 * so if overflows occur (because dFactor 206 219 * is > 1), this does not affect the other 207 220 * components. 208 221 * 209 * Example: if you pass a brigt red 210 * (0xFF0000) to this func, this will 211 * be 0x7F0000 if bMultiplier and 212 * bDivisor are 1 and 2. 222 *@@changed V0.9.11 (2001-04-25) [umoeller]: changed prototype to use a double now 213 223 */ 214 224 215 225 VOID gpihManipulateRGB(PLONG plColor, // in/out: RGB color 216 BYTE bMultiplier, // in: multiplier 217 BYTE bDivisor) // in: divisor 226 double dFactor) // in: factor (> 1 makes brigher, < 1 makes darker) 218 227 { 219 228 PBYTE pb = (PBYTE)plColor; 229 220 230 // in memory, the bytes are blue, green, red, unused 221 *pb++ = (BYTE)((LONG)(*pb) * bMultiplier / bDivisor); // blue 222 *pb++ = (BYTE)((LONG)(*pb) * bMultiplier / bDivisor); // green 223 *pb++ = (BYTE)((LONG)(*pb) * bMultiplier / bDivisor); // red 231 232 // blue 233 ULONG ul = (ULONG)( (double)(*pb) * dFactor 234 ); 235 if (ul > 255) 236 *pb = 255; 237 else 238 *pb = (BYTE)ul; 239 240 // green 241 ul = (ULONG)( (double)(*(++pb)) * dFactor 242 ); 243 if (ul > 255) 244 *pb = 255; 245 else 246 *pb = (BYTE)ul; 247 248 // red 249 ul = (ULONG)( (double)(*(++pb)) * dFactor 250 ); 251 if (ul > 255) 252 *pb = 255; 253 else 254 *pb = (BYTE)ul; 224 255 } 225 256
Note:
See TracChangeset
for help on using the changeset viewer.