image.h
上传用户:hzhsqp
上传日期:2007-01-06
资源大小:1600k
文件大小:5k
- /*
- * image.h
- *
- * Arbitrary image ancestor class.
- *
- * 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: image.h,v $
- * Revision 1.22 1999/08/24 06:54:36 robertj
- * Cleaned up the smart pointer code (macros).
- *
- * Revision 1.21 1999/03/10 03:49:51 robertj
- * More documentation adjustments.
- *
- * Revision 1.20 1999/03/09 08:01:48 robertj
- * Changed comments for doc++ support (more to come).
- *
- * Revision 1.19 1999/02/16 08:08:45 robertj
- * MSVC 6.0 compatibility changes.
- *
- * Revision 1.18 1998/09/23 06:23:52 robertj
- * Added open source copyright license.
- *
- * Revision 1.17 1995/03/14 12:41:33 robertj
- * Updated documentation to use HTML codes.
- *
- * Revision 1.16 1995/01/09 12:39:33 robertj
- * Documentation.
- *
- * Revision 1.15 1994/12/21 11:53:06 robertj
- * Documentation and variable normalisation.
- *
- * Revision 1.14 1994/12/12 10:01:31 robertj
- * Renamed PWrapper to PSmartPointer.
- *
- * Revision 1.13 1994/12/05 11:34:08 robertj
- * Major rewrite of images, pictures and pixmaps.
- * Renamed PPict, PPixels and PImage to make sure all uses are found.
- *
- * Revision 1.12 1994/10/23 04:43:51 robertj
- * Changed function name to be Write to be consistent with Read function in descendent classes.
- *
- * Revision 1.11 1994/08/23 11:32:52 robertj
- * Oops
- *
- * Revision 1.10 1994/08/22 00:46:48 robertj
- * Added pragma fro GNU C++ compiler.
- *
- * Revision 1.9 1994/06/25 11:55:15 robertj
- * Unix version synchronisation.
- *
- * Revision 1.8 1994/04/20 12:17:44 robertj
- * Split name into PFilePath
- *
- * Revision 1.7 1994/04/01 14:12:26 robertj
- * Removed PDECLARE_ABSTRACT_CONTAINER.
- *
- * Revision 1.6 1994/01/03 04:42:23 robertj
- * Mass changes to common container classes and interactors etc etc etc.
- *
- * Revision 1.5 1993/10/16 20:33:20 robertj
- * Change image class to not be a PShape.
- *
- * Revision 1.4 1993/08/21 01:50:33 robertj
- * Made Clone() function optional, default will assert if called.
- *
- * Revision 1.3 1993/07/14 12:49:16 robertj
- * Fixed RCS keywords.
- *
- */
- #define _PIMAGE
- #ifdef __GNUC__
- #pragma interface
- #endif
- class PFile;
- class PImageBase;
- /**This class is used to represent an image. It works in conjuction with the
- Ref{PImageBase} class using the "smart" pointer system.
-
- This is logically an abstract class and the user would normally create
- one of the descendent classes. These are either pixel images descended from
- Ref{PPixelBase} or a picture images in the Ref{PPictBase} class.
-
- A common use for images is by the Ref{PMemoryCanvas} class for drawing to
- off screen memory.
- */
- class PImage : public PSmartPointer
- {
- PSMART_POINTER_INFO(PImage, PSmartPointer, PImageBase);
- public:
- PImage(PImageBase * obj = NULL);
- };
- /**A class representing an image. This may be either pixel images descended
- from Ref{PPixelBase} or a picture images in the Ref{PPictBase} class.
-
- This is an abstract class and contains the common functionality of all
- image types. A common use for images is by the Ref{PMemoryCanvas} class
- for drawing to off screen memory.
- */
- class PImageBase : public PSmartObject
- {
- PCLASSINFO(PImageBase, PSmartObject);
- protected:
- /**Create an image, this may be a pixel image or a set of drawing
- primitives in a "picture" (Metafile/PICT etc).
- */
- PImageBase(
- PDIMENSION width, /// Width of the image.
- PDIMENSION height /// Height of the image.
- );
- PImageBase(
- const PDim & dim /// Dimensions of the image.
- );
- public:
- /**@name New functions for class */
- /**Get the width of the image.
-
- @return
- width.
- */
- PDIMENSION Width() const;
- /**Get the height of the image.
-
- @return
- height.
- */
- PDIMENSION Height() const;
- /**Get the width and height of the image.
-
- @return
- dimensions.
- */
- PDim GetDimensions() const;
- /**Save the image into the specified file in a platform specific format.
- Thus, for MS-Windwos, a Ref{PPixelBase} class would write a .BMP file.
- @return
- TRUE if written successfully.
- */
- virtual BOOL Write(
- PFile & dwg /// File to write the image to.
- ) = 0;
- protected:
- // Member variables
- /** Dimensions of the image. */
- PDim size;
- #ifdef DOC_PLUS_PLUS
- };
- #endif
- // Class declaration continued in platform specific header file ///////////////