Advanced color spaces

This commit is contained in:
Jakub Melka
2019-02-16 18:26:16 +01:00
parent 648879eadf
commit 8e766376bc
7 changed files with 982 additions and 29 deletions

View File

@ -273,6 +273,21 @@ PDFInteger PDFDocumentDataLoaderDecorator::readInteger(const PDFObject& object,
return defaultValue;
}
PDFReal PDFDocumentDataLoaderDecorator::readNumber(const PDFObject& object, PDFInteger defaultValue) const
{
const PDFObject& dereferencedObject = m_document->getObject(object);
if (dereferencedObject.isReal())
{
return dereferencedObject.getReal();
} else if (dereferencedObject.isInt())
{
return dereferencedObject.getInteger();
}
return defaultValue;
}
QString PDFDocumentDataLoaderDecorator::readTextString(const PDFObject& object, const QString& defaultValue) const
{
const PDFObject& dereferencedObject = m_document->getObject(object);
@ -322,4 +337,24 @@ QRectF PDFDocumentDataLoaderDecorator::readRectangle(const PDFObject& object, co
return defaultValue;
}
PDFReal PDFDocumentDataLoaderDecorator::readNumberFromDictionary(const PDFDictionary* dictionary, const char* key, PDFReal defaultValue) const
{
if (dictionary->hasKey(key))
{
return readNumber(dictionary->get(key), defaultValue);
}
return defaultValue;
}
PDFInteger PDFDocumentDataLoaderDecorator::readIntegerFromDictionary(const PDFDictionary* dictionary, const char* key, PDFInteger defaultValue) const
{
if (dictionary->hasKey(key))
{
return readInteger(dictionary->get(key), defaultValue);
}
return defaultValue;
}
} // namespace pdf