void bmImage::render(wxDC& dc) {
	bitmap = wxBitmap(aswxImage);

	dc.Clear();

	// few variables to make life easier
	cv::Vec2f pScale = cv::Vec2f(((bmImageFrame*)this->GetParent())->scale);
	cv::Vec2f pVOffScale = cv::Vec2f(((bmImageFrame*)this->GetParent())->voff);
	cv::Vec2f pScroll = cv::Vec2f(((bmImageFrame*)this->GetParent())->scroll);

	wxPoint orgp = dc.GetLogicalOrigin();
	wxPoint trp(pScroll[0], pScroll[1]);
	if (asCvMat.cols * pScale[0] < this->GetSize().GetWidth()) {
		trp.x = -(this->GetSize().GetWidth() - asCvMat.cols * pScale[0]) / 2 / pScale[0];
	}
	if (asCvMat.rows * pScale[1] < this->GetSize().GetHeight()) {
		trp.y = -(this->GetSize().GetHeight() - asCvMat.rows * pScale[1]) / 2 / pScale[1];
	}/*
	trp += wxPoint(
		-(this->GetSize().GetWidth() - asCvMat.cols * pVOffScale[0]) / 2 / pVOffScale[0],
		-(this->GetSize().GetHeight() - asCvMat.rows * pVOffScale[1]) / 2 / pVOffScale[1]
		);*/
	trp += wxPoint(
		-asCvMat.cols * (pVOffScale[0] - 1.0f) / 2,
		-asCvMat.rows * (pVOffScale[1] - 1.0f) / 2
		);
	dc.SetLogicalOrigin(trp.x, trp.y);
	dc.SetUserScale(pScale[0], pScale[1]);
	dc.DrawBitmap(bitmap, wxPoint(0, 0), false);
	dc.SetLogicalOrigin(orgp.x, orgp.y);
}
Example #2
0
bool wxWindow::DoDrawBackground(wxDC& dc)
{
    wxRect rect;

    wxSize size = GetSize();  // Why not GetClientSize() ?
    rect.x = 0;
    rect.y = 0;
    rect.width = size.x;
    rect.height = size.y;

    wxWindow * const parent = GetParent();
    if ( HasTransparentBackground() && !UseBgCol() && parent )
    {
        // DirectFB paints the parent first, then its child windows, so by
        // the time this code is called, parent's background was already
        // drawn and there's no point in (imperfectly!) duplicating the work
        // here:
#ifndef __WXDFB__
        wxASSERT( !IsTopLevel() );

        wxPoint pos = GetPosition();

        AdjustForParentClientOrigin( pos.x, pos.y, 0 );

        // Adjust DC logical origin
        wxCoord org_x, org_y, x, y;
        dc.GetLogicalOrigin( &org_x, &org_y );
        x = org_x + pos.x;
        y = org_y + pos.y;
        dc.SetLogicalOrigin( x, y );

        // Adjust draw rect
        rect.x = pos.x;
        rect.y = pos.y;

        // Let parent draw the background
        parent->EraseBackground( dc, rect );

        // Restore DC logical origin
        dc.SetLogicalOrigin( org_x, org_y );
#endif // !__WXDFB__
    }
    else
    {
        // Draw background ourselves
        EraseBackground( dc, rect );
    }

    return true;
}
Example #3
0
void MainFrame::PrepareDC(wxDC& dc)
{
	dc.SetLogicalOrigin( 0, 0 );
	dc.SetAxisOrientation( 1, 0);
	dc.SetUserScale( 1.0, 1.0 );
	dc.SetMapMode( wxMM_TEXT );
}
Example #4
0
bool wxWindow::DoDrawBackground(wxDC& dc)
{
    wxRect rect;

    wxSize size = GetSize();  // Why not GetClientSize() ?
    rect.x = 0;
    rect.y = 0;
    rect.width = size.x;
    rect.height = size.y;

    wxWindow * const parent = GetParent();
    if ( HasTransparentBackground() && parent )
    {
        wxASSERT( !IsTopLevel() );

        wxPoint pos = GetPosition();

        AdjustForParentClientOrigin( pos.x, pos.y, 0 );

        // Adjust DC logical origin
        wxCoord org_x, org_y, x, y;
        dc.GetLogicalOrigin( &org_x, &org_y );
        x = org_x + pos.x;
        y = org_y + pos.y;
        dc.SetLogicalOrigin( x, y );

        // Adjust draw rect
        rect.x = pos.x;
        rect.y = pos.y;

        // Let parent draw the background
        parent->EraseBackground( dc, rect );

        // Restore DC logical origin
        dc.SetLogicalOrigin( org_x, org_y );
    }
    else
    {
        // Draw background ourselves
        EraseBackground( dc, rect );
    }

    return true;
}
Example #5
0
void ClippingBoxTestCaseBase::InitialStateWithTransformedDC()
{
    // Initial clipping box with transformed DC.
    m_dc->SetDeviceOrigin(10, 15);
    m_dc->SetUserScale(0.5, 1.5);
    m_dc->SetLogicalScale(4.0, 2.0);
    m_dc->SetLogicalOrigin(-15, -20);
    m_dc->SetBackground(wxBrush(s_fgColour, wxBRUSHSTYLE_SOLID));
    m_dc->Clear();
    CheckBox(-20, -25, 50, 40);
}
Example #6
0
void ClippingBoxTestCaseBase::OneRegionWithTransformedDC()
{
    // Setting one clipping box inside DC area
    // with applied some transformations.
    m_dc->SetDeviceOrigin(10, 15);
    m_dc->SetUserScale(0.5, 1.5);
    m_dc->SetLogicalScale(4.0, 2.0);
    m_dc->SetLogicalOrigin(-15, -20);
    m_dc->SetClippingRegion(-10, -20, 80, 75);
    m_dc->SetBackground(wxBrush(s_fgColour, wxBRUSHSTYLE_SOLID));
    m_dc->Clear();
    CheckBox(-10, -20, 40, 35);
}
void EDA_DRAW_PANEL::DoPrepareDC( wxDC& dc )
{
    wxScrolledWindow::DoPrepareDC( dc );

    if( GetScreen() != NULL )
    {
        double scale = GetScreen()->GetScalingFactor();
        dc.SetUserScale( scale, scale );

        wxPoint pt = GetScreen()->m_DrawOrg;
        dc.SetLogicalOrigin( pt.x, pt.y );
    }

    SetClipBox( dc );                         // Reset the clip box to the entire screen.
    GRResetPenAndBrush( &dc );
    dc.SetBackgroundMode( wxTRANSPARENT );
}
Example #8
0
void MyFrame::PrepareDC(wxDC& dc) {
    dc.SetLogicalOrigin(m_xLogicalOrigin, m_yLogicalOrigin);
    dc.SetAxisOrientation(!m_xAxisReversed, m_yAxisReversed);
    dc.SetUserScale(m_xUserScale, m_yUserScale);
    dc.SetMapMode(m_mapMode);
}