Home || Architecture || Video Search || Visual Search || Scripts || Applications || Important Messages || OGL || Src

ShapeScalingView.h

Go to the documentation of this file.
00001 #ifndef OglGui_ShapeScalingView_h
00002 #define OglGui_ShapeScalingView_h
00003 
00004 #ifndef OglGui_View_h
00005 #include "OglGui/View.h"
00006 #endif
00007 namespace OglGui {
00008 
00009 class ShapeScalingView : public OglGui::View
00010 {
00011 public:
00012     ShapeScalingView(OGLWND* oglWnd, OGLIMAGE *oglIm, int x, int y, int w, int h,
00013                 int shape=0, ULONG shapeBg= 0x80e08080,ViewListener* li=0) :
00014         OglGui::View(oglWnd,oglIm,x,y,w,h,li)
00015     {
00016         mShape = shape;
00017         mShapeBg = shapeBg;
00018     }
00019 
00020     virtual void OnPreDrawView()
00021     {
00022         OGLIMAGE* im;
00023         if (im = mView2D->im)
00024         {
00025             int w = mView2D->w;
00026             int h = mView2D->h;
00027             viewSys.SetZoom(mView2D,w/(float)im->w,h/(float)im->h);
00028         }
00029         View::OnPreDrawView();
00030     }
00031 
00032     virtual void OnDrawView()
00033     {
00034         View::OnDrawView();
00035         if (!mShape)
00036             return;
00037         OGC myOGC;
00038         OGCSave(&myOGC);
00039         glPushMatrix();
00040         int bInfo[3];
00041         oglSys.StartBlend(bInfo);
00042         viewSys.View2DTransform(mView2D);
00043         SetSolidFillColor(mShapeBg);
00044         float w = mView2D->w, h = mView2D->h;
00045         if (mShape==2)
00046         {
00047             FillOval(w/2,h/2,w/2,h/2);
00048             SetSolidLineColor(oglBLACK);
00049             DrawOval(w/2,h/2,w/2,h/2);
00050         }
00051         if (mShape==1)
00052         {
00053             FillRectangle(.5,.5,w-1,h-1);
00054             SetSolidLineColor(oglBLACK);
00055             DrawRectangle(.5,.5,w-1,h-1);
00056         }
00057         oglSys.EndBlend(bInfo);
00058         glPopMatrix();
00059         OGCRestore(&myOGC);
00060     }
00061 
00062     int     mShape;
00063     ULONG   mShapeBg;
00064 };
00065 } // namespace OglGui
00066 #endif

Generated on Fri Mar 19 09:31:38 2010 for ImpalaSrc by  doxygen 1.5.1