File: test_pixel.py

package info (click to toggle)
lazpaint 7.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 56,000 kB
  • sloc: pascal: 277,538; python: 2,494; makefile: 233; sh: 221
file content (21 lines) | stat: -rw-r--r-- 553 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from lazpaint import image, layer, dialog, colors, view

view.set_zoom(1)
width = 256
height = 256
image.new(width, height)
red = dialog.input_value("Red value (0..255)", 0)
image = []
for y in range(height):
  scanline = [colors.RGB(red,x,y) for x in range(width)]
  image.append(scanline)

layer.put_image(0, 0, image, layer.DM_SET)
if layer.get_pixel(192,64).green != 192:
  dialog.show_message("The value of the pixel is not correct.")
else:
  dialog.show_message("Test successful.")
  
view.zoom_fit()
view.set_zoom(10)
view.set_grid_visible(True)