I have 1000s shapes whose StartPoint
, EndPoint
, Center
, etc is being set 30 times per second but the only way to do this is to create a new Point
each time, since System.Windows.Point
is a struct so I can't do this开发者_开发知识库:
shape.Center.X = x;
And there is not even a SetCenter
, etc method to solve this.
Any ideas on how to do this?
Why don't you want to create new Points?
They're simple value types, no memory or performance issues that I can see.
Use TranslateTransform to place the shapes. Use the RenderTransformOrigin to set the 'center'.
EDIT
RenderTransforms can be accelerated by the GPU. You wouldn't add a transformation each frame but add just one and change its properties over time. See BitmapCache and this is also quite interesting
精彩评论