mcanvas.h
上传用户:hzhsqp
上传日期:2007-01-06
资源大小:1600k
文件大小:5k
- /*
- * mcanvas.h
- *
- * Memory canvas.
- *
- * Portable Windows Library
- *
- * Copyright (c) 1993-1998 Equivalence Pty. Ltd.
- *
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is Portable Windows Library.
- *
- * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
- *
- * Portions are Copyright (C) 1993 Free Software Foundation, Inc.
- * All Rights Reserved.
- *
- * Contributor(s): ______________________________________.
- *
- * $Log: mcanvas.h,v $
- * Revision 1.16 1999/03/10 03:49:52 robertj
- * More documentation adjustments.
- *
- * Revision 1.15 1999/03/09 08:01:48 robertj
- * Changed comments for doc++ support (more to come).
- *
- * Revision 1.14 1999/02/16 08:08:45 robertj
- * MSVC 6.0 compatibility changes.
- *
- * Revision 1.13 1998/09/23 06:24:11 robertj
- * Added open source copyright license.
- *
- * Revision 1.12 1995/03/14 12:41:42 robertj
- * Updated documentation to use HTML codes.
- *
- * Revision 1.11 1994/12/21 11:53:14 robertj
- * Documentation and variable normalisation.
- *
- * Revision 1.10 1994/12/05 11:34:10 robertj
- * Major rewrite of images, pictures and pixmaps.
- * Renamed PPict, PPixels and PImage to make sure all uses are found.
- *
- * Revision 1.9 1994/08/23 11:32:52 robertj
- * Oops
- *
- * Revision 1.8 1994/08/22 00:46:48 robertj
- * Added pragma fro GNU C++ compiler.
- *
- * Revision 1.7 1994/06/25 11:55:15 robertj
- * Unix version synchronisation.
- *
- * Revision 1.6 1994/03/07 07:38:19 robertj
- * Major enhancementsacross the board.
- *
- * Revision 1.5 1994/01/03 04:42:23 robertj
- * Mass changes to common container classes and interactors etc etc etc.
- *
- * Revision 1.4 1993/10/16 20:33:20 robertj
- * Changed memory canvas to output to PImage which is no longer a bitmap.
- *
- * Revision 1.3 1993/08/21 01:50:33 robertj
- * Made Clone() function optional, default will assert if called.
- *
- * Revision 1.2 1993/07/14 12:49:16 robertj
- * Fixed RCS keywords.
- *
- */
- #define _PMEMORYCANVAS
- #ifdef __GNUC__
- #pragma interface
- #endif
- /**A drawable area that will go to a Ref{PImage} in memory. Note that the
- Ref{PImage} object passed to the PMemoryCanvas is undefined while the
- PMemoryCanvas exists. Not until the PMemoryCanvas is destroyed is the
- Ref{PImage} object guarenteed to be updated.
- *********************************** NOTE ***********************************
- On Some platforms, canvases are a limited resource. Do NOT create and leave
- them around for long periods. As soon as it is not required till the next
- user event, destroy it!
- ****************************************************************************
- */
- class PMemoryCanvas : public PCanvas
- {
- PCLASSINFO(PMemoryCanvas, PCanvas);
- public:
- /**Create a canvas using the specified image. The image will receive the
- drawing operations made to the canvas. The two types of images,
- Ref{PPixelImage} and Ref{PPictImage} will store the commands
- differently according to their internal representation of an image.
- */
- PMemoryCanvas(
- const PImage & img /// Image to draw into.
- );
- /** Destroy the canvas and image. */
- virtual ~PMemoryCanvas();
- /**@name Overrides from class PCanvas */
- /**Get the drawable area of the image, for instance, this would be the
- dimensions of the Ref{PPixelImage} used by the canvas.
- @return
- rectangle for the maximum size of the drawable area.
- */
- virtual PRect GetDrawingBounds() const;
- /**@name New functions for class */
- /**Get the image created by the canvas. While this will allow you to
- obtain a reference to the image instance being drawn to by the canvas,
- the state of the image is indeterminate while the PMemoryCanvas instance
- still exists. For example in X windows when a PPixelImage is being
- created, the pixels are not tranferred from the X server to the client
- until the PMemoryCanvas is destroyed.
- */
- const PImage GetImage();
- protected:
- /// Image to draw into.
- PImage image;
- // New functions for class
- void Construct();
- // Internal function for common constructor code.
- #ifdef DOC_PLUS_PLUS
- };
- #endif
- // Class declaration continued in platform specific header file ///////////////