Esempio n. 1
0
void XlinkPreview::updateMulticolor2()
{
    if(!isConnected()) return;

    auto state = State::getInstance();
    xlink_poke(0x37, 0x00, 0xd023, (uchar) state->getColorForPen(State::PEN_MULTICOLOR2));
}
Esempio n. 2
0
void XlinkPreview::updateBackgroundColor()
{
    if(!_xlink->isLoaded()) return;

    auto state = State::getInstance();
    xlink_poke(0x37, 0x00, 0xd020, (uchar) state->getColorForPen(State::PEN_BACKGROUND));
    xlink_poke(0x37, 0x00, 0xd021, (uchar) state->getColorForPen(State::PEN_BACKGROUND));
}
Esempio n. 3
0
void XlinkPreview::updateForegroundColor()
{
    if(!isConnected()) return;

    auto state = State::getInstance();
    uchar foreground = state->getColorForPen(State::PEN_FOREGROUND);
    foreground |= state->isMulticolorMode() ? 8 : 0;

    xlink_fill(0xb7, 0x00, 0xd800, foreground, 1000);
    xlink_poke(0x37, 0x00, 0x0286, foreground);
}
Esempio n. 4
0
void PaletteWidget::mousePressEvent(QMouseEvent * event)
{
    event->accept();

    auto pos = event->localPos();

    int x = pos.x() / PIXEL_SIZE_X;
    int y = pos.y() / PIXEL_SIZE_Y;

    int color = 8 * y + x;

    auto state = State::getInstance();

    int pen = state->getSelectedPen();
    int oldColor = state->getColorForPen(pen);

    if (oldColor != color) {
        state->getUndoStack()->push(new SetColorCommand(state, color, pen));

        emit colorSelected();
        update();
    }
}
Esempio n. 5
0
int State::getCurrentColor() const
{
    return getColorForPen(_selectedPen, -1);
}
Esempio n. 6
0
int State::getColorForPen(int pen) const
{
    return getColorForPen(pen, -1);
}