home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1997 October
/
Chip_1997-10_cd.bin
/
tema
/
sybase
/
powerj
/
hpp.z
/
WREGION.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1996-10-18
|
5KB
|
157 lines
/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Copyright (C) 1994, by WATCOM International Inc. All rights %
% reserved. No part of this software may be reproduced or %
% used in any form or by any means - graphic, electronic or %
% mechanical, including photocopying, recording, taping or %
% information storage and retrieval systems - except with the %
% written permission of WATCOM International Inc. %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*/
#ifndef _WREGION_HPP_INCLUDED
#define _WREGION_HPP_INCLUDED
#ifndef _WNO_PRAGMA_PUSH
#pragma pack(push,8);
#pragma enum int;
#endif
#ifndef _WOBJECT_HPP_INCLUDED
# include "wobject.hpp"
#endif
#ifndef _WRECT_HPP_INCLUDED
# include "wrect.hpp"
#endif
#ifndef _WPOINT_HPP_INCLUDED
# include "wpoint.hpp"
#endif
#ifndef _WARRAY_HPP_INCLUDED
# include "warray.hpp"
#endif
enum WRegionHandle { NULLHREGION = 0, LASTHREGION = LAST_16TO32BIT };
enum WPolygonFillMode {
WPFMAlternate = 1,
WPFMWinding = 2,
WPFMLast = 2,
};
enum WRegionCombineMode {
WRCMMin = 1,
WRCMAnd = 1,
WRCMOr = 2,
WRCMXor = 3,
WRCMDiff = 4,
WRCMCopy = 5,
WRCMMax = 5,
};
typedef WArray< WPoint > WPointArray;
typedef WArray< WInt > WIntArray;
class WCMCLASS WRegion : public WObject {
WDeclareSubclass( WRegion, WObject );
public:
/************************************************************
* Constructors and Destructors
************************************************************/
WRegion();
WRegion( const WRect & rect, WBool createAsEllipse=FALSE );
WRegion( const WRect & rect, WInt ellipseWidth, WInt ellipseHeight );
WRegion( const WPointArray & pointArray,
WPolygonFillMode mode=WPFMWinding );
WRegion( const WPointArray & pointArray,
const WIntArray & vertexCountArray,
WPolygonFillMode mode=WPFMWinding );
~WRegion();
/************************************************************
* Properties
************************************************************/
// BoundingRectangle
WRect GetBoundingRectangle( WBool * isComplex=NULL );
// Handle
WRegionHandle GetHandle() const;
/************************************************************
* Methods
************************************************************/
// Combine
WBool Combine( const WRegion & region1, const WRegion & region2,
WRegionCombineMode mode );
// Create
//
// Create a new region.
WBool Create( const WRect & rect, WBool createAsEllipse=FALSE );
WBool Create( const WRect & rect, WInt ellipseWidth,
WInt ellipseHeight );
WBool Create( const WPointArray & pointArray,
WPolygonFillMode mode=WPFMWinding );
WBool Create( const WPointArray & pointArray,
const WIntArray & vertexCountArray,
WPolygonFillMode mode=WPFMWinding );
// Offset
WBool Offset( const WPoint & offset, WBool * isComplex=NULL );
// Intersects
WBool Intersects( const WRect & rect );
WBool Intersects( const WPoint & point );
/***********************************************************
* Static Methods
***********************************************************/
// IsValidHandle
//
// Returns TRUE if the given handle is valid. Can
// optionally specify whether or not a null handle
// is "valid".
static WBool IsValidHandle( WRegionHandle handle,
WBool nullValid=FALSE );
/***********************************************************
* Others
***********************************************************/
WBool operator==( const WRegion & region ) const;
/***********************************************************
* Data members
***********************************************************/
private:
WRegionHandle _handle;
};
#ifdef _DEBUG
#define W_ISREGIONHANDLE(h) CHECKGDI(WRegion::IsValidHandle((WRegionHandle)h))
#else
#define W_ISREGIONHANDLE(h)
#endif
#ifndef _WNO_PRAGMA_PUSH
#pragma enum pop;
#pragma pack(pop);
#endif
#endif // _WREGION_HPP_INCLUDED