Пример #1
0
void KisScratchPad::setupScratchPad(KisCanvasResourceProvider* resourceProvider,
                                    const QColor &defaultColor)
{
    m_resourceProvider = resourceProvider;
    KisConfig cfg;
    setDisplayProfile(cfg.displayProfile(QApplication::desktop()->screenNumber(this)));
    connect(m_resourceProvider, SIGNAL(sigDisplayProfileChanged(const KoColorProfile*)),
            SLOT(setDisplayProfile(const KoColorProfile*)));

    connect(m_resourceProvider, SIGNAL(sigOnScreenResolutionChanged(qreal,qreal)),
            SLOT(setOnScreenResolution(qreal,qreal)));

    m_defaultColor = KoColor(defaultColor, KoColorSpaceRegistry::instance()->rgb8());

    KisPaintDeviceSP paintDevice =
        new KisPaintDevice(m_defaultColor.colorSpace(), "scratchpad");

    m_paintLayer = new KisPaintLayer(0, "ScratchPad", OPACITY_OPAQUE_U8, paintDevice);
    m_paintLayer->setGraphListener(m_nodeListener);
    paintDevice->setDefaultBounds(new KisScratchPadDefaultBounds(this));

    fillDefault();
}
void KisCanvasResourceProvider::resetDisplayProfile(int screen)
{
    KisConfig cfg;
    m_displayProfile = cfg.displayProfile(screen);
    emit sigDisplayProfileChanged(m_displayProfile);
}