/**
* Adds a rectangle to the given page content.
*
* @param page the pdf page object
* @param rect the PDF coordinates of the rectangle to be drawn.
* @param fillColor the rectangle fill color
*/
public static void drawRect(Page page, float[] rect, int fillColor) {
PageContent content = new PageContent();
content.Create();
content.GSSave();
// draw a rectangle
Path path = new Path();
path.MoveTo(rect[0], rect[1]);
path.LineTo(rect[2], rect[1]);
path.LineTo(rect[2], rect[3]);
path.LineTo(rect[0], rect[3]);
path.ClosePath();
//fill it
content.SetFillColor(fillColor);
content.FillPath(path, true);//using winding fill rule
content.GSRestore();
//destroy the path
path.Destroy();
//add content to page
page.AddContent(content, true);
content.Destroy();
}
RadaeePDF SDK for Android, RadaeePDF Master SDK
Created : 2020-10-01 10:18:10, Last Modified : 2021-05-27 13:37:31