00001 /********************************************************************************* 00002 * 00003 * Razor! Engine - A modular C++ presentation engine 00004 * 00005 * $Id: Canvas.h,v 1.1.1.1 2000/12/09 09:28:39 christ Exp $ 00006 * 00007 * Copyright (c) 2000 Tilo Christ. All Rights Reserved. 00008 * 00009 * This library is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU Lesser General Public 00011 * License as published by the Free Software Foundation; either 00012 * version 2.1 of the License, or (at your option) any later version. 00013 * 00014 * This library is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 * Lesser General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU Lesser General Public 00020 * License along with this library; if not, write to the Free Software 00021 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00022 * 00023 **********************************************************************************/ 00024 00025 #ifndef CANVAS_H 00026 #define CANVAS_H 00027 00028 #include <PalmOS.h> 00029 00030 /** 00031 * Canvas manages a canvas into which a user can paint. 00032 */ 00033 class Canvas 00034 { 00035 public: 00036 00037 /// 1bpp b/w 00038 static const UInt32 GRAY_1BPP = 0x00000001; 00039 /// 2bpp grayscale 00040 static const UInt32 GRAY_2BPP = 0x00000002; 00041 /// 4bpp grayscale 00042 static const UInt32 GRAY_4BPP = 0x00000008; 00043 /// 4bpp color. Use the special 4bpp color commands from PilRC 2.6 or higher to generate the required bitmap resources. 00044 static const UInt32 COLOR_4BPP = 0x80000008; 00045 /// 8bpp color 00046 static const UInt32 COLOR_8BPP = 0x80000080; 00047 /// 16bpp color. Use the special HandSpring resource compiler to generate the required bitmap resources. 00048 static const UInt32 COLOR_16BPP = 0x80008000; 00049 00050 00051 ///@name Construction / Destruction 00052 //@{ 00053 /** 00054 * Construct a new canvas. 00055 */ 00056 Canvas(); 00057 00058 00059 /** 00060 * Destroy the canvas. 00061 */ 00062 virtual ~Canvas(); 00063 //@} 00064 00065 00066 /// @name Output management 00067 //@{ 00068 /** 00069 * Switch drawing window to the window into which the application shall paint. 00070 */ 00071 virtual void beginDraw(WinLockInitType initMode) = 0; 00072 00073 /** 00074 * Notify the canvas of the end of user paint operations. 00075 * 00076 * @param bounds the area that was modified by the user draw operation 00077 */ 00078 virtual void endDraw(RectangleType *bounds) = 0; 00079 00080 /** 00081 * Display user painted graphics. 00082 */ 00083 virtual void show() = 0; 00084 //@} 00085 00086 00087 /// @name Physical Display management 00088 //@{ 00089 /** 00090 * Get the width of the display 00091 */ 00092 Coord getWidth() const 00093 { 00094 return width; 00095 } 00096 00097 00098 /** 00099 * Get the height of the display 00100 */ 00101 Coord getHeight() const 00102 { 00103 return height; 00104 } 00105 //@} 00106 00107 00108 00109 /// @name Utility operations 00110 //@{ 00111 /** 00112 * Determine a rectangle that encompasses two other rectangles. 00113 * 00114 * @param rect1Bound the bounds of rectangle #1 00115 * @param rect2Bound the bounds of rectangle #2 00116 * @param resultBound the bounds of the encompassing rectangle. 00117 rect1Bound, or rect2Bound, and resultBound may safely point to the same RectangleType structure. 00118 */ 00119 static void uniteBounds(RectangleType *rect1Bound, RectangleType *rect2Bound, RectangleType *resultBound); 00120 //@} 00121 00122 protected: 00123 RectangleType displayBounds; 00124 00125 Coord width; 00126 Coord height; 00127 UInt32 selectedDepth; 00128 Boolean colorMode; 00129 }; 00130 00131 00132 #endif