ImageGear .NET v24.12 - Updated
UpdateAreaFrom Method
Example 




ImageGear24.Core Assembly > ImageGear.Core Namespace > ImGearDIB Class : UpdateAreaFrom Method
X coordinate of top-left point of area to be updated.
Y coordinate of top-left point of area to be updated.
X coordinate of bottom-right point of area to be updated.
Y coordinate of bottom-right point of area to be updated.
New values for the pixels being updated.
Updates the pixels of the specified rectangular area.
Syntax
'Declaration
 
Public MustOverride Sub UpdateAreaFrom( _
   ByVal startColumn As Integer, _
   ByVal startRow As Integer, _
   ByVal endColumn As Integer, _
   ByVal endRow As Integer, _
   ByVal pixels As ImGearPixelArray _
) 
'Usage
 
Dim instance As ImGearDIB
Dim startColumn As Integer
Dim startRow As Integer
Dim endColumn As Integer
Dim endRow As Integer
Dim pixels As ImGearPixelArray
 
instance.UpdateAreaFrom(startColumn, startRow, endColumn, endRow, pixels)
public abstract void UpdateAreaFrom( 
   int startColumn,
   int startRow,
   int endColumn,
   int endRow,
   ImGearPixelArray pixels
)
public: abstract void UpdateAreaFrom( 
   int startColumn,
   int startRow,
   int endColumn,
   int endRow,
   ImGearPixelArray* pixels
) 
public:
abstract void UpdateAreaFrom( 
   int startColumn,
   int startRow,
   int endColumn,
   int endRow,
   ImGearPixelArray^ pixels
) 

Parameters

startColumn
X coordinate of top-left point of area to be updated.
startRow
Y coordinate of top-left point of area to be updated.
endColumn
X coordinate of bottom-right point of area to be updated.
endRow
Y coordinate of bottom-right point of area to be updated.
pixels
New values for the pixels being updated.
Example
ImGearPage igPage;
// Load an image into a ImGearPage object
using (FileStream localFile = new FileStream(localFilePath, FileMode.Open))
    igPage = ImGearFileFormats.LoadPage(localFile, 0);
// Get the upper left square of the image to perform a transpose on.
int transposeSize;
if ( igPage.DIB.Height > igPage.DIB.Width)
    transposeSize = igPage.DIB.Width / 2;
else
    transposeSize = igPage.DIB.Height / 2;
ImGearPixelArray igPixelArray = igPage.DIB.GetAreaCopy(0, 0, transposeSize - 1, transposeSize - 1);
// Transpose the pixels in igPixelArray
int channelData;
int transposePosition1, transposePosition2;
for (int row = 1; row < transposeSize; ++ row)
    for (int column = 0; column < row; ++column)
    {
        transposePosition1 = (row * transposeSize) + column;
        transposePosition2 = (column * transposeSize) + row;
        for (int channel = 0; channel < igPixelArray.ChannelCount; channel++)
        {
            channelData = igPixelArray[transposePosition1,channel];
            igPixelArray[transposePosition1, channel] = igPixelArray[transposePosition2,channel];
            igPixelArray[transposePosition2, channel] = channelData;
        }
    }
// Update the original image with the transposed array
igPage.DIB.UpdateAreaFrom(0, 0, transposeSize - 1, transposeSize - 1, igPixelArray);
Dim igPage As ImGearPage
'Load an image into a ImGearPage object
Dim localFile As FileStream = New FileStream(localFilePath, FileMode.Open)
Try
    igPage = ImGearFileFormats.LoadPage(localFile, 0)
Finally
    localFile.Close()
End Try
'Get the upper left square of the image to perform a transpose on.
Dim transposeSize As Integer
If (igPage.DIB.Height > igPage.DIB.Width) Then
    transposeSize = igPage.DIB.Width / 2
Else
    transposeSize = igPage.DIB.Height / 2
End If
Dim igPixelArray As ImGearPixelArray = igPage.DIB.GetAreaCopy(0, 0, transposeSize - 1, transposeSize - 1)
'Transpose the pixels in igPixelArray
Dim channelData, transposePosition1, transposePosition2 As Integer
For row As Integer = 1 To transposeSize - 1
    For column As Integer = 0 To row - 1
        transposePosition1 = (row * transposeSize) + column
        transposePosition2 = (column * transposeSize) + row
        For channel As Integer = 0 To igPixelArray.ChannelCount - 1
            channelData = igPixelArray(transposePosition1, channel)
            igPixelArray(transposePosition1, channel) = igPixelArray(transposePosition2, channel)
            igPixelArray(transposePosition2, channel) = channelData
        Next
    Next
Next
'Update the original image with the transposed array
igPage.DIB.UpdateAreaFrom(0, 0, transposeSize - 1, transposeSize - 1, igPixelArray)
See Also

Reference

ImGearDIB Class
ImGearDIB Members
ImGearPixelArray Class