tramage.py

Created by schraf

Created on April 06, 2023

450 Bytes


from kandinsky import set_pixel

# https://en.wikipedia.org/wiki/Ordered_dithering
# Utilisation d'une matrice 4x4 pour les niveaux de gris

gris = [0,8,2,10,12,4,14,6,3,11,1,9,15,7,13,5]

for l in range(0,222,4):
 for c in range(0,320,4):
   # intensite du gris, blanc vers noir
   n = int(c / 320 * 16)
   # Motif 4x4 pour ce niveau de gris
   for i in range(16):
     if n >= gris[i]: set_pixel(c + (i % 4), l + (i // 4), (0, 0, 0))

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.