Esempio n. 1
0
// Scale a bitmap.  In UK MHEG this is only used for MPEG I-frames, not PNG.
void MHBitmap::ScaleBitmap(int xScale, int yScale, MHEngine *engine)
{
    QRegion updateArea = GetVisibleArea(); // If there's any content already we have to redraw it.
    m_pContent->ScaleImage(xScale, yScale);
    updateArea += GetVisibleArea(); // Redraw this bitmap.
    engine->Redraw(updateArea); // Mark for redrawing
}
Esempio n. 2
0
// Decode the content.
void MHBitmap::ContentArrived(const unsigned char *data, int length, MHEngine *engine)
{
    QRegion updateArea = GetVisibleArea(); // If there's any content already we have to redraw it.
    if (! m_pContent) return; // Shouldn't happen.

    int nCHook = m_nContentHook;
    if (nCHook == 0) nCHook = engine->GetDefaultBitmapCHook();

    // TODO: What if we can't convert it?
    if (nCHook == 4) { // PNG.
        m_pContent->CreateFromPNG(data, length);
    }
    // CHook 5 seems to be used by the BBC on Freesat for an MPEG I-frame for the
    // background but enabling it here results in it overlaying the video.
    // Presumably it is not simply the same as CHook 2.
    else if (nCHook == 2 /* ||nCHook == 5 */) { // MPEG I-frame.
        m_pContent->CreateFromMPEG(data, length);
    }

    else MHERROR(QString("Unknown bitmap content hook %1").arg(nCHook));

    updateArea += GetVisibleArea(); // Redraw this bitmap.
    engine->Redraw(updateArea); // Mark for redrawing

    // Now signal that the content is available.
    engine->EventTriggered(this, EventContentAvailable);
}
Esempio n. 3
0
void MHVisible::SetBoxSize(int nWidth, int nHeight, MHEngine *engine)
{
    QRegion drawRegion = GetVisibleArea();
    m_nBoxWidth = nWidth;
    m_nBoxHeight = nHeight;
    drawRegion += GetVisibleArea();
    engine->Redraw(drawRegion);
}
Esempio n. 4
0
// Added action in UK MHEG.
void MHVideo::SetVideoDecodeOffset(int newXOffset, int newYOffset, MHEngine *engine)
{
    QRegion updateArea = GetVisibleArea(); // Redraw the area before the offset
    m_nXDecodeOffset = newXOffset;
    m_nYDecodeOffset = newYOffset;
    updateArea += GetVisibleArea(); // Redraw the resulting area.
    engine->Redraw(updateArea); // Mark for redrawing
}
Esempio n. 5
0
// Added action in UK MHEG.
void MHBitmap::SetBitmapDecodeOffset(int newXOffset, int newYOffset, MHEngine *engine)
{
    QRegion updateArea = GetVisibleArea(); // Redraw the area before the offset
    m_nXDecodeOffset = newXOffset;
    m_nYDecodeOffset = newYOffset;
    updateArea += GetVisibleArea(); // Redraw this bitmap.
    engine->Redraw(updateArea); // Mark for redrawing
}
Esempio n. 6
0
void MHVideo::ScaleVideo(int xScale, int yScale, MHEngine *engine)
{
    if (xScale == m_nDecodeWidth && yScale == m_nDecodeHeight) return;
    QRegion updateArea = GetVisibleArea(); // Redraw the area before the offset
    m_nDecodeWidth = xScale;
    m_nDecodeHeight = yScale;
    updateArea += GetVisibleArea(); // Redraw this bitmap.
    engine->Redraw(updateArea); // Mark for redrawing
}
Esempio n. 7
0
// MHEG actions.
void MHVisible::SetPosition(int nXPosition, int nYPosition, MHEngine *engine)
{
    // When we move a visible we have to redraw both the old area and the new.
    // In some cases, such as moving an opaque rectangle we might be able to reduce
    // this if there is some overlap.
    QRegion drawRegion = GetVisibleArea();
    m_nPosX = nXPosition;
    m_nPosY = nYPosition;
    drawRegion += GetVisibleArea();
    engine->Redraw(drawRegion);
}
Esempio n. 8
0
void MHText::SetBackgroundColour(const MHColour &colour, MHEngine *engine)
{
    m_bgColour.Copy(colour);
    // Setting the background colour doesn't affect the text image but we have to
    // redraw it onto the display.
    engine->Redraw(GetVisibleArea());
}
Esempio n. 9
0
void MHText::CreateContent(const unsigned char *p, int s, MHEngine *engine)
{
    m_Content.Copy(MHOctetString((const char *)p, s));
    engine->Redraw(GetVisibleArea()); // Have to redraw if the content has changed.
    m_fNeedsRedraw = true;
    //  fprintf(fd, "Text content is now "); m_Content.PrintMe(0); fprintf(fd, "\n");
}
Esempio n. 10
0
void MHVisible::Activation(MHEngine *engine)
{
    if (m_fRunning) return;
    MHIngredient::Activation(engine);
    m_fRunning = true;
    engine->Redraw(GetVisibleArea()); // Display the visible.
    engine->EventTriggered(this, EventIsRunning);
}
Esempio n. 11
0
void MHSlider::Increment(MHEngine *engine)
{
    if (slider_value + step_size <= max_value)
    {
        slider_value += step_size;
        engine->Redraw(GetVisibleArea());
        engine->EventTriggered(this, EventSliderValueChanged);
    }
}
Esempio n. 12
0
void MHSlider::Decrement(MHEngine *engine)
{
    if (slider_value - step_size >= min_value)
    {
        slider_value -= step_size;
        engine->Redraw(GetVisibleArea());
        engine->EventTriggered(this, EventSliderValueChanged);
    }
}
Esempio n. 13
0
void MHVisible::Deactivation(MHEngine *engine)
{
    if (! m_fRunning) return;
    // Stop displaying.  We need to save the area before we turn off m_fRunning but
    // only call Redraw once this is no longer visible so that the area beneath will be drawn.
    QRegion region = GetVisibleArea();
    MHIngredient::Deactivation(engine);
    engine->Redraw(region); // Draw underlying object.
}
Esempio n. 14
0
void MHSlider::SetPortion(int newPortion, MHEngine *engine)
{
    portion = newPortion;

    if (m_fRunning)
    {
        engine->Redraw(GetVisibleArea());
    }

    engine->EventTriggered(this, EventSliderValueChanged);
}
Esempio n. 15
0
void MHSlider::SetSliderValue(int newValue, MHEngine *engine)
{
    slider_value = newValue;

    if (m_fRunning)
    {
        engine->Redraw(GetVisibleArea());
    }

    engine->EventTriggered(this, EventSliderValueChanged);
}
Esempio n. 16
0
void MHSlider::Step(int nbSteps, MHEngine *engine)
{
    step_size = nbSteps;

    if (m_fRunning)
    {
        engine->Redraw(GetVisibleArea());
    }

    engine->EventTriggered(this, EventSliderValueChanged);
}
Esempio n. 17
0
// Additional action defined in UK MHEG.
void MHSlider::SetSliderParameters(int newMin, int newMax, int newStep, MHEngine *engine)
{
    min_value = newMin;
    max_value = newMax;
    step_size = newStep;
    slider_value = newMin;

    if (m_fRunning)
    {
        engine->Redraw(GetVisibleArea());
    }

    engine->EventTriggered(this, EventSliderValueChanged);
}
Esempio n. 18
0
// Called when the interaction has been terminated and we need
// to restore the state to non-interacting.
void MHSlider::InteractionCompleted(MHEngine *engine)
{
    MHInteractible::InteractionCompleted(engine);
    // Redraw with the interaction highlighting turned off
    engine->Redraw(GetVisibleArea());
}
Esempio n. 19
0
void MHLineArt::SetLineStyle(int nStyle, MHEngine *engine)
{
    m_LineStyle = nStyle;
    engine->Redraw(GetVisibleArea());
}
Esempio n. 20
0
void MHLineArt::SetLineWidth(int nWidth, MHEngine *engine)
{
    m_nLineWidth = nWidth;
    engine->Redraw(GetVisibleArea());
}
Esempio n. 21
0
void MHLineArt::SetLineColour(const MHColour &colour, MHEngine *engine)
{
    m_LineColour.Copy(colour);
    engine->Redraw(GetVisibleArea());
}
Esempio n. 22
0
void MHVisible::SetPaletteRef(const MHObjectRef newPalette, MHEngine *engine)
{
    m_PaletteRef.Copy(newPalette);
    engine->Redraw(GetVisibleArea());
}
Esempio n. 23
0
void MHText::SetTextColour(const MHColour &colour, MHEngine *engine)
{
    m_textColour.Copy(colour);
    m_fNeedsRedraw = true;
    engine->Redraw(GetVisibleArea());
}
Esempio n. 24
0
void MHText::SetFontAttributes(const MHOctetString &fontAttrs, MHEngine *engine)
{
    m_fontAttrs.Copy(fontAttrs);
    m_fNeedsRedraw = true;
    engine->Redraw(GetVisibleArea());
}
Esempio n. 25
0
// Return the area actually obscured by the bitmap.
QRegion MHBitmap::GetOpaqueArea()
{
    // The area is empty unless the bitmap is opaque.
    if (! m_fRunning || m_pContent == NULL || ! m_pContent->IsOpaque()) return QRegion();
    else return GetVisibleArea();
}