// RichTextKit
// Copyright © 2019-2020 Topten Software. All Rights Reserved.
// 
// Licensed under the Apache License, Version 2.0 (the "License"); you may 
// not use this product except in compliance with the License. You may obtain 
// a copy of the License at
// 
// http://www.apache.org/licenses/LICENSE-2.0
// 
// Unless required by applicable law or agreed to in writing, software 
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 
// License for the specific language governing permissions and limitations 
// under the License.

using SkiaSharp;
using System;

namespace Topten.RichTextKit
{
	/// <summary>
	/// Options to control how TextBlock is rendered.
	/// </summary>
	public class TextPaintOptions
	{
		/// <summary>
		/// Constructs a new text paint options
		/// </summary>
		public TextPaintOptions()
		{
		}

		/// <summary>
		/// An optional TextRange to painted as selected.
		/// </summary>
		public TextRange? Selection
		{
			get;
			set;
		}

		/// <summary>
		/// The color to be used for the selection background.
		/// </summary>
		public SKColor SelectionColor
		{
			get;
			set;
		}

		/// <summary>
		/// The color to be used for touch screen selection handles
		/// </summary>
		public SKColor SelectionHandleColor
		{
			get;
			set;
		}

		/// <summary>
		/// Scaling of the touch screen selection handles
		/// </summary>
		/// <remarks>
		/// Sets the scaling of the selection handles.  This can be used
		/// to keep the selection handle size consistent even if zooming in
		/// on rendered text.  Set to zero to disable selection handles
		/// </remarks>
		public float SelectionHandleScale
		{
			get;
			set;
		} = 0;

		/// <summary>
		/// Controls how font edges are drawn
		/// </summary>
		public SKFontEdging Edging
		{
			get;
			set;
		} = SKFontEdging.Antialias;

		/// <summary>
		/// Requests text be drawn at sub-pixel offsets
		/// </summary>
		public bool SubpixelPositioning
		{
			get;
			set;
		} = true;

		/// <summary>
		/// Controls the font hint used when rendering text
		/// </summary>
		public SKFontHinting Hinting
		{
			get;
			set;
		} = SKFontHinting.Normal;

		/// <summary>
		/// A gradient used when rendering text
		/// </summary>
		public TextGradient TextGradient
		{
			get;
			set;
		}

		/// <summary>
		/// A default set of paint options that renders text blocks without 
		/// a selection range.
		/// </summary>
		public static TextPaintOptions Default = new TextPaintOptions();
	}
}
