Ticket #490: mythgallery_zoomblend.diff

File mythgallery_zoomblend.diff, 3.1 KB (added by mdobossy@…, 19 years ago)

mythgallery zoom blend plugin patch.

  • mythgallery/glsingleview.cpp

     
    614614{
    615615    m_effectMap.insert("none", &GLSingleView::effectNone);
    616616    m_effectMap.insert("blend (gl)", &GLSingleView::effectBlend);
     617    m_effectMap.insert("zoom blend (gl)", &GLSingleView::effectZoomBlend);
    617618    m_effectMap.insert("fade (gl)", &GLSingleView::effectFade);
    618619    m_effectMap.insert("rotate (gl)", &GLSingleView::effectRotate);
    619620    m_effectMap.insert("bend (gl)", &GLSingleView::effectBend);
     
    718719    m_i++;
    719720}
    720721
     722void GLSingleView::effectZoomBlend()
     723{
     724    if (m_i > 100) {
     725        paintTexture();
     726        m_effectRunning = false;
     727        m_tmout = -1;
     728        return;
     729    }
     730
     731    int a = (m_curr == 0) ? 1 : 0;
     732    int b =  m_curr;
     733    float zf = 0.75;
     734
     735    TexItem& ta = m_texItem[a];
     736    TexItem& tb = m_texItem[b];
     737   
     738    glMatrixMode(GL_TEXTURE);
     739    glLoadIdentity();
     740    glRotatef(ta.angle, 0.0, 0.0, 1.0);
     741        float t=1.0/(100.00)*(float)m_i;
     742    glBindTexture(GL_TEXTURE_2D, ta.tex);
     743    glBegin(GL_QUADS);
     744    {
     745        glColor4f(1.0, 1.0, 1.0, 1.0-t);
     746        glTexCoord2f(0, 0);
     747        glVertex3f(-ta.cx*(1.0+zf*t), -ta.cy*(1.0+zf*t), 0);
     748       
     749        glTexCoord2f(1, 0);
     750        glVertex3f(ta.cx*(1.0+zf*t), -ta.cy*(1.0+zf*t), 0);
     751                 
     752        glTexCoord2f(1, 1);
     753        glVertex3f(ta.cx*(1.0+zf*t), ta.cy*(1.0+zf*t), 0);
     754       
     755        glTexCoord2f(0, 1);
     756        glVertex3f(-ta.cx*(1.0+zf*t), ta.cy*(1.0+zf*t), 0);
     757    }
     758    glEnd();
     759   
     760    glMatrixMode(GL_TEXTURE);
     761    glLoadIdentity();
     762    glRotatef(tb.angle, 0.0, 0.0, 1.0);
     763
     764    glBindTexture(GL_TEXTURE_2D, tb.tex);
     765    glBegin(GL_QUADS);
     766    {
     767        glColor4f(1.0, 1.0, 1.0, 1.0/(100.0)*(float)m_i);
     768        glTexCoord2f(0, 0);
     769        glVertex3f(-tb.cx, -tb.cy, 0);
     770       
     771        glTexCoord2f(1, 0);
     772        glVertex3f(tb.cx, -tb.cy, 0);
     773                 
     774        glTexCoord2f(1, 1);
     775        glVertex3f(tb.cx, tb.cy, 0);
     776       
     777        glTexCoord2f(0, 1);
     778        glVertex3f(-tb.cx, tb.cy, 0);
     779    }
     780    glEnd();
     781
     782    m_i++;
     783}
     784
    721785void GLSingleView::effectRotate()
    722786{
    723787    if (m_i > 100) {
  • mythgallery/glsingleview.h

     
    126126
    127127    void effectNone();
    128128    void effectBlend();
     129    void effectZoomBlend();
    129130    void effectFade();
    130131    void effectRotate();
    131132    void effectBend();
  • mythgallery/gallerysettings.cpp

     
    6868    gc->setLabel(QObject::tr("Type of OpenGL transition"));
    6969    gc->addSelection("none");
    7070    gc->addSelection("blend (gl)");
     71    gc->addSelection("zoom blend (gl)");
    7172    gc->addSelection("fade (gl)");
    7273    gc->addSelection("rotate (gl)");
    7374    gc->addSelection("bend (gl)");