Exemple #1
0
void BitmapTestCase::Mask()
{
    wxMask *mask = new wxMask(m_bmp, *wxBLACK);
    m_bmp.SetMask(mask);

    // copying masks should work
    wxMask *mask2 = new wxMask(*mask);
    m_bmp.SetMask(mask2);
}
Exemple #2
0
////////////////////////////////////////////////////////////////////
// Method:	Constructor
// Class:	CWxOpencvAbout
// Purpose:	Initialize my about dialog
// Input:	pointer to reference window
// Output:	nothing	
////////////////////////////////////////////////////////////////////
CWxOpencvAbout::CWxOpencvAbout(wxWindow *parent)
               : wxDialog(parent, -1,
                          _("About wxOpenCv Demo"),
                          wxDefaultPosition,
                          wxDefaultSize,
                          wxDEFAULT_DIALOG_STYLE | wxCLOSE)
{
    // logo
    const wxBitmap bmp(wxImage("wxopencvabout.bmp"));

#if !defined(__WXGTK__) && !defined(__WXMOTIF__) && !defined(__WXMAC__)
    bmp.SetMask(new wxMask(bmp, *wxBLUE));
#endif
    wxStaticBitmap *sbmp = new wxStaticBitmap(this, -1, bmp);

    // layout components
	wxBoxSizer *sizer = new wxBoxSizer( wxVERTICAL );
  sizer->Add( sbmp, 0, wxCENTRE | wxALL, 10 );
	sizer->Add( new wxStaticLine(this, -1), 0, wxGROW | wxLEFT | wxRIGHT, 5 );
	sizer->Add( CreateTextSizer(_("wxOpenCv Demo\n"
									"(demo of opencv with wxwidgets)\n"
									"Created by: Larry Lart\n"
									"Email To: [email protected]\n") ),
									0, wxCENTRE | wxALL, 10 );

	sizer->Add( new wxStaticLine(this, -1), 0, wxGROW | wxLEFT | wxRIGHT, 5 );
	sizer->Add( CreateButtonSizer(wxOK), 0, wxCENTRE | wxALL, 10 );

	// activate
	SetSizer(sizer);
	SetAutoLayout(TRUE);
	sizer->SetSizeHints(this);
	sizer->Fit(this);
	Centre(wxBOTH | wxCENTRE_ON_SCREEN);
}
Exemple #3
0
void BitmapTestCase::OverlappingBlit()
{
    m_bmp.SetMask( NULL );

    // Clear to white.

    wxMemoryDC dc(m_bmp);
    dc.SetBackground( *wxWHITE );
    dc.Clear();

    // Draw red line across the top.

    dc.SetPen(*wxRED_PEN);
    dc.DrawLine(0, 0, 10, 0);

    // Scroll down one line.

    dc.Blit( 0, 1, 10, 9, &dc, 0, 0 );

    // Now, lines 0 and 1 should be red, lines 2++ should still be white.

    wxNativePixelData npd( m_bmp );
    wxNativePixelData::Iterator it( npd );

    ASSERT_EQUAL_RGB( it, 255, 0, 0 );
    it.OffsetY( npd, 1 );
    ASSERT_EQUAL_RGB( it, 255, 0, 0 );
    it.OffsetY( npd, 1 );
    ASSERT_EQUAL_RGB( it, 255, 255, 255 );
    it.OffsetY( npd, 1 );
    ASSERT_EQUAL_RGB( it, 255, 255, 255 );
}