Example #1
0
#pragma warning restore IDE0032 // Use auto property
#pragma warning restore IDE0044 // Add readonly modifier

        /// <summary>
        /// Initializes a new instance of the <see cref="DrawEventArgs"/> class with the specified event data.
        /// </summary>
        /// <param name="context">The drawing context.</param>
        /// <param name="clip">The rectangle that has been requested to be redrawn.</param>
        /// <param name="surfaceSize">The current size of the surface.</param>
        public DrawEventArgs(Context context, RectangleD clip, SizeD surfaceSize)
        {
            this.context  = context;
            contextPtr    = this.context.Surface.Handle;
            surfaceWidth  = surfaceSize.Width;
            surfaceHeight = surfaceSize.Height;
            clipX         = clip.X;
            clipY         = clip.Y;
            clipWidth     = clip.Width;
            clipHeight    = clip.Height;
        }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DrawEventArgs"/> class with the specified event data.
 /// </summary>
 /// <param name="context">The drawing context.</param>
 /// <param name="clip">The rectangle that has been requested to be redrawn.</param>
 /// <param name="surfaceSize">The current size of the surface.</param>
 public DrawEventArgs(Context context, RectangleD clip, SizeD surfaceSize)
 {
     Context          = context;
     uiAreaDrawParams = new Libui.uiAreaDrawParams()
     {
         Context    = Context.Surface.Handle,
         AreaWidth  = surfaceSize.Width,
         AreaHeight = surfaceSize.Height,
         ClipX      = clip.X,
         ClipY      = clip.Y,
         ClipWidth  = clip.Width,
         ClipHeight = clip.Height
     };
 }
Example #3
0
 /// <summary>
 /// Converts the specified <see cref="SizeD"/> to a <see cref="Size"/> by truncating the values of the <see cref="SizeD"/>.
 /// </summary>
 /// <param name="val">The <see cref="SizeD"/> to convert.</param>
 /// <returns>The <see cref="Size"/> this converts to.</returns>
 public static Size Truncate(SizeD val) => new Size((int)Math.Truncate(val.Width), (int)Math.Truncate(val.Height));
Example #4
0
 /// <summary>
 /// Converts the specified <see cref="SizeD"/> to a <see cref="Size"/> by rounding the values of the <see cref="SizeD"/> to the next higher integer values.
 /// </summary>
 /// <param name="val">The <see cref="SizeD"/> to convert.</param>
 /// <returns>The <see cref="Size"/> this method converts to.</returns>
 public static Size Ceiling(SizeD val) => new Size((int)Math.Ceiling(val.Width), (int)Math.Ceiling(val.Height));
Example #5
0
 /// <summary>
 /// Converts the specified <see cref="SizeD"/> to a <see cref="Size"/> by rounding the values of the <see cref="SizeD"/> to the nearest integer.
 /// </summary>
 /// <param name="val">The <see cref="SizeD"/> to convert.</param>
 /// <returns>The <see cref="Size"/> this method converts to.</returns>
 public static Size Round(SizeD val) => new Size((int)Math.Round(val.Width), (int)Math.Round(val.Height));
Example #6
0
 public MouseEventArgs(PointD point, SizeD surfaceSize, bool up, bool down, int count, ModifierKey modifiers, long held) : this(point.X, point.Y, surfaceSize.Width, surfaceSize.Height, up, down, count, modifiers, held)
 {
 }
Example #7
0
 /// <summary>
 /// Returns the result of subtracting the specified <see cref="SizeD"/> from the specified <see cref="PointD"/>.
 /// </summary>
 /// <param name="pt">The <see cref="PointD"/> to be subtracted from.</param>
 /// <param name="sz">The <see cref="SizeD"/> to subtract from <paramref name="pt"/>.</param>
 public static PointD Subtract(PointD pt, SizeD sz) => new PointD(pt.X - sz.Width, pt.Y - sz.Height);
Example #8
0
 /// <summary>
 /// Adds the specified <see cref="SizeD"/> to the specified <see cref="PointD"/>.
 /// </summary>
 /// <param name="pt">The <see cref="PointD"/> to add.</param>
 /// <param name="sz">The <see cref="SizeD"/> to add.</param>
 /// <returns>The <see cref="PointD"/> that is the result of the addition operation.</returns>
 public static PointD Add(PointD pt, SizeD sz) => new PointD(pt.X + sz.Width, pt.Y + sz.Height);
Example #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PointD"/> structure from a <see cref="Size"/>.
 /// </summary>
 /// <param name="sz">A <see cref="Size"/> that specifies the coordinates for the new <see cref="PointD"/>.</param>
 public PointD(SizeD sz) : this(sz.Width, sz.Height)
 {
 }
Example #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RectangleD"/> class with the specified location and size.
 /// </summary>
 /// <param name="location">A <see cref="Point"/> that represents the upper-left corner of the rectangle.</param>
 /// <param name="size">A <see cref="Drawing.Size"/> that represents the width and height of the rectangle.</param>
 public RectangleD(PointD location, SizeD size) : this(location.X, location.Y, size.Width, size.Height)
 {
 }