Dim status As GdPictureStatus = GdPictureStatus.OK
Using image As GdPictureImaging = New GdPictureImaging()
Dim imageID As Integer = image.CreateNewGdPictureImage(1000, 1600, CShort(32), Color.White)
status = image.GetStat()
If (status = GdPictureStatus.OK) AndAlso (imageID <> 0) Then
Using annotMgr As AnnotationManager = New AnnotationManager()
If (annotMgr.InitFromGdPictureImage(imageID) = GdPictureStatus.OK) AndAlso
(annotMgr.SelectPage(1) = GdPictureStatus.OK) Then
Dim px As Single = 2, py As Single = 1, dx As Single = 0.25F, dy As Single = 0.25F
Dim annotText As GdPicture14.Annotations.AnnotationText = annotMgr.AddTextAnnot(px, py, 2, 2, "GdPicture")
If (annotMgr.GetStat() = GdPictureStatus.OK) AndAlso (annotText IsNot Nothing) Then
annotText.FontSize = 20
End If
annotText.Dispose()
If (annotMgr.SaveAnnotationsToPage() <> GdPictureStatus.OK) OrElse
(annotMgr.BurnAnnotationsToPage(True) <> GdPictureStatus.OK) Then
GoTo with_error
End If
Dim points As PointF() = New PointF(6) {New PointF(px, py), New PointF(px + dx, py + dy), New PointF(px + 2 * dx, py),
New PointF(px + 3 * dx, py + dy), New PointF(px + 4 * dx, py),
New PointF(px + 5 * dx, py + dy), New PointF(px + 6 * dx, py)}
Dim annot As GdPicture14.Annotations.AnnotationFreeHandHighlighter = annotMgr.AddFreeHandHighlighterAnnot(Color.GreenYellow, points)
If (annotMgr.GetStat() = GdPictureStatus.OK) AndAlso (annot IsNot Nothing) Then
annot.Author = "GdPicture"
annot.BorderWidth = 0.1F
End If
annot.Dispose()
If annotMgr.SaveAnnotationsToPage() = GdPictureStatus.OK Then
annotMgr.SaveDocumentToJPEG("freehandhighlighter.jpeg", 75)
End If
End If
with_error:
status = annotMgr.GetStat()
annotMgr.Close()
End Using
image.ReleaseGdPictureImage(imageID)
End If
End Using
'We assume that the GdViewer1 control has been integrated into your application.
If status = GdPictureStatus.OK Then
GdViewer1.DisplayFromFile("freehandhighlighter.jpeg")
Else
MessageBox.Show("Error! Status: " + status.ToString(), "AnnotationManager.AddFreeHandHighlighterAnnot")
End If
GdPictureStatus status = GdPictureStatus.OK;
using (GdPictureImaging image = new GdPictureImaging())
{
int imageID = image.CreateNewGdPictureImage(1000, 1600, 32, Color.White);
status = image.GetStat();
if ((status == GdPictureStatus.OK) && (imageID != 0))
{
using (AnnotationManager annotMgr = new AnnotationManager())
{
if ((annotMgr.InitFromGdPictureImage(imageID) == GdPictureStatus.OK) &&
(annotMgr.SelectPage(1) == GdPictureStatus.OK))
{
float px = 2, py = 1, dx = 0.25f, dy = 0.25f;
GdPicture14.Annotations.AnnotationText annotText = annotMgr.AddTextAnnot(px, py, 2, 2, "GdPicture");
if ((annotMgr.GetStat() == GdPictureStatus.OK) && (annotText != null))
{
annotText.FontSize = 20;
}
annotText.Dispose();
if ((annotMgr.SaveAnnotationsToPage() != GdPictureStatus.OK) ||
(annotMgr.BurnAnnotationsToPage(true) != GdPictureStatus.OK))
{
goto with_error;
}
PointF[] points = new PointF[7] { new PointF(px, py), new PointF(px+dx, py+dy), new PointF(px+2*dx, py),
new PointF(px+3*dx, py+dy), new PointF(px+4*dx, py),
new PointF(px+5*dx, py+dy), new PointF(px+6*dx, py)};
GdPicture14.Annotations.AnnotationFreeHandHighlighter annot = annotMgr.AddFreeHandHighlighterAnnot(Color.GreenYellow, points);
if ((annotMgr.GetStat() == GdPictureStatus.OK) && (annot != null))
{
annot.Author = "GdPicture";
annot.BorderWidth = 0.1f;
}
annot.Dispose();
if (annotMgr.SaveAnnotationsToPage() == GdPictureStatus.OK)
annotMgr.SaveDocumentToJPEG("freehandhighlighter.jpeg", 75);
}
with_error:
status = annotMgr.GetStat();
annotMgr.Close();
}
image.ReleaseGdPictureImage(imageID);
}
}
//We assume that the GdViewer1 control has been integrated into your application.
if (status == GdPictureStatus.OK)
GdViewer1.DisplayFromFile("freehandhighlighter.jpeg");
else
MessageBox.Show("Error! Status: " + status.ToString(), "AnnotationManager.AddFreeHandHighlighterAnnot");