PageRenderTime 4ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/tests/test.ooc

http://github.com/tsion/ooc-freeimage
Unknown | 26 lines | 21 code | 5 blank | 0 comment | 0 complexity | 980372a97e95419a74523eb9124cfb21 MD5 | raw file
  1. use freeimage
  2. import freeimage/[FreeImage, Bitmap, ImageFormat]
  3. import io/File
  4. import structs/ArrayList
  5. main: func (args : ArrayList<String>) {
  6. println("FreeImage version " + FreeImage version())
  7. println(FreeImage copyrightMessage())
  8. bitmap1 := Bitmap new(320, 240, 32)
  9. printf("new bitmap: %ix%i bpp: %i\n", bitmap1 height, bitmap1 width, bitmap1 bpp)
  10. bitmap1c := bitmap1 clone()
  11. printf("clone bitmap: %ix%i bpp: %i\n", bitmap1c height, bitmap1c width, bitmap1c bpp)
  12. if (args size() != 2) {
  13. println("Please provide the path to a bitmap file to test loading bitmaps from files.")
  14. }
  15. else {
  16. bitmap2 := Bitmap new(args[1])
  17. printf("bitmap from file: %ix%i bpp: %i\n", bitmap2 height, bitmap2 width, bitmap2 bpp)
  18. thumb := bitmap2 thumbnail(256)
  19. thumb save("test.jpg", ImageFormat jpeg)
  20. }
  21. }