I have a scribbale inkpresenter in my silverlight app that I’m using multiple times in different shapes, I want to calculate how much percent of the inkpresenter has been scribbled,
My problem is that since the shape of the ink presenter can be circular or poly I don’t know how i can get the units/pixels there is available on the scribbable surface.
As far as i understand is that the actualWidth and actualHeight properties will only help me for rectangular shape by calculating
units = uielemnt.Actualwidth * uielement.ActualHeight
but for costum shapes I’m not sure how the actualWidth/Height are calculated.
WPF Answer
In WPF you can just use Geometry.Combine to combine the stroke geometries, then call GetArea on the combined geometry to get the total area covered.
Silverlight Answer
In Silverlight you don’t have Geomerty.Combine or Geometry.GetArea, and you also don’t have RenderTargetBitmap. So in Silverlight I think you have to do the calculations yourself.
Here are the setup steps:
Here is the main loop:
Here is the inner loop that computes the area:
That’s it.
More details on Silverlight answer
Formulas to convert segments of a PathGeometry into a cubic bezier approximation:
Computing intersections of active Bezier curves: