Beispiel #1
0
Image *Image_newWithPath_(char *path)
{
	Image *self = Image_new();
	Image_path_(self, path);
	Image_load(self);
	return self;
}
Beispiel #2
0
IoObject *IoImage_setPath(IoImage *self, IoObject *locals, IoMessage *m)
{
	/*doc Image setPath(aString)
	Sets the image path. Returns self.
	*/

	IoSymbol *s = IoMessage_locals_symbolArgAt_(m, locals, 0);
	Image_path_(DATA(self)->image, CSTRING(s));
	return self;
}
Beispiel #3
0
Image *Image_new(void)
{
	Image *self = (Image *)io_calloc(1, sizeof(Image));
	Image_path_(self, "");
	Image_fileType_(self, "");
	self->byteArray = UArray_new();
	self->ownsUArray = 1;
	self->componentCount = 4;
	self->encodingQuality = 1.0;
	return self;
}
Beispiel #4
0
IoObject *IoImage_save(IoImage *self, IoObject *locals, IoMessage *m)
{
	/*doc Image save(optionalPathString)
	Sets the path to optionalPathString if provided and saves the image 
	in the format specified by the path extension. Returns self on success, nil on failure.
	*/

	if (IoMessage_argCount(m) > 0)
	{
		IoSymbol *path = IoMessage_locals_symbolArgAt_(m, locals, 0);
		Image_path_(DATA(self)->image, CSTRING(path));
	}

	Image_save(DATA(self)->image);
	IoImage_checkError(self, locals, m);
	return self;
}
Beispiel #5
0
Image *Image_copyWithUArray_(Image *self, UArray *ba)
{
	Image *image = Image_new();

	Image_setExternalUArray_(image, ba);
	Image_path_(image, self->path);
	Image_error_(image, self->error);

	image->width = self->width;
	image->height = self->height;
	image->componentCount = self->componentCount;

	image->encodingQuality = self->encodingQuality;
	image->decodingWidthHint = self->decodingWidthHint;
	image->decodingHeightHint = self->decodingHeightHint;

	return image;
}
Beispiel #6
0
IoObject *IoImage_open(IoImage *self, IoObject *locals, IoMessage *m)
{
	/*doc Image open(optionalPathString)
	Sets the path to optionalPathString if provided and opens the image file. 
	Returns self on success, Nil on failure.
	*/

	/*printf("opening Image %p %s\n", self, Image_path(DATA(self)->image));*/

	if (IoMessage_argCount(m) > 0)
	{
		IoSymbol *path = IoMessage_locals_symbolArgAt_(m, locals, 0);
		Image_path_(DATA(self)->image, CSTRING(path));
	}

	Image_load(DATA(self)->image);
	IoImage_checkError(self, locals, m);
	return self;
}