PixMap SetAlpha Function. Sets a constant alpha value (0-255) for this image. ABCpdf .NET PDF Library.

ABCpdf .net

 
   

Sets a constant alpha value (0-255) for this image.

 

   
Syntax  

[C#]
void SetAlpha(double alpha)

[Visual Basic]
Sub SetAlpha(alpha As Double)

 

   

Params
 
Name Description
alpha A constant alpha value to assign to this image.

 

   

Notes
 

Assigns a constant alpha transparency to the PixMap.

The alpha value should range from 0 (fully transparent) to 255 (fully opaque). Any values outside this range will result in the alpha channel being removed.

 

   

Example
 

Here we add an image without transparency and then, at a position down and to the right, with 50% transparency.

[C#]
Doc theDoc = new Doc();
theDoc.Rect.Pin = XRect.Corner.TopLeft;
theDoc.Rect.Magnify(0.5, 0.5);
string thePath = Server.MapPath("../mypics/mypic.tif");
theDoc.AddImageFile(thePath, 1);
theDoc.Rect.Move(theDoc.Rect.Width, -theDoc.Rect.Height);
int i = theDoc.AddImageFile(thePath, 1);
ImageLayer im = (ImageLayer)theDoc.ObjectSoup[i];
im.PixMap.SetAlpha(128);
theDoc.Save(Server.MapPath("pixmapsetalpha.pdf"));
theDoc.Clear();

[Visual Basic]
Dim theDoc As Doc = New Doc()
theDoc.Rect.Pin = XRect.Corner.TopLeft
theDoc.Rect.Magnify(0.5, 0.5)
Dim thePath As String = Server.MapPath("../mypics/mypic.tif")
theDoc.AddImageFile(thePath, 1)
theDoc.Rect.Move(theDoc.Rect.Width, -theDoc.Rect.Height)
Dim i As Integer = theDoc.AddImageFile(thePath,1)
Dim im As ImageLayer = CType(theDoc.ObjectSoup(i), ImageLayer)
im.PixMap.SetAlpha(128)
theDoc.Save(Server.MapPath("pixmapsetalpha.pdf"))
theDoc.Clear()


pixmapsetalpha.pdf