blob: 45a87272555ced45d0a5681cebdeff89e1d6bcf2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
/**
* Copyright: Mike Wey 2011
* License: zlib (See accompanying LICENSE file)
* Authors: Mike Wey
*/
module dmagick.ColorGray;
import dmagick.Color;
import dmagick.c.magickType;
import dmagick.c.quantum;
/**
* A Gray scale color.
*/
class ColorGray : Color
{
/** */
this()
{
super();
}
/**
* Create a Color from the specified Bytes.
*/
this(ubyte shade, ubyte opacity = 0)
{
Quantum gray = ScaleCharToQuantum(shade);
super(gray, gray, gray, ScaleCharToQuantum(opacity));
}
/**
* Create a Color from the specified doubles.
* The values should be between 0.0 and 1.0.
*/
this(double shade, double opacity = 0)
{
Quantum gray = scaleDoubleToQuantum(shade);
super(gray, gray, gray, scaleDoubleToQuantum(opacity));
}
/**
* The value for the shade as a double in the range [0.0 .. 1.0]
*/
void shade(double shade)
{
packet.red = scaleDoubleToQuantum(shade);
packet.green = scaleDoubleToQuantum(shade);
packet.blue = scaleDoubleToQuantum(shade);
}
///ditto
double shade()
{
return scaleQuantumToDouble(packet.red);
}
}
|