mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Bugfixing: soft mask
This commit is contained in:
@ -519,7 +519,8 @@ PDFColorComponent PDFBlendFunction::getLuminosity(PDFRGB rgb)
|
|||||||
|
|
||||||
PDFColorComponent PDFBlendFunction::getLuminosity(PDFCMYK cmyk)
|
PDFColorComponent PDFBlendFunction::getLuminosity(PDFCMYK cmyk)
|
||||||
{
|
{
|
||||||
return nonseparable_Lum(nonseparable_cmyk2rgb(cmyk));
|
// This is according to chapter 11.5.3, deriving soft mask from a group luminosity
|
||||||
|
return 1.0f - qMin(1.0f, 0.30f * cmyk[0] + 0.59f * cmyk[1] + 0.11f * cmyk[2] + cmyk[3]);
|
||||||
}
|
}
|
||||||
|
|
||||||
PDFRGB PDFBlendFunction::nonseparable_gray2rgb(PDFGray gray)
|
PDFRGB PDFBlendFunction::nonseparable_gray2rgb(PDFGray gray)
|
||||||
|
@ -168,6 +168,28 @@ void PDFFloatBitmap::setColorActivity(uint32_t mask)
|
|||||||
std::fill(m_activeColorMask.begin(), m_activeColorMask.end(), mask);
|
std::fill(m_activeColorMask.begin(), m_activeColorMask.end(), mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QImage PDFFloatBitmap::getChannelImage(uint8_t channelIndex) const
|
||||||
|
{
|
||||||
|
if (channelIndex >= getPixelSize())
|
||||||
|
{
|
||||||
|
return QImage();
|
||||||
|
}
|
||||||
|
|
||||||
|
QImage image(int(getWidth()), int(getHeight()), QImage::Format_Grayscale8);
|
||||||
|
|
||||||
|
for (int y = 0; y < image.height(); ++y)
|
||||||
|
{
|
||||||
|
uchar* line = image.scanLine(y);
|
||||||
|
for (int x = 0; x < image.width(); ++x)
|
||||||
|
{
|
||||||
|
PDFConstColorBuffer buffer = getPixel(x, y);
|
||||||
|
line[x] = qRound(buffer[channelIndex] * 255);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
||||||
PDFFloatBitmap PDFFloatBitmap::extractProcessColors() const
|
PDFFloatBitmap PDFFloatBitmap::extractProcessColors() const
|
||||||
{
|
{
|
||||||
PDFPixelFormat format = PDFPixelFormat::createFormat(m_format.getProcessColorChannelCount(), 0, false, m_format.hasProcessColorsSubtractive(), false);
|
PDFPixelFormat format = PDFPixelFormat::createFormat(m_format.getProcessColorChannelCount(), 0, false, m_format.hasProcessColorsSubtractive(), false);
|
||||||
|
@ -220,6 +220,11 @@ public:
|
|||||||
/// \param mask Color activity
|
/// \param mask Color activity
|
||||||
void setColorActivity(uint32_t mask);
|
void setColorActivity(uint32_t mask);
|
||||||
|
|
||||||
|
/// Returns gray image created from color channel. If color channel
|
||||||
|
/// is invalid, then empty image is returned.
|
||||||
|
/// \param channelIndex Channel index
|
||||||
|
QImage getChannelImage(uint8_t channelIndex) const;
|
||||||
|
|
||||||
/// Extract process colors into another bitmap
|
/// Extract process colors into another bitmap
|
||||||
PDFFloatBitmap extractProcessColors() const;
|
PDFFloatBitmap extractProcessColors() const;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user