summaryrefslogtreecommitdiff
path: root/imagelist_darwin.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-08-30 23:02:02 -0400
committerPietro Gagliardi <[email protected]>2014-08-30 23:02:02 -0400
commit77bf566ebbcb62acd4d08d905d9542d6ff9b6b80 (patch)
treeeeb8e72bc3bf57f5be7f0c0af4319189ac6de838 /imagelist_darwin.go
parent155899c65ed32245e2ccad4197a10c77017d835b (diff)
...in with the new.
Diffstat (limited to 'imagelist_darwin.go')
-rw-r--r--imagelist_darwin.go38
1 files changed, 38 insertions, 0 deletions
diff --git a/imagelist_darwin.go b/imagelist_darwin.go
new file mode 100644
index 0000000..53fafa5
--- /dev/null
+++ b/imagelist_darwin.go
@@ -0,0 +1,38 @@
+// 16 august 2014
+
+package ui
+
+import (
+ "image"
+ "unsafe"
+)
+
+// #include "objc_darwin.h"
+import "C"
+
+type imagelist struct {
+ list []C.id
+}
+
+func newImageList() ImageList {
+ return new(imagelist)
+}
+
+func (i *imagelist) Append(img *image.RGBA) {
+ id := C.toImageListImage(
+ unsafe.Pointer(pixelData(img)), C.intptr_t(img.Rect.Dx()), C.intptr_t(img.Rect.Dy()), C.intptr_t(img.Stride))
+ i.list = append(i.list, id)
+}
+
+func (i *imagelist) Len() ImageIndex {
+ return ImageIndex(len(i.list))
+}
+
+type imageListApply interface {
+ apply(*[]C.id)
+}
+
+func (i *imagelist) apply(out *[]C.id) {
+ *out = make([]C.id, len(i.list))
+ copy(*out, i.list)
+}