29#include "vclipgroup.h"
31#include "vcomposite.h"
35VClipGroup::VClipGroup(
VObject* parent, VState state ) :
VGroup( parent, state ) {}
38VClipGroup::~VClipGroup() { }
55 PathRenderer renderer( painter );
56 kdDebug(38000) <<
"calling painter setClipPath" << endl;
57 painter->setClipPath();
63 for( ; itr.current(); ++itr )
64 itr.current()->draw( painter, rect );
71 return new VClipGroup( *
this );
77 TQDomElement me = element.ownerDocument().createElement(
"CLIP" );
78 element.appendChild( me );
83 for( ; itr.current(); ++itr )
84 itr.current()->save( me );
93 TQDomNodeList list = element.childNodes();
94 for( uint i = 0; i < list.count(); ++i )
96 if( list.item( i ).isElement() )
98 TQDomElement e = list.item( i ).toElement();
100 if( e.tagName() ==
"COMPOSITE" || e.tagName() ==
"PATH" )
103 composite->
load( e );
106 else if( e.tagName() ==
"GROUP" )
112 else if( e.tagName() ==
"CLIP" )
114 VClipGroup* clip =
new VClipGroup(
this );
118 else if( e.tagName() ==
"TEXT" )
120#ifdef HAVE_KARBONTEXT
121 VText *text =
new VText(
this );
130PathRenderer::PathRenderer( VPainter *p_painter ) :
VVisitor()
132 m_painter = p_painter;
135PathRenderer::~PathRenderer() {}
137void PathRenderer::visitVSubpath(
VSubpath& path )
139 if(!m_painter)
return;
143 for(path.first(); VSegment *segment = path.current(); path.next() )
151 if(segment->state() != VSegment::deleted)
153 if (segment->isBegin()) {
154 p1 = segment->point( 0 );
156 kdDebug(38000) <<
"calling painter.moveTo with " << p1 << endl;
157 m_painter->moveTo( p1 );
158 }
else if (segment->isCurve()) {
159 p1 = segment->point( 0 );
160 p2 = segment->point( 1 );
161 p3 = segment->point( 2 );
163 kdDebug(38000) <<
"calling painter.curveTo with " << p1 <<
" " << p2 <<
" " << p3 << endl;
164 m_painter->curveTo( p1, p2, p3 );
166 }
else if (segment->isLine()) {
167 p1 = segment->point( 0 );
168 kdDebug(38000) <<
"calling painter.lineTo with " << p1 << endl;
169 m_painter->lineTo( p1 );
Base class for clipping conglomerates the first child element is used for clipping.
virtual void draw(VPainter *painter, const KoRect *rect=0L) const
Draw the object to a painting device.
virtual void save(TQDomElement &element) const
Save this object's state to xml.
virtual void load(const TQDomElement &element)
Load this object's state from xml and initialize this object accordingly.
virtual VClipGroup * clone() const
Create an exact copy of this object.
Base class for all sort of VObject conglomerats.
void append(VObject *object)
Appends a new child object.
VGroup(VObject *parent, VState state=normal)
Constructs a new group object that is child of parent and has the given state.
virtual void draw(VPainter *painter, const KoRect *rect=0L) const
Draw the object to a painting device.
VObjectList m_objects
the list of grouped objects
virtual void load(const TQDomElement &element)
Load this object's state from xml and initialize this object accordingly.
The base class for all karbon objects.
VObject(VObject *parent, VState state=edit)
Constructs a new object that is child of parent and has the given state.
virtual void accept(VVisitor &)
Accept a VVisitor.
@ hidden_locked
hidden and locked (r/o)
@ deleted
deleted, nearly dead
VState state() const
Get the state the object is in.
A composite path consists of one or many subpaths.
virtual void load(const TQDomElement &element)
Load this object's state from xml and initialize this object accordingly.
VSubpath provides a sophisticated list of VSegment.
bool isEmpty() const
Returns true if the current path is "emtpy".
The abstract visitor class.
virtual void visitVSubpath(VSubpath &path)
Visit method for a VSubpath.