locked
Programatically fill a shape with Usercontrols RRS feed

  • Question

  • Hi! I have a number custom polygon shapes in my LayoutRoot which I want to programatically fill with small Ellipses. The constraints are:


    - Ellipses' width randomly varies from 15 to 30 pixels

    - Margin between Ellipses is 2

    - Polygon shapes are to be filled are asymmetrical, pretty much random

    - Ellipses must be placed in a way that they line up in a grid

    - Ellipse must not cross the boundary of the underlying Polygon


    What would be the easiest way to do this with Silverlight? The attached picture illustrates my goal:

    Ellipses


    Edit: The bottom row doesn't actually follow the grid rule. 

    Friday, October 15, 2010 7:45 AM

Answers

  • You can just use a WriteableBitmap.

    Have a routine to test an ellipse (bloated by the margin) against existing pixels.  If it does not hit anyone, mark the ellipse (without margin).  Repeat.

    Sunday, October 17, 2010 12:22 AM