void GnashImage::update(const GnashImage& from) { assert(size() <= from.size()); assert(width() == from.width()); assert(_type == from._type); assert(_location == from._location); std::copy(from.begin(), from.begin() + size(), begin()); }
// Write the given image to the given out stream, in jpeg format. void ImageOutput::writeImageData(FileType type, boost::shared_ptr<IOChannel> out, const GnashImage& image, int quality) { const size_t width = image.width(); const size_t height = image.height(); std::auto_ptr<ImageOutput> outChannel; switch (type) { #ifdef USE_PNG case GNASH_FILETYPE_PNG: outChannel = PngImageOutput::create(out, width, height, quality); break; #endif case GNASH_FILETYPE_JPEG: outChannel = JpegImageOutput::create(out, width, height, quality); break; default: log_error("Requested to write image as unsupported filetype"); break; } switch (image.type()) { case GNASH_IMAGE_RGB: outChannel->writeImageRGB(image.data()); break; case GNASH_IMAGE_RGBA: outChannel->writeImageRGBA(image.data()); break; default: break; } }
// Write the given image to the given out stream, in jpeg format. void Output::writeImageData(FileType type, std::shared_ptr<IOChannel> out, const GnashImage& image, int quality) { const size_t width = image.width(); const size_t height = image.height(); quality = clamp<int>(quality, 0, 100); std::unique_ptr<Output> outChannel; switch (type) { #ifdef USE_PNG case GNASH_FILETYPE_PNG: outChannel = createPngOutput(out, width, height, quality); break; #endif case GNASH_FILETYPE_JPEG: outChannel = JpegOutput::create(out, width, height, quality); break; default: log_error(_("Requested to write image as unsupported filetype")); break; } switch (image.type()) { case TYPE_RGB: outChannel->writeImageRGB(image.begin()); break; case TYPE_RGBA: outChannel->writeImageRGBA(image.begin()); break; default: break; } }