Changeset 2126


Ignore:
Timestamp:
Dec 6, 2007, 11:46:49 PM (12 years ago)
Author:
Sam Hocevar
Message:
  • Get rid of test52x(), use getZoom() and getRegion() instead.
Location:
www/study
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • www/study/study.py

    r2125 r2126  
    999999# Output 5.2.1: cropped 5.1.2
    10001000# Output 5.2.2: close-up of cropped 5.1.2
    1001 def test52x(src, x, y, w, h, z):
    1002     dest = Image((w * z, h * z))
    1003     for j in range(h):
    1004         for i in range(w):
    1005             (r, g, b) = src.getRgb(x + i, y + j)
    1006             for v in range(z):
    1007                 for u in range(z):
    1008                     dest.setRgb(i * z + u, j * z + v, r, g, b)
    1009     return dest
    1010 
    10111001if chapter(5):
    1012     test52x(out512, 20, 70, 32, 32, 1).save("out5-2-1.png")
    1013     test52x(out512, 20, 70, 32, 32, 6).save("out5-2-2.png")
     1002    tmp = out512.getRegion(20, 70, 32, 32)
     1003    tmp.save("out5-2-1.png")
     1004    tmp.getZoom(6).save("out5-2-2.png")
    10141005
    10151006    out523 = test51x(lenna256, ERROR_STUCKI, test42x)
    10161007    out523.save("out5-2-3.png")
    1017     test52x(out523, 20, 70, 32, 32, 1).save("out5-2-4.png")
    1018     test52x(out523, 20, 70, 32, 32, 6).save("out5-2-5.png")
     1008    tmp = out523.getRegion(20, 70, 32, 32)
     1009    tmp.save("out5-2-4.png")
     1010    tmp.getZoom(6).save("out5-2-5.png")
    10191011
    10201012##############################################################################
Note: See TracChangeset for help on using the changeset viewer.