// Actualiza y aplica al display el factor de zoom segun el tamaño del display 
// pero con limite el tamaño de la imagen
// Devuelve el zoom o ratio aplicado
double ControlImagenes::ActualizaZoom(CButton& m_control_group, CStatic&	m_control)
{
    // Ancho y alto maximo posible
    RECT Rect;
    m_control_group.GetClientRect(&Rect);
    long anchoDisplay = abs(Rect.right);
    long altoDisplay = abs(Rect.bottom);

    // calcula el zoom optimo (maximo) dentro de lo posible
    // el resultado esta en m_factorZoom
    CalculaZoom(anchoDisplay,altoDisplay,
        m_nAnchoImagen,m_nAltoImagen);

    //Ajustar la ventana de display al zoom calculado
    long alto,ancho;
    if (m_factorZoom < 0)
    {
        ancho = (long)floor(m_nAnchoImagen * -1.0/m_factorZoom + 0.5);
        alto = (long)floor(m_nAltoImagen * -1.0/m_factorZoom + 0.5);
    }
    else 
    {
        ancho = (long)floor(m_nAnchoImagen * m_factorZoom + 0.5);
        alto = (long)floor(m_nAltoImagen * m_factorZoom + 0.5);
    }

    m_control.SetWindowPos(NULL,0,0,ancho,alto,SWP_NOMOVE | SWP_NOZORDER);

    MdispZoom(m_Mildisplay, m_factorZoom, m_factorZoom);

    return m_factorZoom;
}
예제 #2
0
// Actualiza y aplica al display el factor de zoom segun el tamaño del display 
// pero con limite el tamaño de la imagen
// Devuelve el zoom o ratio aplicado
double CFormTomaUnica::ActualizaZoom()
{
    // Ancho y alto maximo posible
    RECT Rect;
    m_imagen.GetClientRect(&Rect);
    long anchoDisplay = abs(Rect.right);
    long altoDisplay = abs(Rect.bottom);

    // calcula el zoom optimo (maximo) dentro de lo posible
    // el resultado esta en m_factorZoom
    CalculaZoom(anchoDisplay,altoDisplay);

    //Ajustar la ventana de display al zoom calculado
    long alto,ancho;
    if (theApp.m_configuracion.m_ratio_inicial < 0)
    {
        ancho = (long)floor(theApp.m_ParamIni.Cam.anchoImagen /*theApp.m_configuracion.m_nDimension_toma_x*/ * -1.0/theApp.m_configuracion.m_ratio_inicial + 0.5);
        alto = (long)floor(theApp.m_ParamIni.Cam.altoImagen/*theApp.m_configuracion.m_nDimension_toma_y*/ * -1.0/theApp.m_configuracion.m_ratio_inicial + 0.5);
    }
    else 
    {
        ancho = (long)floor(theApp.m_ParamIni.Cam.anchoImagen/*theApp.m_configuracion.m_nDimension_toma_x*/ * theApp.m_configuracion.m_ratio_inicial + 0.5);
        alto = (long)floor(theApp.m_ParamIni.Cam.altoImagen/*theApp.m_configuracion.m_nDimension_toma_y*/ * theApp.m_configuracion.m_ratio_inicial + 0.5);
    }

    m_imagen.SetWindowPos(NULL,0,0,ancho,alto,SWP_NOMOVE | SWP_NOZORDER);

    MdispZoom(M_display_normal, theApp.m_configuracion.m_ratio_inicial, theApp.m_configuracion.m_ratio_inicial);

    return theApp.m_configuracion.m_ratio_inicial;
}
예제 #3
0
void MdispGtkView::Zoom( MIL_DOUBLE ZoomFactorToApply )
   {
   if( m_MilDisplay
         && ZoomFactorToApply <= 16.0 && ZoomFactorToApply >= 1.0/16.0 )
      {
      if (m_currentZoomFactor != ZoomFactorToApply)
         {
         //Apply zoom  [CALL TO MIL]
         MdispZoom(m_MilDisplay, ZoomFactorToApply, ZoomFactorToApply);
         
         m_currentZoomFactor = ZoomFactorToApply;
         
         //Update scroll bars
         m_cf->UpdateScrollBar();
         g_signal_emit(G_OBJECT(m_cf->Window()), m_cf->zoomFactorChangedSignal(), 0, m_currentZoomFactor);
         }
      }
   }