home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / krcls012.zip / KrClass / include / krbwin.hpp < prev    next >
Text File  |  1997-02-12  |  4KB  |  83 lines

  1. // Kroni's Classes: objects for buffered twodimensional graphics
  2. // (c) 1997 Wolfgang Kronberg
  3. // file: krbwin.hpp
  4.  
  5. // **********************************************************************************************************
  6. //
  7. // defines these classes:
  8. //
  9. //   KrMemoryBitmap          Define a memory bitmap to do buffered painting on the screen
  10. //
  11. // defines no global symbols for private use.
  12. //
  13. // **********************************************************************************************************
  14.  
  15.  
  16. #ifndef __KRBWIN_HPP__
  17. #define __KRBWIN_HPP__
  18.  
  19.  
  20. #include "krcstran.hpp"
  21.  
  22. #include <igbitmap.hpp>                          // IGBitmap
  23.  
  24.  
  25.  
  26. class KrMemoryBitmap : public IGBitmap
  27. {
  28.  
  29. public:
  30.  
  31.   KrMemoryBitmap (int aWidth, int aHeight);      // Constructor for bitmap of size _width x _height
  32.  
  33.   IGList * setList (IGList & list);              // Sets a new graphicList.
  34.                                                  //   Returns a pointer to the old one.
  35.   IGList * list ();                              // Returns a pointer to the current graphicList
  36.   void addList (IGList & list);                  // Adds a new graphicList; draws all new graphics elements.
  37.  
  38.   void erase (const IColor & color = IGUIColor (IGUIColor::windowBgnd) );
  39.                                                  // Fills the bitmap with the given color
  40.   KrCoordSystemTranslator * setCoordSystem (KrCoordSystemTranslator * aTrans,
  41.                                             const KrPoint & aP1, const KrPoint & aP2);
  42.                                                  // Maps the Bitmap in the rectangle between aP1 and aP2
  43.                                                  //   in the coordinate system aTrans. Returns the old
  44.                                                  //   coordinate system translator.
  45.  
  46.   virtual KrMemoryBitmap & drawOn (IGraphicContext & graphicContext);
  47.   virtual KrMemoryBitmap & drawOn( IGraphicContext & graphicContext, const IPoint& targetBottomLeft,
  48.              const IPoint& targetTopRight, const IPoint& sourceBottomLeft, const IPoint& sourceTopRight,
  49.              long rasterOperation = normal, CompressMode compressMode = ignore);
  50.   virtual KrMemoryBitmap & drawOn( IGraphicContext& graphicContext, long rasterOperation);
  51.                                                  // Overloads of all IBitmap::drawOn functions
  52.  
  53. private:
  54.  
  55.   KrCoordSystemTranslator * trans;               // For the coordinate system the bitmap is drawn into
  56.  
  57.   IHandle::Value createHbm (short aWidth, short aHeight);
  58.                                                  // Create the Bitmap in the memory.
  59.                                                  //   Creates also device context and the presentation space
  60.                                                  //   as side effects (intended)
  61.  
  62.   void drawOnBitmap (IGList * list);             // Draw the contents of list on the bitmap
  63.  
  64.   IGList *graphicsList;                          // List of graphics elements drawn on the bitmap
  65.  
  66.   KrPoint p1, p2;                                // Corners of the Bitmap in "trans" coordinates.
  67.  
  68.   short width, height;                           // Size of the bitmap
  69.   IHandle::Value hdcMem;                         // Memory Device Context handle
  70.   IHandle::Value hpsMem;                         // Memory Presentation Space handle
  71.   IHandle::Value hbmMem;                         // Handle to the bitmap itself
  72.  
  73.   static short widthS, heightS;                  // Temporary values required for initilization
  74.   static IHandle::Value hdcMemS;
  75.   static IHandle::Value hpsMemS;
  76.   static IHandle::Value hbmMemS;
  77.  
  78. };
  79.  
  80.  
  81. #endif
  82.  
  83.