Error ImageLoaderPNG::load_image(Ref<Image> p_image, FileAccess *f, bool p_force_linear, float p_scale) { Error err = _load_image(f, _read_png_data, p_image); f->close(); return err; }
Error ImageLoaderPNG::load_image(Image *p_image, FileAccess *f) { Error err = _load_image(f, _read_png_data, p_image); f->close(); return err; }
gboolean magick_make_thumbnail(struct data *data, struct image *image, const gchar *uri) { MagickWand *wand; gdouble scale; g_assert(data != NULL); g_assert(image != NULL); g_debug("in magick_make_thumbnail"); wand = NewMagickWand(); g_return_val_if_fail( wand, FALSE ); /* load image from file */ if (!_load_image(data, wand, image)) { DestroyMagickWand(wand); return FALSE; } /* apply modifications, if nomodify is not checked */ if (!image->nomodify) { if (!_apply_modifications(data, wand, image)) { DestroyMagickWand(wand); return FALSE; } } /* calculate width and height for the thumbnail */ image->thumb_w = data->gal->thumb_w; switch( image->rotate ) { case 0: case 180: scale = (gdouble)image->height / (gdouble)image->width; break; case 90: case 270: scale = (gdouble)image->width / (gdouble)image->height; break; /* FIXME: just to get some values.. */ default: scale = (gdouble)image->width / (gdouble)image->height; break; } image->thumb_h = (gint)(image->thumb_w * scale); /* resize the thumbnail */ if (!_resize(data, wand, image, image->thumb_w, image->thumb_h)) { DestroyMagickWand(wand); return FALSE; } /* save the thumbnail to a file */ if (!_save(data, wand, uri)) { DestroyMagickWand(wand); return FALSE; } DestroyMagickWand(wand); return TRUE; }
/* * Generate a webimage for preview or saving to a file. */ static MagickWand *_generate_webimage(struct data *data, struct image *image, gint image_h, struct image_size **img_size) { MagickWand *wand; gdouble scale; g_assert(data != NULL); g_assert(image != NULL); g_debug("in _generate_webimage"); *img_size = g_new0(struct image_size, 1); wand = NewMagickWand(); g_return_val_if_fail( wand, FALSE ); /* load image from file */ if (!_load_image(data, wand, image)) { DestroyMagickWand(wand); return FALSE; } /* apply modifications, if nomodify is not checked */ if (!image->nomodify) { if (!_apply_modifications(data, wand, image)) { DestroyMagickWand(wand); g_free(*img_size); return NULL; } /* calculate width and height for the webimage */ (*img_size)->height = image_h; switch( image->rotate ) { case 90: case 270: scale = (gdouble)image->height / (gdouble)image->width; break; case 0: case 180: scale = (gdouble)image->width / (gdouble)image->height; break; /* FIXME: just to get some values.. */ default: scale = (gdouble)image->width / (gdouble)image->height; break; } (*img_size)->width = (gint)((*img_size)->height * scale); /* resize the webimage */ if (!_resize(data, wand, image, (*img_size)->width, (*img_size)->height)) { DestroyMagickWand(wand); g_free((*img_size)); return NULL; } } else { /* no modify, just return original size */ (*img_size)->height = image->height; (*img_size)->width = image->width; } return wand; }
void bb_litehtml_document_container::load_image( const litehtml::tchar_t *src,const litehtml::tchar_t *baseurl,bool redraw_on_ready ){ _load_image( src,"",redraw_on_ready );//baseurl,redraw_on_ready ); }