# Changeset 2005Tweet

Ignore:
Timestamp:
Nov 17, 2007, 12:35:59 PM (14 years ago)
Message:
• Nicer colour pattern.
Location:
www/study
Files:
3 edited

Unmodified
Added
Removed
• ## www/study/part5.html

 r2002

5.2. Accounting for other dimensions

The following patterns shows three ways to dither the same colour using our 8-colour palette. The first one mixes black, yellow and white pixels. The second one mixes red, green and cyan pixels. The last one mixes red, green and magenta pixels. But they all visually blend to the same colour:

The following patterns show four ways to dither the same colour using our 8-colour palette. The first one mixes black, red and white pixels. The second one mixes black, red and cyan pixels. The third mixes black, red, green and magenta pixels. The last one mixes black, red, green and blue pixels. But all patterns visually blend to the same shade:

• ## www/study/study.py

 r2002 # Pattern 5.1.2: different colours give the same result dest = Image((240, 160)) dest = Image((320, 160)) for x in range(80): for y in range(80): r = DITHER_BAYER44[(y / 4) % 4][(x / 4) % 4] > 7 g = DITHER_BAYER44[(y / 4) % 4][(x / 4) % 4] > 13 b = DITHER_BAYER44[(y / 4) % 4][(x / 4) % 4] > 7 r = DITHER_BAYER44[(y / 8) % 4][(x / 8) % 4] > 7 g = DITHER_BAYER44[(y / 8) % 4][(x / 8) % 4] > 13 b = DITHER_BAYER44[(y / 8) % 4][(x / 8) % 4] > 13 dest.setRgb(x, y, r, b, g) for y in range(80, 160): r = DITHER_BAYER44[y % 4][x % 4] > 7 g = DITHER_BAYER44[y % 4][x % 4] > 13 b = DITHER_BAYER44[y % 4][x % 4] > 7 b = DITHER_BAYER44[y % 4][x % 4] > 13 dest.setRgb(x, y, r, b, g) for x in range(80, 160): for y in range(80): r = DITHER_BAYER44[(y / 4) % 4][(x / 4 + 1) % 4] > 7 g = DITHER_BAYER44[(y / 4) % 4][(x / 4) % 4] > 13 b = DITHER_BAYER44[(y / 4) % 4][(x / 4) % 4] > 7 r = DITHER_BAYER44[(y / 8) % 4][(x / 8) % 4] > 7 g = DITHER_BAYER44[(y / 8) % 4][(x / 8 + 1) % 4] > 13 b = DITHER_BAYER44[(y / 8) % 4][(x / 8 + 1) % 4] > 13 dest.setRgb(x, y, r, b, g) for y in range(80, 160): r = DITHER_BAYER44[y % 4][(x + 1) % 4] > 7 g = DITHER_BAYER44[y % 4][x % 4] > 13 b = DITHER_BAYER44[y % 4][x % 4] > 7 r = DITHER_BAYER44[y % 4][x % 4] > 7 g = DITHER_BAYER44[y % 4][(x + 1) % 4] > 13 b = DITHER_BAYER44[y % 4][(x + 1) % 4] > 13 dest.setRgb(x, y, r, b, g) for x in range(160, 240): for y in range(80): r = DITHER_BAYER44[(y / 4 + 1) % 4][(x / 4 + 1) % 4] > 7 g = DITHER_BAYER44[(y / 4) % 4][(x / 4) % 4] > 13 b = DITHER_BAYER44[(y / 4 + 1) % 4][(x / 4) % 4] > 7 r = DITHER_BAYER44[(y / 8 + 1) % 4][(x / 8 + 1) % 4] > 7 g = DITHER_BAYER44[(y / 8) % 4][(x / 8) % 4] > 13 b = DITHER_BAYER44[(y / 8 + 1) % 4][(x / 8) % 4] > 13 dest.setRgb(x, y, r, b, g) for y in range(80, 160): r = DITHER_BAYER44[(y + 1) % 4][(x + 1) % 4] > 7 g = DITHER_BAYER44[y % 4][x % 4] > 13 b = DITHER_BAYER44[(y + 1) % 4][x % 4] > 7 b = DITHER_BAYER44[(y + 1) % 4][x % 4] > 13 dest.setRgb(x, y, r, b, g) for x in range(240, 320): for y in range(80): r = DITHER_BAYER44[(y / 8 + 1) % 4][(x / 8) % 4] > 7 g = DITHER_BAYER44[(y / 8) % 4][(x / 8) % 4] > 13 b = DITHER_BAYER44[(y / 8) % 4][(x / 8 + 2) % 4] > 13 dest.setRgb(x, y, r, b, g) for y in range(80, 160): r = DITHER_BAYER44[(y + 1) % 4][x % 4] > 7 g = DITHER_BAYER44[y % 4][x % 4] > 13 b = DITHER_BAYER44[y % 4][(x + 2) % 4] > 13 dest.setRgb(x, y, r, b, g) dest.writePng("pat5-1-2.png")
Note: See TracChangeset for help on using the changeset viewer.