[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-kimageshop
Subject:    Need some help with colorspaces
From:       Dmitry Kazakov <dimula73 () gmail ! com>
Date:       2009-08-03 20:27:52
Message-ID: ae32c1ef0908031327n302ab9abg9024098d337021dd () mail ! gmail ! com
[Download RAW message or body]

Hi, all!
I have a strange problem with colorspaces, could someone help me?

The problem is:
I'm writing KisImagePyramid class, that is used by
KisPrescaledProjection. This class caches KisImage's projection in a
usual KisPaintDevice, BUT created for monitor's color space.
I create this color space as follows:
m_monitorColorSpace = KoColorSpaceRegistry::instance()->rgb8(m_monitorProfile);

where @monitorProfile is a profile given by KisPrescaledProjection

Then i create a paint device:
KisPaintDeviceSP pd = new KisPaintDevice(m_monitorColorSpace);

and try to copy entire image on it:
    KisPainter gc(pd);
    gc.bitBlt(rc.topLeft(), originalProjection, rc);
    gc.end();

    QImage temp = pd->convertToQImage(m_monitorProfile,
				      0, 0,
				      m_originalImage->width(),
				      m_originalImage->height());
    temp.save("/home/dima/UNSCALED_FULL.png");

where m_originalImage and originalProjection are KisImageSP and it's
projection respectively.

As a result i get an image with artefacts along right side of it:
http://img18.imageshack.us/img18/4338/unscaledfull.png

Original image is here:
http://img514.imageshack.us/img514/1849/simples.png

In the beginning i thought this is some overflow in
KisPainter::bitBlt, BUT when i changed destination paint device
colorspace to source colorspace, everything started to work perfectly!
KisPaintDeviceSP pd = new KisPaintDevice(originalProjection->colorSpace());
I got a copy of original image in "/home/dima/UNSCALED_FULL.png"

I can't understand why?! What do i do wrong?


PS:
the code together:

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 /// This code doesn't work
m_monitorColorSpace = KoColorSpaceRegistry::instance()->rgb8(m_monitorProfile);

KisPaintDeviceSP pd = new KisPaintDevice(m_monitorColorSpace);

KisPainter gc(pd);
gc.bitBlt(rc.topLeft(), originalProjection, rc);
gc.end();

QImage temp = pd->convertToQImage(m_monitorProfile,
  				      0, 0,
				      m_originalImage->width(),
				      m_originalImage->height());
temp.save("/home/dima/UNSCALED_FULL.png");

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 /// This code works
m_monitorColorSpace = KoColorSpaceRegistry::instance()->rgb8(m_monitorProfile);

KisPaintDeviceSP pd = new KisPaintDevice(originalProjection->colorSpace());
// the change is here
----------------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

KisPainter gc(pd);
gc.bitBlt(rc.topLeft(), originalProjection, rc);
gc.end();

QImage temp = pd->convertToQImage(m_monitorProfile,
  				      0, 0,
				      m_originalImage->width(),
				      m_originalImage->height());
temp.save("/home/dima/UNSCALED_FULL.png");


-- 
Dmitry Kazakov
_______________________________________________
kimageshop mailing list
kimageshop@kde.org
https://mail.kde.org/mailman/listinfo/kimageshop


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic