bitmap_io.go 615 B

1234567891011121314151617181920212223242526272829
  1. // albitmap
  2. package al
  3. /*
  4. #include <stdlib.h>
  5. #include <allegro5/allegro.h>
  6. #include "helpers.h"
  7. #include "callbacks.h"
  8. */
  9. import "C"
  10. const KEEP_BITMAP_FORMAT = C.ALLEGRO_KEEP_BITMAP_FORMAT
  11. const NO_PREMULTIPLIED_ALPHA = C.ALLEGRO_NO_PREMULTIPLIED_ALPHA
  12. const KEEP_INDEX = C.ALLEGRO_KEEP_INDEX
  13. func LoadBitmap(name string) * Bitmap {
  14. cname := cstr(name)
  15. defer cstrFree(cname)
  16. return wrapBitmap(C.al_load_bitmap(cname))
  17. }
  18. func (bmp * Bitmap) Save(name string) bool {
  19. cname := cstr(name)
  20. defer cstrFree(cname)
  21. return bool(C.al_save_bitmap(cname, bmp.toC()))
  22. }