// Created with MonoDevelop
//
//    Copyright (C) 2021 Hiperscan GmbH Dresden, Germany
//
//    This program is free software: you can redistribute it and/or modify
//    it under the terms of the GNU General Public License as published by
//    the Free Software Foundation, either version 3 of the License, or
//    (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful,
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//    GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License
//    along with this program.  If not, see <http://www.gnu.org/licenses/>.



using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using Hiperscan.Unix;
using PDFjet.NET;


namespace Hiperscan.PdfLib
{
    public partial class Layout
    {
        #region Circle
        public bool AddCircle(PdfPoint center, double radius, double line_width, int line_color, int fill_color, bool ignore_coordinates)
        {
            if (ignore_coordinates == false)
            {
                double upper_left_x = center.X - radius;
                double upper_left_y = center.Y - radius;

                double lower_right_x = center.X + radius;
                double lower_right_y = center.Y + radius;

                bool can_draw = this.CheckCoordinates(upper_left_x, upper_left_y);
                if (can_draw == false)
                    return false;
                can_draw = this.CheckCoordinates(lower_right_x, lower_right_y);
                if (can_draw == false)
                    return false;
            }


            PDFjet.NET.Point point = null;
            point = new Point(center.X + this.LeftMargin, center.Y + UpperMargin);
            point.SetRadius(radius);
            point.SetFillShape(true);
            point.SetColor(fill_color);
            point.SetLineWidth(0);
            if (this.SimulateDrawing == false)
                point.DrawOn(this.CurrentPage);

            if (line_width > 0)
            {
                point = new Point(center.X + this.LeftMargin, center.Y + UpperMargin);
                point.SetRadius(radius - line_width / 2);
                point.SetFillShape(false);
                point.SetColor(line_color);
                point.SetLineWidth(line_width);
                if (this.SimulateDrawing == false)
                    point.DrawOn(this.CurrentPage);
            }
            return true;
        }
        #endregion circle
    }
}
