kpresenter

KoPointArray.h
1/* This file is part of the KDE project
2 Copyright (C) 2001 Laurent MONTEL <lmontel@mandrakesoft.com>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18*/
19#ifndef KOPOINTARRAY_H
20#define KOPOINTARRAY_H
21
22#include <tqmemarray.h>
23#include <KoPoint.h>
24#include <KoRect.h>
25
26class KoZoomHandler;
27class KoPointArray : public TQMemArray<KoPoint>
28{
29public:
30 KoPointArray() {}
31 ~KoPointArray() {}
32 KoPointArray( int size ) : TQMemArray<KoPoint>( size ) {}
33 KoPointArray( const KoPointArray &a ) : TQMemArray<KoPoint>( a ) {}
34
35 KoPointArray &operator=( const KoPointArray &a )
36 { return (KoPointArray&)assign( a ); }
37
38 KoPointArray copy() const
39 { KoPointArray tmp; return *((KoPointArray*)&tmp.duplicate(*this)); }
40
41 void translate( double dx, double dy );
42 KoRect boundingRect() const;
43
44 void point( uint i, double *x, double *y ) const;
45 KoPoint point( uint i ) const;
46 void setPoint( uint i, double x, double y );
47 void setPoint( uint i, const KoPoint &p );
48 bool putPoints( int index, int nPoints, double firstx, double firsty, ... );
49
50 KoPointArray cubicBezier() const;
51 static void cleanBuffers();
52
53 TQPointArray zoomPointArray( const KoZoomHandler* zoomHandler ) const;
54 // Zoom the point array, taking into account the width of the pen
55 // (reducing the figure as necessary)
56 TQPointArray zoomPointArray( const KoZoomHandler* zoomHandler, int penWidth ) const;
57
58protected:
59 static uint splen;
60 static void* sp;
61};
62
63
64#endif // KOPOINTARRAY_H