summaryrefslogtreecommitdiff
path: root/dmagick/c/pixel.d
blob: 424fe5ede90a94e4cfa3bf6b4754f5bd0bf15923 (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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
module dmagick.c.pixel;

import dmagick.c.cacheView;
import dmagick.c.colorspace;
import dmagick.c.constitute;
import dmagick.c.exception;
import dmagick.c.image;
import dmagick.c.magickType;
import dmagick.c.magickVersion;

alias ptrdiff_t ssize_t;

extern(C)
{
	/**
	 * The pixel color interpolation method.
	 */
	enum InterpolatePixelMethod
	{
		UndefinedInterpolatePixel,       ///
		AverageInterpolatePixel,         /// The average color of the surrounding four pixels.
		BicubicInterpolatePixel,         /// Fitted bicubic-spines of surrounding 16 pixels.
		BilinearInterpolatePixel,        /// A double linear interpolation of pixels (the default).
		FilterInterpolatePixel,          /// Use resize filter settings.
		IntegerInterpolatePixel,         /// The color of the top-left pixel (floor function).
		MeshInterpolatePixel,            /// Divide area into two flat triangular interpolations.
		NearestNeighborInterpolatePixel, /// The nearest pixel to the lookup point (rounded function).
		SplineInterpolatePixel,          /// Direct spline curves (colors are blurred).
		Average9InterpolatePixel,        /// Average 9 nearest neighbours.
		Average16InterpolatePixel,       /// Average 16 nearest neighbours.
		BlendInterpolatePixel,           /// blend of nearest 1, 2 or 4 pixels.
		BackgroundInterpolatePixel,      /// just return background color.
		CatromInterpolatePixel           /// Catmull-Rom interpolation.
	}


	static if ( MagickLibVersion >= 0x671 )
	{
		enum PixelComponent
		{
			PixelRed = 0,
			PixelCyan = 0,
			PixelGray = 0,
			PixelY = 0,
			PixelGreen = 1,
			PixelMagenta = 1,
			PixelCb = 1,
			PixelBlue = 2,
			PixelYellow = 2,
			PixelCr = 2,
			PixelAlpha = 3,
			PixelBlack = 4,
			PixelIndex = 4,
		}
	}
	else
	{
		enum PixelComponent
		{
			RedPixelComponent = 0,
			CyanPixelComponent = 0,
			GrayPixelComponent = 0,
			YPixelComponent = 0,
			GreenPixelComponent = 1,
			MagentaPixelComponent = 1,
			CbPixelComponent = 1,
			BluePixelComponent = 2,
			YellowPixelComponent = 2,
			CrPixelComponent = 2,
			AlphaPixelComponent = 3,
			BlackPixelComponent = 4,
			IndexPixelComponent = 4,
			MaskPixelComponent = 5
		}
	}

	struct DoublePixelPacket
	{
		double
			red,
			green,
			blue,
			opacity,
			index;
	}

	struct LongPixelPacket
	{
		uint
			red,
			green,
			blue,
			opacity,
			index;
	} 

	struct MagickPixelPacket
	{
		ClassType
			storage_class;

		ColorspaceType
			colorspace;

		MagickBooleanType
			matte;

		double
			fuzz;

		size_t
			depth;

		MagickRealType
			red,
			green,
			blue,
			opacity,
			index;
	}

	alias Quantum IndexPacket;

	struct PixelPacket
	{
		Quantum
			blue,
			green,
			red,
			opacity;
	}

	static if ( MagickLibVersion >= 0x680 )
	{
		struct QuantumPixelPacket
		{
			Quantum
				red,
				green,
				blue,
				opacity,
				index;
		}
	}

	MagickBooleanType ExportImagePixels(const(Image)*, const ssize_t, const ssize_t, const size_t, const size_t, const(char)*, const StorageType, void*, ExceptionInfo*);
	MagickBooleanType ImportImagePixels(Image*, const ssize_t, const ssize_t, const size_t, const size_t, const(char)*, const StorageType, const(void)*);

	static if ( MagickLibVersion >= 0x669 )
	{
		MagickBooleanType InterpolateMagickPixelPacket(const Image*, const CacheView*, const InterpolatePixelMethod, const double, const double, MagickPixelPacket*, ExceptionInfo*);
	}

	static if ( MagickLibVersion >= 0x678 )
	{
		MagickPixelPacket* CloneMagickPixelPacket(const(MagickPixelPacket)*);
	}

	void GetMagickPixelPacket(const(Image)*, MagickPixelPacket*);
}