Sets the Alpha channel of a GdPicture image.
public GdPictureStatus SetAlphaChannel( int ImageID, ref Byte arPixels, int SrcLeft, int SrcTop, int Width, int Height );
Public Function SetAlphaChannel( ByVal ImageID As Integer, ByRef arPixels() As Byte, ByVal SrcLeft As Integer, ByVal SrcTop As Integer, ByVal Width As Integer, ByVal Height As Integer ) As GdPictureStatus
|
Parameters |
Description |
|
ImageID |
GdPicture Image Identifier. |
|
arPixels |
Array of alpha components. |
|
SrcLeft |
The left source pixel of the area. |
|
SrcTop |
The top source pixel of the area. |
|
Width |
The width of the area in pixel. |
|
Height |
The height of the area in pixel. |
A member of the GdPictureStatus enumeration.
Applying a vertical transparent gradient to an image
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim Alpha() As Byte Dim PixelCount As Integer Dim oGdPictureImaging As New GdPictureImaging Dim ImageID As Integer Dim ImageHeight As Integer Dim ImageWidth As Integer oGdPictureImaging.SetLicenseNumber("XXXX") 'Please, replace XXXX by a valid demo or commercial license key. 'Go to http://evaluation-gdpicture.com to get a 1 month trial key unlocking all features of the toolkit. ImageID = oGdPictureImaging.CreateGdPictureImageFromFile("") ImageHeight = oGdPictureImaging.GetHeight(ImageID) ImageWidth = oGdPictureImaging.GetWidth(ImageID) PixelCount = ImageHeight * ImageWidth ReDim Alpha(PixelCount) For i As Integer = 0 To PixelCount - 1 Alpha(i) = CByte(255 / PixelCount * (i + 1)) Next oGdPictureImaging.SetAlphaChannel(ImageID, Alpha, 0, 0, ImageWidth, ImageHeight) oGdPictureImaging.SaveAsPNG(ImageID, "c:test.png") oGdPictureImaging.ReleaseGdPictureImage(ImageID) End Sub
|
What do you think about this topic? Send feedback!
|
|
Copyright (c) 2009-2011 www.gdpicture.com. All rights reserved.
|