Skip to content

Commit

Permalink
move the raster matrix object to the imaging base module
Browse files Browse the repository at this point in the history
  • Loading branch information
xieguigang committed Jan 6, 2024
1 parent 2109832 commit da63b96
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions gr/Microsoft.VisualBasic.Imaging/Drawing2D/HeatMap/RasterMatrix.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Imports Microsoft.VisualBasic.Math.LinearAlgebra
Imports Microsoft.VisualBasic.Math.LinearAlgebra.Matrix

Namespace Drawing2D.HeatMap

Public Class RasterMatrix : Implements IRasterGrayscaleHeatmap

Dim m As GeneralMatrix

Sub New(m As GeneralMatrix)
Me.m = m
End Sub

Public Iterator Function GetRasterPixels() As IEnumerable(Of Pixel) Implements IRasterGrayscaleHeatmap.GetRasterPixels
Dim y As Integer = 0

For Each row As Vector In m.RowVectors
Dim v = row.Array

For x As Integer = 0 To v.Length - 1
Yield New PixelData With {
.Scale = v(x),
.X = x,
.Y = y
}
Next

y += 1
Next
End Function
End Class
End Namespace

0 comments on commit da63b96

Please sign in to comment.