MapWinGIS:Image GetRow
From MapWindow GIS
GetRow
Gets a row of pixels from the image.
VB.NET Usage
Function GetRow(Row As Integer, ByRef Vals() As Integer) As Boolean
Parameters
|
Row | The row of pixels you want to get from the image. |
| Vals() | Reference parameter. An array which will return the pixels in the specified row of the image. |
| ReturnValue | A boolean value representing the success or failure of getting the row of pixels from the image. |
Sample Code
Private Sub GetRow()
Dim image As New MapWinGIS.Image(), image2 As New MapWinGIS.Image()
Dim row As Integer, i As Integer, j As Integer
Dim pixels(400) As Integer
Dim success As Boolean
'Open image from file
image.Open("C:\test.bmp")
'Create a new image to copy rows of pixels to
image2.CreateNew(400, 500)
'Set the row to get the pixels from
row = 0
'Get 400 rows x 400 columns of pixels from image and copy them into image2
For i = 1 To 400
'Get the pixels from the specified row in the image
success = image.GetRow(row, pixels(0))
'Get 400 pixel values from the row retrieved from image
For j = 1 To 400
'Copy the current pixel into image2
image2.Value(i, j) = pixels(j)
Next
'Advance to the next row in the image
row = row + 1
Next
'Add the new image to the map
Map1.AddLayer(image2, True)
End Sub
VB 6 Usage
Function GetRow(Row As Long, ByRef Vals() As Long) As Boolean
Parameters
|
Row | The row of pixels you want to get from the image. |
| Vals() | Reference parameter. An array which will return the pixels in the specified row of the image. |
| ReturnValue | A boolean value representing the success or failure of getting the row of pixels from the image. |
Sample Code
Private Sub GetRow()
Dim image As New MapWinGIS.image, image2 As New MapWinGIS.image
Dim row As Long, i As Long, j As Long
Dim pixels(400) As Long
Dim success As Boolean
'Open image from file
image.Open ("C:\test.bmp")
'Create a new image to copy rows of pixels to
image2.CreateNew 400, 500
'Set the row to get the pixels from
row = 0
'Get 400 rows x 400 columns of pixels from image and copy them into image2
For i = 1 To 400
'Get the pixels from the specified row in the image
success = image.GetRow(row, pixels(0))
'Get 400 pixel values from the row retrieved from image
For j = 1 To 400
'Copy the current pixel into image2
image2.value(i, j) = pixels(j)
Next
'Advance to the next row in the image
row = row + 1
Next
'Add the new image to the map
Map1.AddLayer image2, True
End Sub
















