IOIMAGE_API IoImage *IoImage_newWithImage_(void *state, Image* image) { IoImage* self = IoImage_new(state); DATA(self)->image = image; DATA(self)->buffer = IoSeq_newWithData_length_(state, Image_data(image), Image_sizeInBytes(image)); Image_setExternalUArray_(image, IoSeq_rawUArray(DATA(self)->buffer)); return self; }
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; }
IoImage *IoImage_proto(void *state) { IoObject *self = IoObject_new(state); IoObject_tag_(self, IoImage_newTag(state)); IoObject_setDataPointer_(self, io_calloc(1, sizeof(IoImageData))); DATA(self)->buffer = IoSeq_newWithCString_(IOSTATE, ""); DATA(self)->image = Image_new(); Image_setExternalUArray_(DATA(self)->image, IoSeq_rawUArray(DATA(self)->buffer)); IoState_registerProtoWithId_(state, self, protoId); { IoMethodTable methodTable[] = { {"setDataWidthHeightComponentCount", IoImage_setDataWidthHeightComponentCount}, {"setPath", IoImage_setPath}, {"open", IoImage_open}, {"save", IoImage_save}, {"width", IoImage_width}, {"height", IoImage_height}, {"data", IoImage_data}, {"componentCount", IoImage_componentCount}, {"isGrayscale", IoImage_isL8}, {"isL8", IoImage_isL8}, {"isLA8", IoImage_isLA8}, {"isRGB8", IoImage_isRGB8}, {"isRGBA8", IoImage_isRGBA8}, {"error", IoImage_error}, {"resizedTo", IoImage_resizedTo}, {"crop", IoImage_crop}, {"addAlpha", IoImage_addAlpha}, {"removeAlpha", IoImage_removeAlpha}, {"makeRGBA8", IoImage_makeRGBA8}, {"makeL8", IoImage_makeL8}, {"makeGrayscale", IoImage_makeGrayscale}, // extras {"setEncodingQuality", IoImage_setEncodingQuality}, {"encodingQuality", IoImage_encodingQuality}, {"setDecodingWidthHint", IoImage_setDecodingWidthHint}, {"decodingWidthHint", IoImage_decodingWidthHint}, {"setDecodingHeightHint", IoImage_setDecodingHeightHint}, {"decodingHeightHint", IoImage_decodingHeightHint}, {"flipX", IoImage_flipX}, {"flipY", IoImage_flipY}, {"baselineHeight", IoImage_baselineHeight}, {"averageColor", IoImage_averageColor}, {"histogram", IoImage_histogram}, {"equalizeHistogram", IoImage_equalizeHistogram}, {"linearContrast", IoImage_linearContrast}, {"bitPlain", IoImage_bitPlain}, {"componentPlain", IoImage_componentPlain}, {"thresholdByGradient", IoImage_thresholdByGradient}, {"thresholdByHistogram", IoImage_thresholdByHistogram}, {"thresholdByOtsu", IoImage_thresholdByOtsu}, {"filterLinear", IoImage_filterLinear}, {"filterUniformAverage", IoImage_filterUniformAverage}, {"filterGauss", IoImage_filterGauss}, {"filterKirsch", IoImage_filterKirsch}, {"filterSobel", IoImage_filterSobel}, {"filterUnsharpMask", IoImage_filterUnsharpMask}, {"filterMin", IoImage_filterMin}, {"filterMax", IoImage_filterMax}, {"filterMedian", IoImage_filterMedian}, {"filterWeightedMedian", IoImage_filterWeightedMedian}, {"bounds", IoImage_bounds}, {NULL, NULL}, }; IoObject_addMethodTable_(self, methodTable); } return self; }