1
/* Copyright (C) 2000 Damir Zucic */
3
/*=============================================================================
8
Prepare the color by mixing two colors, using the proper weighting.
11
(1) Pointer to RGBS structure, with the first color.
12
(2) Pointer to RGBS structure, with the second color.
13
(3) Scale factor (double).
14
(4) Pointer to GUIS structure.
20
The pixel value for the new color.
23
=============================================================================*/
28
#include <X11/Xutil.h>
30
#include <X11/Xatom.h>
35
/*======function prototypes:=================================================*/
37
unsigned long PixelFromRGBS_ (RGBS *, GUIS *);
39
/*======mix two colors:======================================================*/
41
unsigned long PrepareColor_ (RGBS *rgb1SP, RGBS *rgb2SP,
42
double scale_factor, GUIS *guiSP)
44
unsigned long colorID;
45
double color1, delta_color, color;
49
color1 = (double) rgb1SP->red;
50
delta_color = (double) rgb2SP->red - (double) rgb1SP->red;
51
color = color1 + scale_factor * delta_color;
52
rgbS.red = (unsigned short) color;
55
color1 = (double) rgb1SP->green;
56
delta_color = (double) rgb2SP->green - (double) rgb1SP->green;
57
color = color1 + scale_factor * delta_color;
58
rgbS.green = (unsigned short) color;
61
color1 = (double) rgb1SP->blue;
62
delta_color = (double) rgb2SP->blue - (double) rgb1SP->blue;
63
color = color1 + scale_factor * delta_color;
64
rgbS.blue = (unsigned short) color;
67
colorID = PixelFromRGBS_ (&rgbS, guiSP);
69
/* Return the pixel value: */
73
/*===========================================================================*/