1 module dmagick.c.composite;
2 
3 import dmagick.c.image;
4 import dmagick.c.magickType;
5 
6 alias ptrdiff_t ssize_t;
7 
8 extern(C)
9 {
10 	/**
11 	 * Select the image composition algorithm used to compose a
12 	 * composite image with a image.
13 	 */
14 	enum CompositeOperator
15 	{
16 		/** */
17 		UndefinedCompositeOp,
18 
19 		/**
20 		 * No composite operator has been specified.
21 		 */
22 		NoCompositeOp,
23 		
24 		/**
25 		 * The result of composite image + image,
26 		 * with overflow wrapping around (mod 256).
27 		 */
28 		ModulusAddCompositeOp,
29 		
30 		/**
31 		 * The result is the same shape as image, with composite image
32 		 * obscuring image where the image shapes overlap. Note that this
33 		 * differs from OverCompositeOp because the portion of composite
34 		 * image outside of image's shape does not appear in the result.
35 		 */
36 		AtopCompositeOp,
37 		
38 		/**
39 		 * Merges images together such that both images are treated
40 		 * equally (being just added together), according to the percentage
41 		 * arguments given.
42 		 */
43 		BlendCompositeOp,
44 		
45 		/**
46 		 * The result image shaded by composite image.
47 		 */
48 		BumpmapCompositeOp,
49 		
50 		/**
51 		 * Replace any destination pixel that is the similar to the source
52 		 * image's pixel (as defined by the current fuzz factor),
53 		 * with transparency.
54 		 */
55 		ChangeMaskCompositeOp,
56 		
57 		/**
58 		 * Make the target image transparent. The composite image is ignored.
59 		 */
60 		ClearCompositeOp,
61 		
62 		/**
63 		 * Darkens the destination color to reflect the source color.
64 		 * Painting with white produces no change.
65 		 */
66 		ColorBurnCompositeOp,
67 		
68 		/**
69 		 * Brightens the destination color to reflect the source color.
70 		 * Painting with black produces no change.
71 		 */
72 		ColorDodgeCompositeOp,
73 		
74 		/**
75 		 * Each pixel in the result image is the combination of the
76 		 * brightness of the target image and the saturation and hue of the
77 		 * composite image. This is the opposite of LuminizeCompositeOp.
78 		 */
79 		ColorizeCompositeOp,
80 		
81 		/**
82 		 * Copy the black channel from the composite image to the target image.
83 		 */
84 		CopyBlackCompositeOp,
85 		
86 		/**
87 		 * Copy the blue channel from the composite image to the target image.
88 		 */
89 		CopyBlueCompositeOp,
90 		
91 		/**
92 		 * Replace the target image with the composite image.
93 		 */
94 		CopyCompositeOp,
95 		
96 		/**
97 		 * Copy the cyan channel from the composite image to the target image.
98 		 */
99 		CopyCyanCompositeOp,
100 		
101 		/**
102 		 * Copy the green channel from the composite image to the target image.
103 		 */
104 		CopyGreenCompositeOp,
105 		
106 		/**
107 		 * Copy the magenta channel from the composite image to the target image.
108 		 */
109 		CopyMagentaCompositeOp,
110 		
111 		/**
112 		 * If the composite image's matte attribute is true, copy the
113 		 * opacity channel from the composite image to the target image.
114 		 * Otherwise, set the target image pixel's opacity to the intensity
115 		 * of the corresponding pixel in the composite image.
116 		 */
117 		CopyOpacityCompositeOp,
118 		
119 		/**
120 		 * Copy the red channel from the composite image to the target image.
121 		 */
122 		CopyRedCompositeOp,
123 		
124 		/**
125 		 * Copy the yellow channel from the composite image to the target image.
126 		 */
127 		CopyYellowCompositeOp,
128 		
129 		/**
130 		 * Replace target image pixels with darker
131 		 * pixels from the composite image.
132 		 */
133 		DarkenCompositeOp,
134 		
135 		/**
136 		 * The part of the destination lying inside of the source is
137 		 * composited over the source and replaces the destination.
138 		 */
139 		DstAtopCompositeOp,
140 		
141 		/**
142 		 * The destination is left untouched.
143 		 */
144 		DstCompositeOp,
145 		
146 		/**
147 		 * The part of the destination lying inside of
148 		 * the source replaces the destination.
149 		 */
150 		DstInCompositeOp,
151 		
152 		/**
153 		 * The part of the destination lying outside of
154 		 * the source replaces the destination.
155 		 */
156 		DstOutCompositeOp,
157 		
158 		/**
159 		 * The destination is composited over the source
160 		 * and the result replaces the destination.
161 		 */
162 		DstOverCompositeOp,
163 		
164 		/**
165 		 * The result of abs(composite image - image). This is useful
166 		 * for comparing two very similar images.
167 		 */
168 		DifferenceCompositeOp,
169 		
170 		/**
171 		 * Displace target image pixels as defined by a displacement map.
172 		 * The operator used by the displace method.
173 		 */
174 		DisplaceCompositeOp,
175 		
176 		/**
177 		 * The operator used in the dissolve method.
178 		 */
179 		DissolveCompositeOp,
180 		
181 		/**
182 		 * Produces an effect similar to that of 'difference', but appears
183 		 * as lower contrast. Painting with white inverts the destination
184 		 * color. Painting with black produces no change.
185 		 */
186 		ExclusionCompositeOp,
187 		
188 		/**
189 		 * Multiplies or screens the colors, dependent on the source color
190 		 * value. If the source color is lighter than 0.5, the destination
191 		 * is lightened as if it were screened. If the source color is darker
192 		 * than 0.5, the destination is darkened, as if it were multiplied.
193 		 * The degree of lightening or darkening is proportional to the
194 		 * difference between the source color and 0.5. If it is equal to
195 		 * 0.5 the destination is unchanged. Painting with pure black or
196 		 * white produces black or white.
197 		 */
198 		HardLightCompositeOp,
199 		
200 		/**
201 		 * Each pixel in the result image is the combination of the hue of
202 		 * the target image and the saturation and brightness of the
203 		 * composite image.
204 		 */
205 		HueCompositeOp,
206 		
207 		/**
208 		 * The result is simply composite image cut by the shape of image.
209 		 * None of the image data of image is included in the result.
210 		 */
211 		InCompositeOp,
212 		
213 		/**
214 		 * Replace target image pixels with lighter
215 		 * pixels from the composite image.
216 		 */
217 		LightenCompositeOp,
218 		
219 		/**
220 		 * Increase contrast slightly with an impact on the foreground's
221 		 * tonal values.
222 		 */
223 		LinearLightCompositeOp,
224 		
225 		/**
226 		 * Each pixel in the result image is the combination of the
227 		 * brightness of the composite image and the saturation and hue
228 		 * of the target image. This is the opposite of ColorizeCompositeOp.
229 		 */
230 		LuminizeCompositeOp,
231 		
232 		/**
233 		 * The result of composite image - image, with overflow cropped
234 		 * to zero. The matte chanel is ignored (set to 255, full coverage).
235 		 */
236 		MinusDstCompositeOp,
237 		
238 		/**
239 		 * Used by the watermark method.
240 		 */
241 		ModulateCompositeOp,
242 		
243 		/**
244 		 * Multiplies the color of each target image pixel by the color
245 		 * of the corresponding composite image pixel. The result color
246 		 * is always darker.
247 		 */
248 		MultiplyCompositeOp,
249 		
250 		/**
251 		 * The resulting image is composite image
252 		 * with the shape of image cut out.
253 		 */
254 		OutCompositeOp,
255 		
256 		/**
257 		 * The result is the union of the the two image shapes with composite
258 		 * image obscuring image in the region of overlap. The matte channel
259 		 * of the composite image is respected, so that if the composite
260 		 * pixel is part or all transparent, the corresponding image pixel
261 		 * will show through.
262 		 */
263 		OverCompositeOp,
264 		
265 		/**
266 		 * Multiplies or screens the colors, dependent on the destination
267 		 * color. Source colors overlay the destination whilst preserving
268 		 * its highlights and shadows. The destination color is not replaced,
269 		 * but is mixed with the source color to reflect the lightness or
270 		 * darkness of the destination.
271 		 */
272 		OverlayCompositeOp,
273 		
274 		/**
275 		 * The result is just the sum of the image data. Output values are
276 		 * cropped to 255 (no overflow). This operation is independent of
277 		 * the matte channels.
278 		 */
279 		PlusCompositeOp,
280 		
281 		/**
282 		 * The resulting image is image replaced with composite image.
283 		 * Here the matte information is ignored.
284 		 */
285 		ReplaceCompositeOp,
286 		
287 		/**
288 		 * Each pixel in the result image is the combination of the
289 		 * saturation of the target image and the hue and brightness
290 		 * of the composite image.
291 		 */
292 		SaturateCompositeOp,
293 		
294 		/**
295 		 * Multiplies the inverse of each image's color information.
296 		 */
297 		ScreenCompositeOp,
298 		
299 		/**
300 		 * Darkens or lightens the colors, dependent on the source color
301 		 * value. If the source color is lighter than 0.5, the destination
302 		 * is lightened. If the source color is darker than 0.5, the
303 		 * destination is darkened, as if it were burned in. The degree of
304 		 * darkening or lightening is proportional to the difference between
305 		 * the source color and 0.5. If it is equal to 0.5, the destination
306 		 * is unchanged. Painting with pure black or white produces a
307 		 * distinctly darker or lighter area, but does not result in pure
308 		 * black or white.
309 		 */
310 		SoftLightCompositeOp,
311 		
312 		/**
313 		 * The part of the source lying inside of the destination is
314 		 * composited onto the destination.
315 		 */
316 		SrcAtopCompositeOp,
317 		
318 		/**
319 		 * The source is copied to the destination.
320 		 * The destination is not used as input.
321 		 */
322 		SrcCompositeOp,
323 		
324 		/**
325 		 * The part of the source lying inside of the destination
326 		 * replaces the destination.
327 		 */
328 		SrcInCompositeOp,
329 		
330 		/**
331 		 * The part of the source lying outside of the destination
332 		 * replaces the destination.
333 		 */
334 		SrcOutCompositeOp,
335 		
336 		/**
337 		 * The source is composited over the destination.
338 		 */
339 		SrcOverCompositeOp,
340 		
341 		/**
342 		 * The result of composite image - image, with underflow wrapping
343 		 * around (mod 256). The add and subtract operators can be used to
344 		 * perform reversable transformations.
345 		 */
346 		ModulusSubtractCompositeOp,
347 		
348 		/** */
349 		ThresholdCompositeOp,
350 		
351 		/**
352 		 * The result is the image data from both composite image and image
353 		 * that is outside the overlap region. The overlap region will
354 		 * be blank.
355 		 */
356 		XorCompositeOp,
357 
358 		/*
359 		 * These are new operators, added after the above was last sorted.
360 		 * The list should be re-sorted only when a new library version is
361 		 * created.
362 		 */
363 		
364 		/**
365 		 * The two images are divided from each other, Src / Dest.
366 		 */
367 		DivideDstCompositeOp,
368 		
369 		/**
370 		 * Distort an image, using the given method
371 		 * and its required arguments.
372 		 */
373 		DistortCompositeOp,
374 		
375 		/**
376 		 * Provides you with a method of replacing each individual pixel by
377 		 * a Elliptical Gaussian Average (a blur) of the neighbouring pixels,
378 		 * according to a mapping image.
379 		 */
380 		BlurCompositeOp,
381 		
382 		/**
383 		 * Almost equivalent to SoftLightCompositeOp, but using
384 		 * a continuious mathematical formula rather than two conditionally
385 		 * selected formulae.
386 		 */
387 		PegtopLightCompositeOp,
388 		
389 		/**
390 		 * A modified LinearLightCompositeOp designed to preserve very
391 		 * stong primary and secondary colors in the image.
392 		 */
393 		VividLightCompositeOp,
394 		
395 		/**
396 		 * Similar to HardLightCompositeOp, but using sharp linear shadings,
397 		 * to similate the effects of a strong 'pinhole' light source.
398 		 */
399 		PinLightCompositeOp,
400 		
401 		/**
402 		 * This is equivelent to PlusCompositeOp in that the color channels
403 		 * are simply added, however it does not "plus" the alpha channel,
404 		 * but uses the normal OverCompositeOp alpha blending, which
405 		 * transparencies are involved. Produces a sort of additive
406 		 * multiply-like result.
407 		 */
408 		LinearDodgeCompositeOp,
409 		
410 		/**
411 		 * Same as LinearDodgeCompositeOp, but also subtract one from the
412 		 * result. Sort of a additive 'Screen' of the images
413 		 */
414 		LinearBurnCompositeOp,
415 		
416 		/**
417 		 * This composite method takes 4 numerical values to allow the user
418 		 * to define many different Mathematical Compose Methods.
419 		 */
420 		MathematicsCompositeOp,
421 		
422 		/**
423 		 * The two images are divided from each other, Dest / Src.
424 		 */
425 		DivideSrcCompositeOp,
426 		
427 		/**
428 		 * The result of image - composite image, with overflow cropped
429 		 * to zero. The matte chanel is ignored (set to 255, full coverage).
430 		 */
431 		MinusSrcCompositeOp,
432 		
433 		/**
434 		 * Compare the source and destination image color values and
435 		 * take the darker value.
436 		 */
437 		DarkenIntensityCompositeOp,
438 		
439 		/**
440 		 * Compare the source and destination image color values and
441 		 * take the lighter value.
442 		 */
443 		LightenIntensityCompositeOp,
444 
445 		/** */
446 		HardMixCompositeOp,
447 
448 		/* Depreciated (renamed) Method Names for backward compatibility */
449 		AddCompositeOp      = ModulusAddCompositeOp,
450 		SubtractCompositeOp = ModulusSubtractCompositeOp,
451 		MinusCompositeOp    = MinusDstCompositeOp,
452 		DivideCompositeOp   = DivideDstCompositeOp		
453 	}
454 
455 	MagickBooleanType CompositeImage(Image*, const CompositeOperator, const(Image)*, const ssize_t, const ssize_t);
456 	MagickBooleanType CompositeImageChannel(Image*, const ChannelType, const CompositeOperator, const(Image)*, const ssize_t, const ssize_t);
457 	MagickBooleanType TextureImage(Image*, const(Image)*);
458 }