PageRenderTime 116ms CodeModel.GetById 31ms app.highlight 1ms RepoModel.GetById 49ms 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
 1use freeimage
 2import freeimage/[FreeImage, Bitmap, ImageFormat]
 3import io/File
 4import structs/ArrayList
 5
 6main: func (args : ArrayList<String>) {
 7    println("FreeImage version " + FreeImage version())
 8    println(FreeImage copyrightMessage())
 9
10    bitmap1 := Bitmap new(320, 240, 32)
11    printf("new bitmap: %ix%i bpp: %i\n", bitmap1 height, bitmap1 width, bitmap1 bpp)
12
13    bitmap1c := bitmap1 clone()
14    printf("clone bitmap: %ix%i bpp: %i\n", bitmap1c height, bitmap1c width, bitmap1c bpp)
15
16    if (args size() != 2) {
17        println("Please provide the path to a bitmap file to test loading bitmaps from files.")
18    }
19    else {
20        bitmap2 := Bitmap new(args[1])
21        printf("bitmap from file: %ix%i bpp: %i\n", bitmap2 height, bitmap2 width, bitmap2 bpp)
22
23        thumb := bitmap2 thumbnail(256)
24        thumb save("test.jpg", ImageFormat jpeg)
25    }
26}