// ReadMemoryImage reads an image file from the memory buffer specified by the // parameter data and returns the image information or an error. // // Note: ReadMemoryImage supports the Truevision Targa version 1 file format // (.TGA). Supported pixel formats are: 8-bit gray scale, 8-bit paletted // (24/32-bit color), 24-bit true color and 32-bit true color + alpha. func ReadMemoryImage(data []byte, flags int) (i *Image, err error) { if len(data) == 0 { return nil, errors.New("No image data was supplied") } i = new(Image) if C.glfwReadMemoryImage(unsafe.Pointer(&data[0]), C.long(len(data)), &i.img, C.int(flags)) != 1 { return nil, errors.New("Failed to read image from memory") } return }
func (this *Image) ReadMemoryImage(data []byte, flags int) (err os.Error) { if C.glfwReadMemoryImage(unsafe.Pointer(&data), C.long(len(data)), this.ptr, C.int(flags)) != 1 { err = os.NewError("Failed to read image from memory") } return }