summaryrefslogtreecommitdiff
path: root/dmagick/c/composite.d
blob: 1e94a1ec7cefbbc887733301188ab0a251651dca (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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
module dmagick.c.composite;

import dmagick.c.image;
import dmagick.c.magickType;

alias ptrdiff_t ssize_t;

extern(C)
{
	/**
	 * Select the image composition algorithm used to compose a
	 * composite image with a image.
	 */
	enum CompositeOperator
	{
		/** */
		UndefinedCompositeOp,

		/**
		 * No composite operator has been specified.
		 */
		NoCompositeOp,
		
		/**
		 * The result of composite image + image,
		 * with overflow wrapping around (mod 256).
		 */
		ModulusAddCompositeOp,
		
		/**
		 * The result is the same shape as image, with composite image
		 * obscuring image where the image shapes overlap. Note that this
		 * differs from OverCompositeOp because the portion of composite
		 * image outside of image's shape does not appear in the result.
		 */
		AtopCompositeOp,
		
		/**
		 * Merges images together such that both images are treated
		 * equally (being just added together), according to the percentage
		 * arguments given.
		 */
		BlendCompositeOp,
		
		/**
		 * The result image shaded by composite image.
		 */
		BumpmapCompositeOp,
		
		/**
		 * Replace any destination pixel that is the similar to the source
		 * image's pixel (as defined by the current fuzz factor),
		 * with transparency.
		 */
		ChangeMaskCompositeOp,
		
		/**
		 * Make the target image transparent. The composite image is ignored.
		 */
		ClearCompositeOp,
		
		/**
		 * Darkens the destination color to reflect the source color.
		 * Painting with white produces no change.
		 */
		ColorBurnCompositeOp,
		
		/**
		 * Brightens the destination color to reflect the source color.
		 * Painting with black produces no change.
		 */
		ColorDodgeCompositeOp,
		
		/**
		 * Each pixel in the result image is the combination of the
		 * brightness of the target image and the saturation and hue of the
		 * composite image. This is the opposite of LuminizeCompositeOp.
		 */
		ColorizeCompositeOp,
		
		/**
		 * Copy the black channel from the composite image to the target image.
		 */
		CopyBlackCompositeOp,
		
		/**
		 * Copy the blue channel from the composite image to the target image.
		 */
		CopyBlueCompositeOp,
		
		/**
		 * Replace the target image with the composite image.
		 */
		CopyCompositeOp,
		
		/**
		 * Copy the cyan channel from the composite image to the target image.
		 */
		CopyCyanCompositeOp,
		
		/**
		 * Copy the green channel from the composite image to the target image.
		 */
		CopyGreenCompositeOp,
		
		/**
		 * Copy the magenta channel from the composite image to the target image.
		 */
		CopyMagentaCompositeOp,
		
		/**
		 * If the composite image's matte attribute is true, copy the
		 * opacity channel from the composite image to the target image.
		 * Otherwise, set the target image pixel's opacity to the intensity
		 * of the corresponding pixel in the composite image.
		 */
		CopyOpacityCompositeOp,
		
		/**
		 * Copy the red channel from the composite image to the target image.
		 */
		CopyRedCompositeOp,
		
		/**
		 * Copy the yellow channel from the composite image to the target image.
		 */
		CopyYellowCompositeOp,
		
		/**
		 * Replace target image pixels with darker
		 * pixels from the composite image.
		 */
		DarkenCompositeOp,
		
		/**
		 * The part of the destination lying inside of the source is
		 * composited over the source and replaces the destination.
		 */
		DstAtopCompositeOp,
		
		/**
		 * The destination is left untouched.
		 */
		DstCompositeOp,
		
		/**
		 * The part of the destination lying inside of
		 * the source replaces the destination.
		 */
		DstInCompositeOp,
		
		/**
		 * The part of the destination lying outside of
		 * the source replaces the destination.
		 */
		DstOutCompositeOp,
		
		/**
		 * The destination is composited over the source
		 * and the result replaces the destination.
		 */
		DstOverCompositeOp,
		
		/**
		 * The result of abs(composite image - image). This is useful
		 * for comparing two very similar images.
		 */
		DifferenceCompositeOp,
		
		/**
		 * Displace target image pixels as defined by a displacement map.
		 * The operator used by the displace method.
		 */
		DisplaceCompositeOp,
		
		/**
		 * The operator used in the dissolve method.
		 */
		DissolveCompositeOp,
		
		/**
		 * Produces an effect similar to that of 'difference', but appears
		 * as lower contrast. Painting with white inverts the destination
		 * color. Painting with black produces no change.
		 */
		ExclusionCompositeOp,
		
		/**
		 * Multiplies or screens the colors, dependent on the source color
		 * value. If the source color is lighter than 0.5, the destination
		 * is lightened as if it were screened. If the source color is darker
		 * than 0.5, the destination is darkened, as if it were multiplied.
		 * The degree of lightening or darkening is proportional to the
		 * difference between the source color and 0.5. If it is equal to
		 * 0.5 the destination is unchanged. Painting with pure black or
		 * white produces black or white.
		 */
		HardLightCompositeOp,
		
		/**
		 * Each pixel in the result image is the combination of the hue of
		 * the target image and the saturation and brightness of the
		 * composite image.
		 */
		HueCompositeOp,
		
		/**
		 * The result is simply composite image cut by the shape of image.
		 * None of the image data of image is included in the result.
		 */
		InCompositeOp,
		
		/**
		 * Replace target image pixels with lighter
		 * pixels from the composite image.
		 */
		LightenCompositeOp,
		
		/**
		 * Increase contrast slightly with an impact on the foreground's
		 * tonal values.
		 */
		LinearLightCompositeOp,
		
		/**
		 * Each pixel in the result image is the combination of the
		 * brightness of the composite image and the saturation and hue
		 * of the target image. This is the opposite of ColorizeCompositeOp.
		 */
		LuminizeCompositeOp,
		
		/**
		 * The result of composite image - image, with overflow cropped
		 * to zero. The matte chanel is ignored (set to 255, full coverage).
		 */
		MinusDstCompositeOp,
		
		/**
		 * Used by the watermark method.
		 */
		ModulateCompositeOp,
		
		/**
		 * Multiplies the color of each target image pixel by the color
		 * of the corresponding composite image pixel. The result color
		 * is always darker.
		 */
		MultiplyCompositeOp,
		
		/**
		 * The resulting image is composite image
		 * with the shape of image cut out.
		 */
		OutCompositeOp,
		
		/**
		 * The result is the union of the the two image shapes with composite
		 * image obscuring image in the region of overlap. The matte channel
		 * of the composite image is respected, so that if the composite
		 * pixel is part or all transparent, the corresponding image pixel
		 * will show through.
		 */
		OverCompositeOp,
		
		/**
		 * Multiplies or screens the colors, dependent on the destination
		 * color. Source colors overlay the destination whilst preserving
		 * its highlights and shadows. The destination color is not replaced,
		 * but is mixed with the source color to reflect the lightness or
		 * darkness of the destination.
		 */
		OverlayCompositeOp,
		
		/**
		 * The result is just the sum of the image data. Output values are
		 * cropped to 255 (no overflow). This operation is independent of
		 * the matte channels.
		 */
		PlusCompositeOp,
		
		/**
		 * The resulting image is image replaced with composite image.
		 * Here the matte information is ignored.
		 */
		ReplaceCompositeOp,
		
		/**
		 * Each pixel in the result image is the combination of the
		 * saturation of the target image and the hue and brightness
		 * of the composite image.
		 */
		SaturateCompositeOp,
		
		/**
		 * Multiplies the inverse of each image's color information.
		 */
		ScreenCompositeOp,
		
		/**
		 * Darkens or lightens the colors, dependent on the source color
		 * value. If the source color is lighter than 0.5, the destination
		 * is lightened. If the source color is darker than 0.5, the
		 * destination is darkened, as if it were burned in. The degree of
		 * darkening or lightening is proportional to the difference between
		 * the source color and 0.5. If it is equal to 0.5, the destination
		 * is unchanged. Painting with pure black or white produces a
		 * distinctly darker or lighter area, but does not result in pure
		 * black or white.
		 */
		SoftLightCompositeOp,
		
		/**
		 * The part of the source lying inside of the destination is
		 * composited onto the destination.
		 */
		SrcAtopCompositeOp,
		
		/**
		 * The source is copied to the destination.
		 * The destination is not used as input.
		 */
		SrcCompositeOp,
		
		/**
		 * The part of the source lying inside of the destination
		 * replaces the destination.
		 */
		SrcInCompositeOp,
		
		/**
		 * The part of the source lying outside of the destination
		 * replaces the destination.
		 */
		SrcOutCompositeOp,
		
		/**
		 * The source is composited over the destination.
		 */
		SrcOverCompositeOp,
		
		/**
		 * The result of composite image - image, with underflow wrapping
		 * around (mod 256). The add and subtract operators can be used to
		 * perform reversable transformations.
		 */
		ModulusSubtractCompositeOp,
		
		/** */
		ThresholdCompositeOp,
		
		/**
		 * The result is the image data from both composite image and image
		 * that is outside the overlap region. The overlap region will
		 * be blank.
		 */
		XorCompositeOp,

		/*
		 * These are new operators, added after the above was last sorted.
		 * The list should be re-sorted only when a new library version is
		 * created.
		 */
		
		/**
		 * The two images are divided from each other, Src / Dest.
		 */
		DivideDstCompositeOp,
		
		/**
		 * Distort an image, using the given method
		 * and its required arguments.
		 */
		DistortCompositeOp,
		
		/**
		 * Provides you with a method of replacing each individual pixel by
		 * a Elliptical Gaussian Average (a blur) of the neighbouring pixels,
		 * according to a mapping image.
		 */
		BlurCompositeOp,
		
		/**
		 * Almost equivalent to SoftLightCompositeOp, but using
		 * a continuious mathematical formula rather than two conditionally
		 * selected formulae.
		 */
		PegtopLightCompositeOp,
		
		/**
		 * A modified LinearLightCompositeOp designed to preserve very
		 * stong primary and secondary colors in the image.
		 */
		VividLightCompositeOp,
		
		/**
		 * Similar to HardLightCompositeOp, but using sharp linear shadings,
		 * to similate the effects of a strong 'pinhole' light source.
		 */
		PinLightCompositeOp,
		
		/**
		 * This is equivelent to PlusCompositeOp in that the color channels
		 * are simply added, however it does not "plus" the alpha channel,
		 * but uses the normal OverCompositeOp alpha blending, which
		 * transparencies are involved. Produces a sort of additive
		 * multiply-like result.
		 */
		LinearDodgeCompositeOp,
		
		/**
		 * Same as LinearDodgeCompositeOp, but also subtract one from the
		 * result. Sort of a additive 'Screen' of the images
		 */
		LinearBurnCompositeOp,
		
		/**
		 * This composite method takes 4 numerical values to allow the user
		 * to define many different Mathematical Compose Methods.
		 */
		MathematicsCompositeOp,
		
		/**
		 * The two images are divided from each other, Dest / Src.
		 */
		DivideSrcCompositeOp,
		
		/**
		 * The result of image - composite image, with overflow cropped
		 * to zero. The matte chanel is ignored (set to 255, full coverage).
		 */
		MinusSrcCompositeOp,
		
		/**
		 * Compare the source and destination image color values and
		 * take the darker value.
		 */
		DarkenIntensityCompositeOp,
		
		/**
		 * Compare the source and destination image color values and
		 * take the lighter value.
		 */
		LightenIntensityCompositeOp,

		/** */
		HardMixCompositeOp,

		/* Depreciated (renamed) Method Names for backward compatibility */
		AddCompositeOp      = ModulusAddCompositeOp,
		SubtractCompositeOp = ModulusSubtractCompositeOp,
		MinusCompositeOp    = MinusDstCompositeOp,
		DivideCompositeOp   = DivideDstCompositeOp		
	}

	MagickBooleanType CompositeImage(Image*, const CompositeOperator, const(Image)*, const ssize_t, const ssize_t);
	MagickBooleanType CompositeImageChannel(Image*, const ChannelType, const CompositeOperator, const(Image)*, const ssize_t, const ssize_t);
	MagickBooleanType TextureImage(Image*, const(Image)*);
}