Changes the pixel values contained into an area of a GdPicture image from an array which contains each each Blue, Green, Red and Alpha components of pixel.
public GdPictureStatus SetPixelArrayByte( int ImageID, ref Byte arPixels, int DstLeft, int DstTop, int Width, int Height );
Public Function SetPixelArrayByte( ByVal ImageID As Integer, ByRef arPixels() As Byte, ByVal DstLeft As Integer, ByVal DstTop As Integer, ByVal Width As Integer, ByVal Height As Integer ) As GdPictureStatus
|
Parameters |
Description |
|
ImageID |
GdPicture Image Identifier. |
|
arPixels |
Array of pixel data. |
|
DstLeft |
The left destination pixel of the area. |
|
DstTop |
The top destination pixel of the area. |
|
Width |
The width of the destination area in pixel. |
|
Height |
The height of the destination area in pixel. |
A member of the GdPictureStatus enumeration.
usage of GetPixelArrayByte() and SetPixelArrayByte() functions to apply negative effect on a GdPicture image
Dim oGdPictureImaging As New GdPictureImaging Dim arPixel() As Byte Dim X As Integer Dim Y As Integer Dim ImageID As Integer Dim ImageHeight As Integer Dim ImageWidth As Integer oGdPictureImaging.SetLicenseNumber("XXX") 'Replace XXX by a demo or commercial license key ImageID = oGdPictureImaging.CreateGdPictureImageFromFile("image.tif") ImageHeight = oGdPictureImaging.GetHeight(ImageID) ImageWidth = oGdPictureImaging.GetWidth(ImageID) ReDim arPixel(ImageWidth * ImageHeight * 4) oGdPictureImaging.GetPixelArrayByte(ImageID, arPixel, 0, 0, ImageWidth, ImageHeight) For X = 0 To ImageWidth - 1 For Y = 0 To ImageHeight - 1 arPixel((Y * 4 * ImageWidth) + X * 4) = Not arPixel((Y * 4 * ImageWidth) + X * 4) 'Blue channel arPixel((Y * 4 * ImageWidth) + X * 4 + 1) = Not arPixel((Y * 4 * ImageWidth) + X * 4 + 1) 'Green channel arPixel((Y * 4 * ImageWidth) + X * 4 + 2) = Not arPixel((Y * 4 * ImageWidth) + X * 4 + 2) 'Red channel arPixel((Y * 4 * ImageWidth) + X * 4 + 3) = 255 'Alpha chanel. Set 255 for full opacity Next Y Next X oGdPictureImaging.SetPixelArrayByte(ImageID, arPixel, 0, 0, ImageWidth, ImageHeight) oGdPictureImaging.SaveAsTIFF(ImageID, "imageneg.tif", TiffCompression.TiffCompressionAUTO) oGdPictureImaging.ReleaseGdPictureImage(ImageID)
|
What do you think about this topic? Send feedback!
|
|
Copyright (c) 2009-2011 www.gdpicture.com. All rights reserved.
|