Changeset 1991


Ignore:
Timestamp:
Nov 16, 2007, 10:02:59 PM (13 years ago)
Author:
Sam Hocevar
Message:
  • New pattern for future 3-dimensional explanations.
Location:
www/study
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • www/study/study.py

    r1980 r1991  
    499499test42x(gradient256bw, ERROR_FSTEIN, threshold_4).writePng("grad4-2-3.png")
    500500
    501 # Pattern 5.0.1: 8-colour palette
     501# Pattern 5.1.1: 8-colour palette
    502502dest = Image((512, 64))
    503503for x in range(512):
     
    513513lenna256 = Image("lenna256.png")
    514514
    515 # Output 5.0.1: RGB dithering
     515# Output 5.1.1: 8-colour Floyd-Steinberg RGB dithering
     516# Output 5.1.2: 8-colour gamma-corrected Floyd-Steinberg RGB dithering
    516517def test501(src, mat, func):
    517518    (w, h) = src.size()
     
    534535test501(lenna256, ERROR_FSTEIN, test42x).writePng("out5-1-2.png")
    535536
     537# Pattern 5.1.2: red-green or red-yellow pattern?
     538dest = Image((240, 160))
     539for x in range(80):
     540    for y in range(80):
     541        r = DITHER_BAYER44[(y / 4) % 4][(x / 4) % 4] > 11
     542        g = DITHER_BAYER44[(y / 4) % 4][(x / 4) % 4] > 13
     543        dest.setRgb(x, y, r, 0, g)
     544    for y in range(80, 160):
     545        r = DITHER_BAYER44[y % 4][x % 4] > 11
     546        g = DITHER_BAYER44[y % 4][x % 4] > 13
     547        dest.setRgb(x, y, r, 0, g)
     548for x in range(80, 160):
     549    for y in range(80):
     550        r = DITHER_BAYER44[(y / 4 + 1) % 4][(x / 4 + 1) % 4] > 11
     551        g = DITHER_BAYER44[(y / 4) % 4][(x / 4) % 4] > 13
     552        dest.setRgb(x, y, r, 0, g)
     553    for y in range(80, 160):
     554        r = DITHER_BAYER44[(y + 1) % 4][(x + 1) % 4] > 11
     555        g = DITHER_BAYER44[y % 4][x % 4] > 13
     556        dest.setRgb(x, y, r, 0, g)
     557for x in range(160, 240):
     558    for y in range(80):
     559        r = DITHER_BAYER44[(y / 4) % 4][(x / 4 + 1) % 4] > 11
     560        g = DITHER_BAYER44[(y / 4) % 4][(x / 4) % 4] > 13
     561        dest.setRgb(x, y, r, 0, g)
     562    for y in range(80, 160):
     563        r = DITHER_BAYER44[y % 4][(x + 1) % 4] > 11
     564        g = DITHER_BAYER44[y % 4][x % 4] > 13
     565        dest.setRgb(x, y, r, 0, g)
     566dest.writePng("pat5-1-2.png")
     567
    536568##############################################################################
    537569# Place temporary cruft below this
Note: See TracChangeset for help on using the changeset viewer.