]> git.saurik.com Git - wxWidgets.git/commitdiff
Replaced image
authorJulian Smart <julian@anthemion.co.uk>
Thu, 19 May 2005 10:15:53 +0000 (10:15 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Thu, 19 May 2005 10:15:53 +0000 (10:15 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34164 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

Makefile.in
build/bakefiles/make_dist.mk
samples/rotate/Makefile.in
samples/rotate/duck.png [new file with mode: 0644]
samples/rotate/kclub.bmp [deleted file]
samples/rotate/makefile.bcc
samples/rotate/makefile.gcc
samples/rotate/makefile.vc
samples/rotate/makefile.wat
samples/rotate/rotate.bkl
samples/rotate/rotate.cpp

index 13fdb61e95943c125d36629530befe3f5164a686..9d9bc2492b4d8beac20360e035cc6cbd93660630 100644 (file)
@@ -24852,7 +24852,7 @@ SAMPLES_DIST: ALL_GUI_DIST
        cp $(SAMPDIR)/rotate/Makefile.in $(DISTDIR)/samples/rotate
        cp $(SAMPDIR)/rotate/makefile.unx $(DISTDIR)/samples/rotate
        cp $(SAMPDIR)/rotate/*.cpp $(DISTDIR)/samples/rotate
-       cp $(SAMPDIR)/rotate/*.bmp $(DISTDIR)/samples/rotate
+       cp $(SAMPDIR)/rotate/*.png $(DISTDIR)/samples/rotate
 
        mkdir $(DISTDIR)/samples/richedit
        cp $(SAMPDIR)/richedit/Makefile.in $(DISTDIR)/samples/richedit
index 37abcff7ccde95eebeda27c3982da8bb57d9a3a4..8874b1d1013cbe988036dfe500ad65cc7fda0bc6 100644 (file)
@@ -781,7 +781,7 @@ SAMPLES_DIST: ALL_GUI_DIST
        cp $(SAMPDIR)/rotate/Makefile.in $(DISTDIR)/samples/rotate
        cp $(SAMPDIR)/rotate/makefile.unx $(DISTDIR)/samples/rotate
        cp $(SAMPDIR)/rotate/*.cpp $(DISTDIR)/samples/rotate
-       cp $(SAMPDIR)/rotate/*.bmp $(DISTDIR)/samples/rotate
+       cp $(SAMPDIR)/rotate/*.png $(DISTDIR)/samples/rotate
 
        mkdir $(DISTDIR)/samples/richedit
        cp $(SAMPDIR)/richedit/Makefile.in $(DISTDIR)/samples/richedit
index 4c40493b4fe807608633ebcc48c9179d9700a464..7cd2117ac389febc4ee05cb27fe7ee9c37eafe21 100644 (file)
@@ -174,7 +174,7 @@ rotate.app/Contents/PkgInfo: rotate$(EXEEXT) $(top_srcdir)/src/mac/carbon/Info.p
 
 data: 
        @mkdir -p .
-       @for f in kclub.bmp; do \
+       @for f in duck.png; do \
        if test ! -f ./$$f ; \
        then x=yep ; \
        else x=`find $(srcdir)/$$f -newer ./$$f -print` ; \
diff --git a/samples/rotate/duck.png b/samples/rotate/duck.png
new file mode 100644 (file)
index 0000000..1972126
Binary files /dev/null and b/samples/rotate/duck.png differ
diff --git a/samples/rotate/kclub.bmp b/samples/rotate/kclub.bmp
deleted file mode 100644 (file)
index 2a4aa03..0000000
Binary files a/samples/rotate/kclub.bmp and /dev/null differ
index 30f539035ae51fb877569157819756dbd23dcc8d..12c027d56fd7f90503aba4a2ba0cf66e02da84c4 100644 (file)
@@ -212,7 +212,7 @@ $(OBJS)\rotate.exe: $(ROTATE_OBJECTS)  $(OBJS)\rotate_rotate.res
 
 data: 
        if not exist $(OBJS) mkdir $(OBJS)
-       for %f in (kclub.bmp) do if not exist $(OBJS)\%f copy .\%f $(OBJS)
+       for %f in (duck.png) do if not exist $(OBJS)\%f copy .\%f $(OBJS)
 
 $(OBJS)\rotate_rotate.obj: .\rotate.cpp
        $(CXX) -q -c -P -o$@ $(ROTATE_CXXFLAGS) $**
index 33c70f9bbfac8e74686e60da06cd3847b2b525fb..a573d07d4ff43620155bb561c60c212dd7236afe 100644 (file)
@@ -203,7 +203,7 @@ $(OBJS)\rotate.exe: $(ROTATE_OBJECTS) $(OBJS)\rotate_rotate_rc.o
 
 data: 
        if not exist $(OBJS) mkdir $(OBJS)
-       for %%f in (kclub.bmp) do if not exist $(OBJS)\%%f copy .\%%f $(OBJS)
+       for %%f in (duck.png) do if not exist $(OBJS)\%%f copy .\%%f $(OBJS)
 
 $(OBJS)\rotate_rotate.o: ./rotate.cpp
        $(CXX) -c -o $@ $(ROTATE_CXXFLAGS) $<
index 9544ac17d27a33ffa94817b77f587ef6a48a724d..85d38a5130d813e8927b993648bfa3a177b04157 100644 (file)
@@ -263,7 +263,7 @@ $(OBJS)\rotate.exe: $(ROTATE_OBJECTS) $(OBJS)\rotate_rotate.res
 
 data: 
        if not exist $(OBJS) mkdir $(OBJS)
-       for %f in (kclub.bmp) do if not exist $(OBJS)\%f copy .\%f $(OBJS)
+       for %f in (duck.png) do if not exist $(OBJS)\%f copy .\%f $(OBJS)
 
 $(OBJS)\rotate_rotate.obj: .\rotate.cpp
        $(CXX) /c /nologo /TP /Fo$@ $(ROTATE_CXXFLAGS) $**
index 3a083010c4e7a4d76bbf8acc37828e74311c5843..58830dafb04fb7da247fbdcb426c359e63bcd7b2 100644 (file)
@@ -246,7 +246,7 @@ $(OBJS)\rotate.exe :  $(ROTATE_OBJECTS) $(OBJS)\rotate_rotate.res
 
 data : .SYMBOLIC 
        if not exist $(OBJS) mkdir $(OBJS)
-       for %f in (kclub.bmp) do if not exist $(OBJS)\%f copy .\%f $(OBJS)
+       for %f in (duck.png) do if not exist $(OBJS)\%f copy .\%f $(OBJS)
 
 $(OBJS)\rotate_rotate.obj :  .AUTODEPEND .\rotate.cpp
        $(CXX) -zq -fo=$^@ $(ROTATE_CXXFLAGS) $<
index 7c9eff1038b8efb0d9ecd6c54e2cb951312e7743..e212f20e412f73d4c2aa385cd288123214a9e340 100644 (file)
@@ -12,7 +12,7 @@
     
     <wx-data id="data">
         <files>
-            kclub.bmp
+            duck.png
         </files>
     </wx-data>
 
index 002cc3bebdfe7d6964199c4f7c1904db2f507ec8..7313f50ec8df16395967b6f481fda7a2c66ac803 100644 (file)
@@ -47,20 +47,20 @@ private:
 };
 
 // ----------------------------------------------------------------------------
-// data class for cards that need to be rendered
+// data class for images that need to be rendered
 // ----------------------------------------------------------------------------
 
-class MyRenderedCard
+class MyRenderedImage
 {
 public:
-    MyRenderedCard(const wxBitmap& bmp, int x, int y)
+    MyRenderedImage(const wxBitmap& bmp, int x, int y)
         : m_bmp(bmp), m_x(x), m_y(y) { }
     wxBitmap m_bmp;
     int m_x, m_y;
 };
 
-// Declare a wxArray type to hold MyRenderedCards.
-WX_DECLARE_OBJARRAY(MyRenderedCard, ArrayOfCards);
+// Declare a wxArray type to hold MyRenderedImages.
+WX_DECLARE_OBJARRAY(MyRenderedImage, ArrayOfImages);
 
 // ----------------------------------------------------------------------------
 // custom canvas control that we can draw on
@@ -71,14 +71,14 @@ class MyCanvas: public wxScrolledWindow
 public:
     MyCanvas(wxWindow* parent);
 
-    void ClearCards();
+    void ClearImages();
 
     void OnMouseLeftUp (wxMouseEvent & event);
     void OnMouseRightUp (wxMouseEvent & event);
     void OnPaint (wxPaintEvent & event);
 
 private:
-    ArrayOfCards m_cards;
+    ArrayOfImages m_images;
 
     DECLARE_EVENT_TABLE()
 };
@@ -127,10 +127,11 @@ IMPLEMENT_APP(MyApp)
 
 bool MyApp::OnInit()
 {
-    m_image = wxImage(_T("kclub.bmp"), wxBITMAP_TYPE_BMP);
+#if wxUSE_LIBPNG
+    wxImage::AddHandler( new wxPNGHandler );
+#endif
 
-    // any unused colour will do
-    m_image.SetMaskColour( 0, 255, 255 );
+    m_image = wxImage(_T("duck.png"), wxBITMAP_TYPE_PNG);
 
     if ( !m_image.Ok() )
     {
@@ -148,11 +149,11 @@ bool MyApp::OnInit()
 }
 
 // ----------------------------------------------------------------------------
-// data class for cards that need to be rendered
+// data class for images that need to be rendered
 // ----------------------------------------------------------------------------
 
 #include "wx/arrimpl.cpp"
-WX_DEFINE_OBJARRAY(ArrayOfCards);
+WX_DEFINE_OBJARRAY(ArrayOfImages);
 
 // ----------------------------------------------------------------------------
 // custom canvas control that we can draw on
@@ -171,9 +172,9 @@ MyCanvas::MyCanvas(wxWindow* parent):
     ClearBackground();
 }
 
-void MyCanvas::ClearCards ()
+void MyCanvas::ClearImages ()
 {
-    m_cards.Clear();
+    m_images.Clear();
     Refresh(true);
 }
 
@@ -187,8 +188,8 @@ void MyCanvas::OnMouseLeftUp (wxMouseEvent & event)
     wxImage img2 = img.Rotate(frame->m_angle,
         wxPoint(img.GetWidth() / 2, img.GetHeight() / 2), true, &offset);
 
-    // Add the cards to an array to be drawn later in OnPaint()
-    m_cards.Add(new MyRenderedCard(wxBitmap(img2),
+    // Add the images to an array to be drawn later in OnPaint()
+    m_images.Add(new MyRenderedImage(wxBitmap(img2),
         event.m_x + offset.x, event.m_y + offset.y));
     Refresh(false);
 }
@@ -202,24 +203,24 @@ void MyCanvas::OnMouseRightUp (wxMouseEvent & event)
     wxImage img2 = img.Rotate(frame->m_angle,
         wxPoint(img.GetWidth() / 2, img.GetHeight() / 2), false);
 
-    // Add the cards to an array to be drawn later in OnPaint()
-    m_cards.Add(new MyRenderedCard(wxBitmap(img2), event.m_x, event.m_y));
+    // Add the images to an array to be drawn later in OnPaint()
+    m_images.Add(new MyRenderedImage(wxBitmap(img2), event.m_x, event.m_y));
     Refresh(false);
 }
 
 void MyCanvas::OnPaint (wxPaintEvent &)
 {
-    size_t numCards = m_cards.GetCount();
+    size_t numImages = m_images.GetCount();
 
     wxPaintDC dc(this);
     dc.BeginDrawing();
 
     dc.SetTextForeground(wxColour(255, 255, 255));
-    dc.DrawText(wxT("Click on the canvas to draw a card."), 10, 10);
+    dc.DrawText(wxT("Click on the canvas to draw a duck."), 10, 10);
 
-    for (size_t i = 0; i < numCards; i++) {
-        MyRenderedCard & card = m_cards.Item(i);
-        dc.DrawBitmap(card.m_bmp, card.m_x, card.m_y, true);
+    for (size_t i = 0; i < numImages; i++) {
+        MyRenderedImage & image = m_images.Item(i);
+        dc.DrawBitmap(image.m_bmp, image.m_x, image.m_y, true);
     }
 
     dc.EndDrawing();
@@ -244,7 +245,7 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
 
     wxMenu *menuFile = new wxMenu;
     menuFile->Append (ID_Angle, _T("Set &angle...\tCtrl-A"));
-    menuFile->Append (ID_Clear, _T("&Clear all cards\tCtrl-C"));
+    menuFile->Append (ID_Clear, _T("&Clear all ducks\tCtrl-C"));
     menuFile->AppendSeparator();
     menuFile->Append (ID_Quit, _T("E&xit\tAlt-X"));
 
@@ -274,5 +275,6 @@ void MyFrame::OnQuit (wxCommandEvent &)
 
 void MyFrame::OnClear (wxCommandEvent &)
 {
-    m_canvas->ClearCards ();
+    m_canvas->ClearImages ();
 }
+