Pixmap Manipulation with AlgoSim II

Contents

Blend Modes

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

The Original Pictures

rabbit

spider

1 – Normal

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

2 – Average

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

3 – Lighten

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

4 – Darken

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

5 – Add

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

6 – Subtract

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

7 – Distance

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

8 – Negation

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

9 – Exclusion

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

10 – Multiply

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

11 – Screen

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

12 – Sort Light

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

13 – Hard Light

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

14 – Overlay

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

15 – Dodge

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

16 – Inverse Dodge

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

17 – Burn

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

18 – Inverse Burn

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

19 – Reflect

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

20 – Inverse Reflect

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

21 – Freeze

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

22 – Inverse Freeze

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

23 – Stamp

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

24 – Inverse Stamp

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

25 – Cosine

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

26 – Xor

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

27 – And

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

28 – Or

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

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)

Colour Transformations

Hue fixed to 120

pmFixHue(sally, 120)

Hue fixed to 120 and saturation fixed to 1

pmToMonochromatic(sally, 120)

Hue shifted 180°

pmShiftHue(sally, 180)

Greyscale

pmToGreyscale(sally)

RGB Inversion

pmInvert(sally)

Value Inversion

pmInvertValue(sally)

Lightness Inversion

pmInvertLightness(sally)

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

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

Custom RGB Adjustment: Red ≔ 5⋅Red

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

R and G channels swapped

pmSwapRGBComponents(sally, "rg")

Spatial Transformations

General linear transformation

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

Möbius transformation

pmMöbius(sally)

Special Effects

Edge detection

pmEdgeDetection(sally)

pmEdgeDetection(spider)

Emboss

pmEmboss(sally)

pmEmboss(spider)

Pixelate

pmPixelate(sally, 10)

Noise (90 %, random colour)

pmNoise(sally, 0.9, 30000000#16)

Random spatial distortion (1 px)

pmDistortSpace(sally, 1)

Random colour distortion (50)

pmDistortRGB(sally, 50)

Random colour distortion (1000)

pmDistortRGB(sally, 1000)

Tiles (5)

pmTiles(sally, 5)

Tiles (25)

pmTiles(sally, 25, 25, 0)

Tiles (200)

pmTiles(sally, 200, 200, 0)


Copyright © 2010 Andreas Rejbrand