Pixmap Manipulation with AlgoSim II

Contents

Blend Modes

We use the sample pictures rabbit.bmp and spider.bmp to illustrate the blend modes.

The Original Pictures

rabbit
Output

spider
Output

1 – Normal

pmBlend(rabbit, spider, 0, 0, 1, 1)
Output

2 – Average

pmBlend(rabbit, spider, 0, 0, 2, 1)
Output

3 – Lighten

pmBlend(rabbit, spider, 0, 0, 3, 1)
Output

4 – Darken

pmBlend(rabbit, spider, 0, 0, 4, 1)
Output

5 – Add

pmBlend(rabbit, spider, 0, 0, 5, 1)
Output

6 – Subtract

pmBlend(rabbit, spider, 0, 0, 6, 1)
Output

7 – Distance

pmBlend(rabbit, spider, 0, 0, 7, 1)
Output

8 – Negation

pmBlend(rabbit, spider, 0, 0, 8, 1)
Output

9 – Exclusion

pmBlend(rabbit, spider, 0, 0, 9, 1)
Output

10 – Multiply

pmBlend(rabbit, spider, 0, 0, 10, 1)
Output

11 – Screen

pmBlend(rabbit, spider, 0, 0, 11, 1)
Output

12 – Soft Light

pmBlend(rabbit, spider, 0, 0, 12, 1)
Output

13 – Hard Light

pmBlend(rabbit, spider, 0, 0, 13, 1)
Output

14 – Overlay

pmBlend(rabbit, spider, 0, 0, 14, 1)
Output

15 – Dodge

pmBlend(rabbit, spider, 0, 0, 15, 1)
Output

16 – Inverse Dodge

pmBlend(rabbit, spider, 0, 0, 16, 1)
Output

17 – Burn

pmBlend(rabbit, spider, 0, 0, 17, 1)
Output

18 – Inverse Burn

pmBlend(rabbit, spider, 0, 0, 18, 1)
Output

19 – Reflect

pmBlend(rabbit, spider, 0, 0, 19, 1)
Output

20 – Inverse Reflect

pmBlend(rabbit, spider, 0, 0, 20, 1)
Output

21 – Freeze

pmBlend(rabbit, spider, 0, 0, 21, 1)
Output

22 – Inverse Freeze

pmBlend(rabbit, spider, 0, 0, 22, 1)
Output

23 – Stamp

pmBlend(rabbit, spider, 0, 0, 23, 1)
Output

24 – Inverse Stamp

pmBlend(rabbit, spider, 0, 0, 24, 1)
Output

25 – Cosine

pmBlend(rabbit, spider, 0, 0, 25, 1)
Output

26 – Xor

pmBlend(rabbit, spider, 0, 0, 26, 1)
Output

27 – And

pmBlend(rabbit, spider, 0, 0, 27, 1)
Output

28 – Or

pmBlend(rabbit, spider, 0, 0, 28, 1)
Output

1 – Normal (with gradient mask)

mask ≔ pmCreateGradientPixmap(800, 600, rgb(1, 1, 1), rgb(0, 0, 0), "horizontal")
pmBlend(rabbit, spider, 0, 0, 1, 1, mask)

Output

Colour Transformations

Hue fixed to 120

pmFixHue(sally, 120)
Output

Hue fixed to 120 and saturation fixed to 1

pmToMonochromatic(sally, 120)
Output

Hue shifted 180°

pmShiftHue(sally, 180)
Output

Greyscale

pmToGreyscale(sally)
Output

RGB Inversion

pmInvert(sally)
Output

Value Inversion

pmInvertValue(sally)
Output

Lightness Inversion

pmInvertLightness(sally)
Output

Custom RGB Adjustment: Red ≔ 0, Blue ≔ Blue + 0.2

pmRGBAdjustment(sally, "fixed", 0, "add", 0, "add", 0.2)
Output

Custom RGB Adjustment: Red ≔ 5⋅Red

pmRGBAdjustment(sally, "mul", 5, "add", 0, "add", 0)
Output

R and G channels swapped

pmSwapRGBComponents(sally, "rg")
Output

Spatial Transformations

General linear transformation

pmTransform(sally, 1.0, 1.2, -0.4, 1.3)
Output

Möbius transformation

pmMöbius(sally)
Output

Special Effects

Edge detection

pmEdgeDetection(sally)
Output

pmEdgeDetection(spider)
Output

Emboss

pmEmboss(sally)
Output

pmEmboss(spider)
Output

Pixelate

pmPixelate(sally, 10)
Output

Noise (90 %, random colour)

pmNoise(sally, 0.9, 30000000#16)
Output

Random spatial distortion (1 px)

pmDistortSpace(sally, 1)
Output

Random colour distortion (50)

pmDistortRGB(sally, 50)
Output

Random colour distortion (1000)

pmDistortRGB(sally, 1000)
Output

Tiles (5)

pmTiles(sally, 5)
Output

Tiles (25)

pmTiles(sally, 25, 25, 0)
Output

Tiles (200)

pmTiles(sally, 200, 200, 0)
Output


Copyright © 2010, 2013 Andreas Rejbrand