-
Notifications
You must be signed in to change notification settings - Fork 0
/
pixelWandQuantum.c
46 lines (29 loc) · 1007 Bytes
/
pixelWandQuantum.c
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
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>
// #include <wand/MagickWand.h>
#include <MagickWand.h>
int main(int argc,char **argv) {
int i;
double blueValue;
Quantum blueQuantum;
MagickWandGenesis();
char * color;
size_t version_number;
char * versionString;
PixelWand *pixel_wand = NULL;
char *colors[] = {"pink", "purple", "red", "blue", "rgb(13, 13, 13)"};
for (i=0; i<4 ; i++) {
color = colors[i];
pixel_wand = NewPixelWand();
PixelSetColor(pixel_wand, color);
blueValue = PixelGetBlue(pixel_wand);
blueQuantum = PixelGetBlueQuantum(pixel_wand);
printf("Color %s \t Blue value is %f, quantum as decimal %d, as float %g\n", color, blueValue, blueQuantum, blueQuantum);
}
versionString = (char *)MagickGetVersion(&version_number);
printf("Version is %s \n", versionString);
MagickWandTerminus();
return(0);
}