Re: Rendering curves
Is there a sample/C++ example that derives and uses this approach?Having said that, and sorry for posting several times, I am thinking that probably you could extend noesisGUI creating a new class that derives from UIElement and implement the OnRender method.
DrawingContext offers a lot more flexibility for drawing:Code: Select allvoid OnRender(DrawingContext* context);
Code: Select allclass DrawingContext { /// Draws an ellipse void DrawEllipse(Brush* brush, Pen* pen, const Drawing::Point& center, NsFloat32 radiusX, NsFloat32 radiusY); /// Draws the specified Geometry using the specified Brush and Pen void DrawGeometry(Brush* brush, Pen* pen, Geometry* geometry); /// Draws an image into the region defined by the specified Rect void DrawImage(ImageSource* imageSource, const Drawing::Rect& rect); /// Draws a line with the specified Pen void DrawLine(Pen* pen, const Drawing::Point& p0, const Drawing::Point& p1); /// Draws a rectangle void DrawRectangle(Brush* brush, Pen* pen, const Drawing::Rect& rect); /// Draws a rounded rectangle void DrawRoundedRectangle(Brush* brush, Pen* pen, const Drawing::Rect& rect, NsFloat32 radiusX, NsFloat32 radiusY); /// Draws formatted text at the specified location void DrawText(FormattedText* formattedText, const Drawing::Rect& bounds); /// Pops the last opacity mask, opacity, clip, effect, or transform operation that was pushed /// onto the drawing context void Pop(); /// Pushes the specified clip region onto the drawing context void PushClip(Geometry* clipGeometry); /// Pushes the specified opacity setting onto the drawing context void PushOpacity(NsFloat32 opacity); /// Pushes the specified opacity mask onto the drawing context void PushOpacityMask(Brush* opacityMask); /// Pushes the specified Transform onto the drawing context void PushTransform(Transform* transform); };
Re: Rendering curves
UIElements, and path derives from that base class, can only have a parent. That implies that they cannot be added twice to the tree. But you could have two paths sharing the same geometry.I assume then that means that you should not add the same instance of a path twice to the canvas children.
The correct way to clone is as follows:If so then I should create two identical paths and set them independently with brushes for fill/stroke.
And does this do a (deep) copy of the path?
m_pPathCopy = *new Gui::Path();
Geometry *pGeom = m_pPath->GetData();
Geometry *pGeomCopy = (Geometry *) pGeom->Clone().GetPtr();
m_pPathCopy->SetData(pGeomCopy);
And does this do a deep copy of a brush:
m_pBrushCopy = *(Brush*) m_pBrush->Clone().GetPtr();
Code: Select all
Ptr<Brush> clonedBrush = NsStaticCast< Ptr<Brush> >(brush->Clone());
Re: Rendering curves
As soon as we release v1.1.5 (today?) I will find time to create a sample for you.Is there a sample/C++ example that derives and uses this approach?
Thanks.
Re: Rendering curves
Thanks but don't bother with the sample. I have been able to implement it will the current canvas approach and it works well.
Thanks
Don
Thanks
Don
Who is online
Users browsing this forum: No registered users and 9 guests