/[pcsx2_0.9.7]/branch/r3113_0.9.7_beta/3rdparty/wxWidgets/src/generic/mask.cpp
ViewVC logotype

Contents of /branch/r3113_0.9.7_beta/3rdparty/wxWidgets/src/generic/mask.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 32 - (show annotations) (download)
Tue Sep 7 03:29:01 2010 UTC (9 years, 11 months ago) by william
File size: 2173 byte(s)
branching from upstream revision (http://pcsx2.googlecode.com/svn/trunk
): r3113 to
https://svn.netsolutions.dnsalias.com/websvn/ps2/pcsx2/pcsx2_0.9.7/branch/r3113_0.9.7_beta
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/generic/mask.cpp
3 // Purpose: generic wxMask implementation
4 // Author: Vadim Zeitlin
5 // Created: 2006-09-28
6 // RCS-ID: $Id: mask.cpp 41495 2006-09-28 23:02:39Z VZ $
7 // Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10
11 // ============================================================================
12 // declarations
13 // ============================================================================
14
15 // ----------------------------------------------------------------------------
16 // headers
17 // ----------------------------------------------------------------------------
18
19 // for compilers that support precompilation, includes "wx.h".
20 #include "wx/wxprec.h"
21
22 #ifdef __BORLANDC__
23 #pragma hdrstop
24 #endif
25
26 #ifndef WX_PRECOMP
27 #include "wx/bitmap.h"
28 #include "wx/image.h"
29 #endif // WX_PRECOMP
30
31 #if wxUSE_GENERIC_MASK
32
33 // ============================================================================
34 // wxMask implementation
35 // ============================================================================
36
37 IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject)
38
39 void wxMask::FreeData()
40 {
41 m_bitmap = wxNullBitmap;
42 }
43
44 bool wxMask::InitFromColour(const wxBitmap& bitmap, const wxColour& colour)
45 {
46 #if wxUSE_IMAGE
47 const wxColour clr(bitmap.QuantizeColour(colour));
48
49 wxImage imgSrc(bitmap.ConvertToImage());
50 imgSrc.SetMask(false);
51 wxImage image(imgSrc.ConvertToMono(clr.Red(), clr.Green(), clr.Blue()));
52 if ( !image.Ok() )
53 return false;
54
55 m_bitmap = wxBitmap(image, 1);
56
57 return m_bitmap.Ok();
58 #else // !wxUSE_IMAGE
59 wxUnusedVar(bitmap);
60 wxUnusedVar(colour);
61
62 return false;
63 #endif // wxUSE_IMAGE/!wxUSE_IMAGE
64 }
65
66 bool wxMask::InitFromMonoBitmap(const wxBitmap& bitmap)
67 {
68 wxCHECK_MSG( bitmap.Ok(), false, wxT("Invalid bitmap") );
69 wxCHECK_MSG( bitmap.GetDepth() == 1, false, wxT("Cannot create mask from colour bitmap") );
70
71 m_bitmap = bitmap;
72
73 return true;
74 }
75
76 #endif // wxUSE_GENERIC_MASK

  ViewVC Help
Powered by ViewVC 1.1.22