Changeset 2002
- Timestamp:
- Nov 17, 2007, 3:12:54 AM (13 years ago)
- Location:
- www/study
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
www/study/part5.html
r1979 r2002 37 37 depends on the output media even more than grayscale dithering. </p> 38 38 39 <h3> Separate-space dithering </h3>39 <h3> 5.1. Separate-space dithering </h3> 40 40 41 41 <p> In some cases it is possible to perform three one-dimensional dithering … … 66 66 </p> 67 67 68 <h3> 5.2. Accounting for other dimensions </h3> 69 70 <p> The following patterns shows three ways to dither the same colour 71 using our 8-colour palette. The first one mixes black, yellow and white 72 pixels. The second one mixes red, green and cyan pixels. The last one 73 mixes red, green and magenta pixels. But they all visually blend to the 74 same colour: </p> 75 76 <p style="text-align: center;"> 77 <img src="pat5-1-2.png" width="240" height="160" 78 class="inline" alt="3 ways to dither the same colour" /> 79 </p> 80 68 81 <div style="float: left;"> 69 82 <a href="part4.html">Grayscale dithering <<<</a> -
www/study/study.py
r1991 r2002 535 535 test501(lenna256, ERROR_FSTEIN, test42x).writePng("out5-1-2.png") 536 536 537 # Pattern 5.1.2: red-green or red-yellow pattern?537 # Pattern 5.1.2: different colours give the same result 538 538 dest = Image((240, 160)) 539 539 for x in range(80): 540 540 for y in range(80): 541 r = DITHER_BAYER44[(y / 4) % 4][(x / 4) % 4] > 11541 r = DITHER_BAYER44[(y / 4) % 4][(x / 4) % 4] > 7 542 542 g = DITHER_BAYER44[(y / 4) % 4][(x / 4) % 4] > 13 543 dest.setRgb(x, y, r, 0, g) 543 b = DITHER_BAYER44[(y / 4) % 4][(x / 4) % 4] > 7 544 dest.setRgb(x, y, r, b, g) 544 545 for y in range(80, 160): 545 r = DITHER_BAYER44[y % 4][x % 4] > 11546 r = DITHER_BAYER44[y % 4][x % 4] > 7 546 547 g = DITHER_BAYER44[y % 4][x % 4] > 13 547 dest.setRgb(x, y, r, 0, g) 548 b = DITHER_BAYER44[y % 4][x % 4] > 7 549 dest.setRgb(x, y, r, b, g) 548 550 for x in range(80, 160): 549 551 for y in range(80): 550 r = DITHER_BAYER44[(y / 4 + 1) % 4][(x / 4 + 1) % 4] > 11552 r = DITHER_BAYER44[(y / 4) % 4][(x / 4 + 1) % 4] > 7 551 553 g = DITHER_BAYER44[(y / 4) % 4][(x / 4) % 4] > 13 552 dest.setRgb(x, y, r, 0, g) 554 b = DITHER_BAYER44[(y / 4) % 4][(x / 4) % 4] > 7 555 dest.setRgb(x, y, r, b, g) 553 556 for y in range(80, 160): 554 r = DITHER_BAYER44[ (y + 1) % 4][(x + 1) % 4] > 11557 r = DITHER_BAYER44[y % 4][(x + 1) % 4] > 7 555 558 g = DITHER_BAYER44[y % 4][x % 4] > 13 556 dest.setRgb(x, y, r, 0, g) 559 b = DITHER_BAYER44[y % 4][x % 4] > 7 560 dest.setRgb(x, y, r, b, g) 557 561 for x in range(160, 240): 558 562 for y in range(80): 559 r = DITHER_BAYER44[(y / 4 ) % 4][(x / 4 + 1) % 4] > 11563 r = DITHER_BAYER44[(y / 4 + 1) % 4][(x / 4 + 1) % 4] > 7 560 564 g = DITHER_BAYER44[(y / 4) % 4][(x / 4) % 4] > 13 561 dest.setRgb(x, y, r, 0, g) 565 b = DITHER_BAYER44[(y / 4 + 1) % 4][(x / 4) % 4] > 7 566 dest.setRgb(x, y, r, b, g) 562 567 for y in range(80, 160): 563 r = DITHER_BAYER44[ y % 4][(x + 1) % 4] > 11568 r = DITHER_BAYER44[(y + 1) % 4][(x + 1) % 4] > 7 564 569 g = DITHER_BAYER44[y % 4][x % 4] > 13 565 dest.setRgb(x, y, r, 0, g) 570 b = DITHER_BAYER44[(y + 1) % 4][x % 4] > 7 571 dest.setRgb(x, y, r, b, g) 566 572 dest.writePng("pat5-1-2.png") 567 573
Note: See TracChangeset
for help on using the changeset viewer.