test_image.py 871 B

123456789101112131415161718192021222324252627282930
  1. from lazpaint import image, layer, colors, view, dialog
  2. dialog.show_message(image.get_size())
  3. w = 256
  4. h = 256
  5. image.new(2, 2)
  6. layer.put_image(0, 0, [[colors.RGB(128,128,255), colors.RGB(0,255,255)], [colors.RGB(255,0,255), colors.RGB(255,255,255)]], layer.DM_SET)
  7. image.resample(w, h)
  8. image.repeat(w*4, h*4, anchor=image.ANCHOR_TOP_LEFT)
  9. view.zoom_fit()
  10. pix1 = layer.get_pixel(0,0)
  11. image.horizontal_flip()
  12. assert layer.get_pixel(w-1,0) == pix1
  13. image.vertical_flip()
  14. assert layer.get_pixel(w-1,h-1) == pix1
  15. image.rotate_cw()
  16. assert layer.get_pixel(0,h-1) == pix1
  17. image.rotate_cw()
  18. assert layer.get_pixel(0,0) == pix1
  19. image.linear_negative()
  20. pix1 = pix1.linear_negative()
  21. assert layer.get_pixel(0,0) == pix1
  22. pix1 = pix1.swap_red_blue()
  23. image.swap_red_blue()
  24. assert layer.get_pixel(0,0) == pix1
  25. layer.new()
  26. layer.fill(colors.RGBA(192,192,192,64))
  27. image.flatten()