Mercurial > mercurial > hgweb_rubikcolor.cgi
comparison main.cpp @ 2:9675e40f5b76 default tip
clean up source-code.
author | pyon@macmini |
---|---|
date | Thu, 29 Aug 2013 19:20:13 +0900 |
parents | a14406960539 |
children |
comparison
equal
deleted
inserted
replaced
1:a14406960539 | 2:9675e40f5b76 |
---|---|
1 // Filename : main.cpp | 1 // Filename : main.cpp |
2 // Last Change: 29-Jul-2013. | 2 // Last Change: 29-Aug-2013. |
3 // | 3 // |
4 #include "wx/wxprec.h" | 4 #include "wx/wxprec.h" |
5 #ifndef WX_PRECOMP | 5 #ifndef WX_PRECOMP |
6 #include "wx/wx.h" | 6 #include "wx/wx.h" |
7 #endif | 7 #endif |
8 #include "wx/cmdline.h" | 8 #include "wx/cmdline.h" |
9 #include <wx/string.h> | 9 #include <wx/string.h> |
10 #include <wx/bitmap.h> | 10 #include <wx/bitmap.h> |
11 #include <wx/image.h> | 11 #include <wx/image.h> |
12 | 12 |
13 #define RATE 4 | |
13 | 14 |
14 // private classes | 15 // private classes |
15 // Define a new application type, each program should derive a class from wxApp | 16 // Define a new application type, each program should derive a class from wxApp |
16 class MyApp : public wxApp | 17 class MyApp : public wxApp |
17 { | 18 { |
125 { | 126 { |
126 if ( !wxApp::OnInit() ) return false; | 127 if ( !wxApp::OnInit() ) return false; |
127 | 128 |
128 wxCmdLineParser( g_cmdLineDesc, argc, argv ); | 129 wxCmdLineParser( g_cmdLineDesc, argc, argv ); |
129 | 130 |
130 image.Create( 19, 19, false ); | 131 int len = 19 * RATE; |
131 image.SetRGB( wxRect( 0, 0, 19, 19 ), -1, -1, -1 ); | 132 image.Create( len, len, false ); |
133 image.SetRGB( wxRect( 0, 0, len, len ), -1, -1, -1 ); | |
132 wxImage::AddHandler( new wxPNGHandler ); | 134 wxImage::AddHandler( new wxPNGHandler ); |
133 | 135 |
134 return true; | 136 return true; |
135 } | 137 } |
136 | 138 |
238 void MyApp::SetImageDataK( wxString color ) { SetImageData( 1, 8, 1, 3, color ); } | 240 void MyApp::SetImageDataK( wxString color ) { SetImageData( 1, 8, 1, 3, color ); } |
239 void MyApp::SetImageDataL( wxString color ) { SetImageData( 1, 4, 1, 3, color ); } | 241 void MyApp::SetImageDataL( wxString color ) { SetImageData( 1, 4, 1, 3, color ); } |
240 | 242 |
241 void MyApp::SetImageData( int x, int y, int w, int h, wxString color ) | 243 void MyApp::SetImageData( int x, int y, int w, int h, wxString color ) |
242 { | 244 { |
243 wxRect rect( x, y, w, h ); | 245 wxRect rect( x * RATE, y * RATE, w * RATE, h *RATE ); |
244 if ( color.IsSameAs( wxT("black"), true ) ) image.SetRGB( rect, 0, 0, 0 ); | 246 if ( color.IsSameAs( wxT("black"), true ) ) image.SetRGB( rect, 0, 0, 0 ); |
245 else if ( color.IsSameAs( wxT("white"), true ) ) image.SetRGB( rect, 255, 255, 255 ); | 247 else if ( color.IsSameAs( wxT("white"), true ) ) image.SetRGB( rect, 255, 255, 255 ); |
246 else if ( color.IsSameAs( wxT("yellow"), true ) ) image.SetRGB( rect, 255, 255, 0 ); | 248 else if ( color.IsSameAs( wxT("yellow"), true ) ) image.SetRGB( rect, 255, 255, 0 ); |
247 else if ( color.IsSameAs( wxT("orange"), true ) ) image.SetRGB( rect, 255, 127, 0 ); | 249 else if ( color.IsSameAs( wxT("orange"), true ) ) image.SetRGB( rect, 255, 127, 0 ); |
248 else if ( color.IsSameAs( wxT("red"), true ) ) image.SetRGB( rect, 255, 0, 0 ); | 250 else if ( color.IsSameAs( wxT("red"), true ) ) image.SetRGB( rect, 255, 0, 0 ); |