|
Krita Source Code Documentation
|
#include <kis_png_converter.h>
Inheritance diagram for KisPNGConverter:Public Slots | |
| virtual void | cancel () |
Public Member Functions | |
| KisImportExportErrorCode | buildFile (const QString &filename, const QRect &imageRect, const qreal xRes, const qreal yRes, KisPaintDeviceSP device, vKisAnnotationSP_it annotationsStart, vKisAnnotationSP_it annotationsEnd, KisPNGOptions options, KisMetaData::Store *metaData) |
| KisImportExportErrorCode | buildFile (QIODevice *, const QRect &imageRect, const qreal xRes, const qreal yRes, KisPaintDeviceSP device, vKisAnnotationSP_it annotationsStart, vKisAnnotationSP_it annotationsEnd, KisPNGOptions options, KisMetaData::Store *metaData) |
| KisImportExportErrorCode | buildImage (const QString &filename) |
| KisImportExportErrorCode | buildImage (QIODevice *iod) |
| KisImageSP | image () |
| KisPNGConverter (KisDocument *doc, bool batchMode=false) | |
| ~KisPNGConverter () override | |
Static Public Member Functions | |
| static bool | isColorSpaceSupported (const KoColorSpace *cs) |
| static bool | saveDeviceToStore (const QString &filename, const QRect &imageRect, const qreal xRes, const qreal yRes, KisPaintDeviceSP dev, KoStore *store, KisMetaData::Store *metaData=0) |
| saveDeviceToStore saves the given paint device to the KoStore. If the device is not 8 bits sRGB, it will be converted to 8 bits sRGB. | |
Private Member Functions | |
| void | progress (png_structp png_ptr, png_uint_32 row_number, int pass) |
Private Attributes | |
| bool | m_batchMode |
| KisDocument * | m_doc |
| KisImageSP | m_image |
| png_uint_32 | m_max_row |
| QString | m_path |
| bool | m_stop |
This class allows to import/export a PNG from either a file or a QIODevice.
Definition at line 70 of file kis_png_converter.h.
| KisPNGConverter::KisPNGConverter | ( | KisDocument * | doc, |
| bool | batchMode = false ) |
Initialize the converter.
| doc | the KisDocument related to the image, can be null if you don't have a KisDocument |
| batchMode | whether to use the batch mode |
Definition at line 271 of file kis_png_converter.cpp.
References m_batchMode, m_doc, m_image, m_max_row, and m_stop.
|
override |
Definition at line 283 of file kis_png_converter.cpp.
| KisImportExportErrorCode KisPNGConverter::buildFile | ( | const QString & | filename, |
| const QRect & | imageRect, | ||
| const qreal | xRes, | ||
| const qreal | yRes, | ||
| KisPaintDeviceSP | device, | ||
| vKisAnnotationSP_it | annotationsStart, | ||
| vKisAnnotationSP_it | annotationsEnd, | ||
| KisPNGOptions | options, | ||
| KisMetaData::Store * | metaData ) |
Save a layer to a PNG
| filename | the name of the destination file |
| imageRect | the image rectangle to save |
| xRes | resolution along x axis |
| yRes | resolution along y axis |
| device | the paint device to save |
| annotationsStart | an iterator on the first annotation |
| annotationsEnd | an iterator on the last annotation |
| options | PNG formatting options |
| metaData | image metadata |
Definition at line 902 of file kis_png_converter.cpp.
References buildFile(), and dbgFile.
| KisImportExportErrorCode KisPNGConverter::buildFile | ( | QIODevice * | iodevice, |
| const QRect & | imageRect, | ||
| const qreal | xRes, | ||
| const qreal | yRes, | ||
| KisPaintDeviceSP | device, | ||
| vKisAnnotationSP_it | annotationsStart, | ||
| vKisAnnotationSP_it | annotationsEnd, | ||
| KisPNGOptions | options, | ||
| KisMetaData::Store * | metaData ) |
TODO: Firefox still opens the image incorrectly if there is gAMA+cHRM tags present. According to the standard it should use iCCP tag with higher priority, but it doesn't:
"When the iCCP chunk is present, PNG decoders that recognize it and are capable of color management [ICC] shall ignore the gAMA and cHRM chunks and use the iCCP chunk instead and interpret it according to [ICC-1] and [ICC-1A]"
Definition at line 917 of file kis_png_converter.cpp.
References _flush_fn(), _write_fn(), KoDocumentInfo::aboutInfo(), KisPNGOptions::alpha, KoDocumentInfo::authorContactInfo(), KoDocumentInfo::authorInfo(), KisPainter::bitBlt(), KisPaintDevice::channelCount(), CM_TO_POINT(), KoColorSpace::colorDepthId(), KoColorSpace::colorModelId(), KisPaintDevice::colorSpace(), KoColorSpaceRegistry::colorSpace(), KisPNGOptions::compression, KisPaintDevice::convertTo(), KisPaintDevice::createHLineConstIteratorNG(), dbgFile, KisDocument::documentInfo(), KisPNGOptions::downsample, KisMetaData::Store::empty(), KisPainter::end(), KisPNGOptions::exif, ImportExportCodes::Failure, Float16BitsColorDepthID, Float32BitsColorDepthID, Float64BitsColorDepthID, KisPNGOptions::forceSRGB, ImportExportCodes::FormatColorSpaceUnsupported, GrayAColorModelID, KoID::id(), KoColorSpace::id, KisMetadataBackendRegistry::instance(), KoColorSpaceRegistry::instance(), Integer16BitsColorDepthID, Integer8BitsColorDepthID, KisPNGOptions::interlace, ImportExportCodes::InternalError, KisPNGOptions::iptc, KisMetaData::IOBackend::JpegHeader, kis_png_warning(), KIS_SAFE_ASSERT_RECOVER, KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE, m_doc, KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::nextPixel(), KisBaseConstIteratorNG::nextPixel(), KisMetaData::IOBackend::NoHeader, ImportExportCodes::OK, KisSequentialIteratorBase< IteratorPolicy, SourcePolicy, ProgressPolicy >::oldRawData(), KisBaseConstAccessor::oldRawData(), KoColorSpaceRegistry::p2020PQProfile(), KoColorSpaceRegistry::p709SRGBProfile(), palette, KisPaintDevice::pixelSize(), KoColorSpace::profile(), KoColorProfile::rawData(), RGBAColorModelID, KisPNGOptions::saveAsHDR, KisPNGOptions::saveSRGBProfile, KisMetaData::IOBackend::saveTo(), KisPNGWriteStream::setNextValue(), KisPNGOptions::storeAuthor, KisPNGOptions::storeMetaData, KisPNGOptions::transparencyFillColor, KisPNGOptions::tryToSaveAsIndexed, KoGenericRegistry< T >::value(), and KisPNGOptions::xmp.
| KisImportExportErrorCode KisPNGConverter::buildImage | ( | const QString & | filename | ) |
Load an image from an URL. If the image is not on a local drive, the image is first downloaded to a temporary location.
| filename | the file name of the image |
Definition at line 832 of file kis_png_converter.cpp.
References buildImage(), dbgFile, ImportExportCodes::FileFormatIncorrect, ImportExportCodes::FileNotExist, and m_path.
| KisImportExportErrorCode KisPNGConverter::buildImage | ( | QIODevice * | iod | ) |
Load an image from a QIODevice.
| iod | device to access the data |
Definition at line 413 of file kis_png_converter.cpp.
References _read_fn(), KisImage::addAnnotation(), KisNodeFacade::addNode(), KoColorSpaceRegistry::colorSpace(), KoColorSpaceRegistry::colorSpaceId(), KoColorSpace::createColorConverter(), KoColorSpaceRegistry::createColorProfile(), KisDocument::createUndoStore(), KisSharedPtr< T >::data(), dbgFile, KisDocument::documentInfo(), ImportExportCodes::Failure, ImportExportCodes::FileFormatIncorrect, ImportExportCodes::FormatColorSpaceUnsupported, ImportExportCodes::FormatFeaturesUnsupported, getColorSpaceForColorType(), GrayAColorModelID, KoID::id(), KoColorSpaceRegistry::instance(), Integer16BitsColorDepthID, KoColorConversionTransformation::internalConversionFlags(), KoColorConversionTransformation::internalRenderingIntent(), KoColorProfile::isSuitableForOutput(), kis_png_warning(), m_batchMode, m_doc, m_image, m_path, KisLayer::metaData(), KoColorProfile::name, KisPNGReadStream::nextValue(), ImportExportCodes::OK, KoColorSpaceRegistry::p2020PQProfile(), palette, KisClipboard::PASTE_ASK, KisConfig::pasteBehaviour(), POINT_TO_CM(), KisDlgPngImport::profile(), KoColorSpaceRegistry::profileByName(), quint16_MAX, quint8_MAX, RGBAColorModelID, KisImage::rootLayer(), KoDocumentInfo::setAboutInfo(), KoDocumentInfo::setAuthorInfo(), KisImage::setResolution(), KoColorConversionTransformation::transformInPlace(), and warnFile.
|
virtualslot |
Definition at line 1410 of file kis_png_converter.cpp.
References m_stop.
| KisImageSP KisPNGConverter::image | ( | ) |
Retrieve the constructed image
Definition at line 850 of file kis_png_converter.cpp.
References m_image.
|
static |
Definition at line 1421 of file kis_png_converter.cpp.
References KoColorSpace::id.
|
private |
Definition at line 1415 of file kis_png_converter.cpp.
References PNG_MAX_UINT.
|
static |
saveDeviceToStore saves the given paint device to the KoStore. If the device is not 8 bits sRGB, it will be converted to 8 bits sRGB.
Definition at line 855 of file kis_png_converter.cpp.
References KisPNGOptions::alpha, buildFile(), KoStore::close(), KoStoreDevice::close(), KisPaintDevice::colorSpace(), KisPNGOptions::compression, KisPaintDevice::convertTo(), KisSharedPtr< T >::data(), dbgFile, KisPNGOptions::downsample, KoColorSpace::id, KoColorSpaceRegistry::instance(), KisPNGOptions::interlace, KisImportExportErrorCode::isOk(), KoStore::open(), KoStoreDevice::open(), KisPNGOptions::saveSRGBProfile, and KisPNGOptions::tryToSaveAsIndexed.
|
private |
Definition at line 129 of file kis_png_converter.h.
|
private |
Definition at line 127 of file kis_png_converter.h.
|
private |
Definition at line 126 of file kis_png_converter.h.
|
private |
Definition at line 125 of file kis_png_converter.h.
|
private |
Definition at line 130 of file kis_png_converter.h.
|
private |
Definition at line 128 of file kis_png_converter.h.