We have a StreamGeometry object which we would like to render in about 400 different locations during the OnRender call. The problem is, of course, that a geometry object uses absolute coordinates.
While we could of course apply transforms before the render call, that means we'd in essence be creating 400 transforms as well, which just seems like overkill.
We just want to say 'Render this in that location, like this (Note: DrawGeometryAtPoint is fictitious)...
protected override void OnRender(System.Windows.Media.DrawingContext dc)
{
base.OnRender(dc);
var myGeometry = new StreamGeometry();
// Code to init the geometry goes here
// Render the same geometry but at four different locations
dc.DrawGeometryAtPoint(Brush1, Pen1, myGeometry, Origin1);
dc.DrawGeometryAtPoint(Brush2, Pen2, myGeometry, Origin2);
dc.DrawGeometryAtPoint(Brush3, Pen3, myGeometry, Origin3);
dc.DrawGeometryAtPoint(Brush4, Pen4, myGeometry, Origin4);
}
So can it be done?