GDI+ How to limit number of PathPoints in GraphicsPath [modified]
-
My application is a scrolling histogram. With each tick of the clock I add another rectangle to the graphicspath and then use TranslateTransform() to scale and "scroll" the data. Unfortunately this app must run 24/7 for weeks (months?!) at a time so the GraphicsPath gets very big. Does anyone know a way to remove PathPoints from a GraphicsPath? Something better than the following barebones class? Thanks for having a look. Public Class SizeLimitedGraphicsPath Private Gp1 As New GraphicsPath Private Gp2 As New GraphicsPath Private ActivePtr As GraphicsPath Private InActivePtr As GraphicsPath Private NextActiveGp As Integer Private _minimumSize As Integer Public Sub New(ByVal MinimumSize As Integer) _minimumSize = MinimumSize ActivePtr = Gp1 InActivePtr = Gp2 NextActiveGp = 2 End Sub Public Sub AddRectangle(ByVal rect As RectangleF) Gp1.AddRectangle(rect) Gp2.AddRectangle(rect) SwapIfNecessary() End Sub Public ReadOnly Property gp() As GraphicsPath Get Return ActivePtr End Get End Property Private Sub SwapIfNecessary() If InActivePtr.PointCount > _MinimumSize Then If NextActiveGp = 1 Then ActivePtr = Gp1 InActivePtr = Gp2 Gp2.Reset() NextActiveGp = 2 Else ' Nextgp = 2 ActivePtr = Gp2 InActivePtr = Gp1 Gp1.Reset() NextActiveGp = 1 End If End If End Sub End Class Wfanning@gso.uri.edu -- modified at 8:29 Monday 18th June, 2007