diff options
author | Frederik Carlier <frederik.carlier@quamotion.mobi> | 2017-06-15 12:29:35 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2017-06-15 12:29:35 +0300 |
commit | 3830eca92cc29c125d549a201df87bcf68b190ae (patch) | |
tree | 30a3d4b1f4b58124666b1a8d11a56125539edbbd /mcs/class/System.Drawing | |
parent | aa59a09fd7c168d6c7717cedd6264ce3e847f530 (diff) |
Use Brush classes from CoreFX (#5039)
Diffstat (limited to 'mcs/class/System.Drawing')
17 files changed, 336 insertions, 1040 deletions
diff --git a/mcs/class/System.Drawing/Makefile b/mcs/class/System.Drawing/Makefile index 1e704b38be4..19d734e166c 100644 --- a/mcs/class/System.Drawing/Makefile +++ b/mcs/class/System.Drawing/Makefile @@ -10,6 +10,8 @@ LIB_MCS_FLAGS = /unsafe \ -resource:Assembly/Error.ico,Error.ico -resource:Assembly/Warning.ico,Warning.ico \ -resource:Assembly/Question.ico,Question.ico -resource:Assembly/Shield.ico,Shield.ico +RESX_RESOURCE_STRING = ../../../external/corefx/src/System.Drawing.Common/src/Resources/Strings.resx + ifeq (winaot, $(PROFILE)) LIB_MCS_FLAGS += /keyfile:../msfinal.pub else ifeq (orbis, $(PROFILE)) diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/HatchBrush.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/HatchBrush.cs deleted file mode 100644 index 9c92b91caa5..00000000000 --- a/mcs/class/System.Drawing/System.Drawing.Drawing2D/HatchBrush.cs +++ /dev/null @@ -1,97 +0,0 @@ -// -// System.Drawing.Drawing2D.HatchBrush.cs -// -// Authors: -// Dennis Hayes (dennish@Raytek.com) -// Ravindra (rkumar@novell.com) -// -// (C) 2002/3 Ximian, Inc -// (C) 2004 Novell, Inc. -// - -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -using System; - -namespace System.Drawing.Drawing2D -{ - /// <summary> - /// Summary description for HatchBrush. - /// </summary> - public sealed class HatchBrush : Brush - { - - internal HatchBrush (IntPtr ptr) : base (ptr) - { - } - - public HatchBrush (HatchStyle hatchstyle, Color foreColor) - : this (hatchstyle, foreColor, Color.Black) - { - } - - public HatchBrush(HatchStyle hatchstyle, Color foreColor, Color backColor) - { - Status status = GDIPlus.GdipCreateHatchBrush (hatchstyle, foreColor.ToArgb (), backColor.ToArgb (), out nativeObject); - GDIPlus.CheckStatus (status); - } - - public Color BackgroundColor { - get { - int argb; - Status status = GDIPlus.GdipGetHatchBackgroundColor (nativeObject, out argb); - GDIPlus.CheckStatus (status); - return Color.FromArgb (argb); - } - } - - public Color ForegroundColor { - get { - int argb; - Status status = GDIPlus.GdipGetHatchForegroundColor (nativeObject, out argb); - GDIPlus.CheckStatus (status); - return Color.FromArgb (argb); - } - } - - public HatchStyle HatchStyle { - get { - HatchStyle hatchStyle; - Status status = GDIPlus.GdipGetHatchStyle (nativeObject, out hatchStyle); - GDIPlus.CheckStatus (status); - return hatchStyle; - } - } - - public override object Clone () - { - IntPtr clonePtr; - Status status = GDIPlus.GdipCloneBrush (nativeObject, out clonePtr); - GDIPlus.CheckStatus (status); - - HatchBrush clone = new HatchBrush (clonePtr); - return clone; - } - - } -} diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/LinearGradientBrush.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/LinearGradientBrush.cs index aa8fcf55e0b..3b006fd5c96 100644 --- a/mcs/class/System.Drawing/System.Drawing.Drawing2D/LinearGradientBrush.cs +++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/LinearGradientBrush.cs @@ -36,16 +36,19 @@ namespace System.Drawing.Drawing2D { { RectangleF rectangle; - internal LinearGradientBrush (IntPtr native) : base (native) + internal LinearGradientBrush (IntPtr native) { Status status = GDIPlus.GdipGetLineRect (native, out rectangle); + SetNativeBrush (native); GDIPlus.CheckStatus (status); } public LinearGradientBrush (Point point1, Point point2, Color color1, Color color2) { + IntPtr nativeObject; Status status = GDIPlus.GdipCreateLineBrushI (ref point1, ref point2, color1.ToArgb (), color2.ToArgb (), WrapMode.Tile, out nativeObject); GDIPlus.CheckStatus (status); + SetNativeBrush (nativeObject); status = GDIPlus.GdipGetLineRect (nativeObject, out rectangle); GDIPlus.CheckStatus (status); @@ -53,8 +56,10 @@ namespace System.Drawing.Drawing2D { public LinearGradientBrush (PointF point1, PointF point2, Color color1, Color color2) { + IntPtr nativeObject; Status status = GDIPlus.GdipCreateLineBrush (ref point1, ref point2, color1.ToArgb (), color2.ToArgb (), WrapMode.Tile, out nativeObject); GDIPlus.CheckStatus (status); + SetNativeBrush (nativeObject); status = GDIPlus.GdipGetLineRect (nativeObject, out rectangle); GDIPlus.CheckStatus (status); @@ -62,8 +67,10 @@ namespace System.Drawing.Drawing2D { public LinearGradientBrush (Rectangle rect, Color color1, Color color2, LinearGradientMode linearGradientMode) { + IntPtr nativeObject; Status status = GDIPlus.GdipCreateLineBrushFromRectI (ref rect, color1.ToArgb (), color2.ToArgb (), linearGradientMode, WrapMode.Tile, out nativeObject); GDIPlus.CheckStatus (status); + SetNativeBrush (nativeObject); rectangle = (RectangleF) rect; } @@ -74,8 +81,10 @@ namespace System.Drawing.Drawing2D { public LinearGradientBrush (RectangleF rect, Color color1, Color color2, LinearGradientMode linearGradientMode) { + IntPtr nativeObject; Status status = GDIPlus.GdipCreateLineBrushFromRect (ref rect, color1.ToArgb (), color2.ToArgb (), linearGradientMode, WrapMode.Tile, out nativeObject); GDIPlus.CheckStatus (status); + SetNativeBrush (nativeObject); rectangle = rect; } @@ -86,16 +95,20 @@ namespace System.Drawing.Drawing2D { public LinearGradientBrush (Rectangle rect, Color color1, Color color2, float angle, bool isAngleScaleable) { + IntPtr nativeObject; Status status = GDIPlus.GdipCreateLineBrushFromRectWithAngleI (ref rect, color1.ToArgb (), color2.ToArgb (), angle, isAngleScaleable, WrapMode.Tile, out nativeObject); GDIPlus.CheckStatus (status); + SetNativeBrush (nativeObject); rectangle = (RectangleF) rect; } public LinearGradientBrush (RectangleF rect, Color color1, Color color2, float angle, bool isAngleScaleable) { + IntPtr nativeObject; Status status = GDIPlus.GdipCreateLineBrushFromRectWithAngle (ref rect, color1.ToArgb (), color2.ToArgb (), angle, isAngleScaleable, WrapMode.Tile, out nativeObject); GDIPlus.CheckStatus (status); + SetNativeBrush (nativeObject); rectangle = rect; } @@ -105,11 +118,11 @@ namespace System.Drawing.Drawing2D { public Blend Blend { get { int count; - Status status = GDIPlus.GdipGetLineBlendCount (nativeObject, out count); + Status status = GDIPlus.GdipGetLineBlendCount (NativeBrush, out count); GDIPlus.CheckStatus (status); float [] factors = new float [count]; float [] positions = new float [count]; - status = GDIPlus.GdipGetLineBlend (nativeObject, factors, positions, count); + status = GDIPlus.GdipGetLineBlend (NativeBrush, factors, positions, count); GDIPlus.CheckStatus (status); Blend blend = new Blend (); @@ -137,7 +150,7 @@ namespace System.Drawing.Drawing2D { if (positions [count - 1] != 1.0F) throw new ArgumentException ("Invalid Blend object. The positions array must have 1.0 as its last element."); - Status status = GDIPlus.GdipSetLineBlend (nativeObject, factors, positions, count); + Status status = GDIPlus.GdipSetLineBlend (NativeBrush, factors, positions, count); GDIPlus.CheckStatus (status); } } @@ -146,12 +159,12 @@ namespace System.Drawing.Drawing2D { public bool GammaCorrection { get { bool gammaCorrection; - Status status = GDIPlus.GdipGetLineGammaCorrection (nativeObject, out gammaCorrection); + Status status = GDIPlus.GdipGetLineGammaCorrection (NativeBrush, out gammaCorrection); GDIPlus.CheckStatus (status); return gammaCorrection; } set { - Status status = GDIPlus.GdipSetLineGammaCorrection (nativeObject, value); + Status status = GDIPlus.GdipSetLineGammaCorrection (NativeBrush, value); GDIPlus.CheckStatus (status); } } @@ -159,11 +172,11 @@ namespace System.Drawing.Drawing2D { public ColorBlend InterpolationColors { get { int count; - Status status = GDIPlus.GdipGetLinePresetBlendCount (nativeObject, out count); + Status status = GDIPlus.GdipGetLinePresetBlendCount (NativeBrush, out count); GDIPlus.CheckStatus (status); int [] intcolors = new int [count]; float [] positions = new float [count]; - status = GDIPlus.GdipGetLinePresetBlend (nativeObject, intcolors, positions, count); + status = GDIPlus.GdipGetLinePresetBlend (NativeBrush, intcolors, positions, count); GDIPlus.CheckStatus (status); ColorBlend interpolationColors = new ColorBlend (); @@ -199,7 +212,7 @@ namespace System.Drawing.Drawing2D { for (int i = 0; i < colors.Length; i++) blend [i] = colors [i].ToArgb (); - Status status = GDIPlus.GdipSetLinePresetBlend (nativeObject, blend, positions, count); + Status status = GDIPlus.GdipSetLinePresetBlend (NativeBrush, blend, positions, count); GDIPlus.CheckStatus (status); } } @@ -207,7 +220,7 @@ namespace System.Drawing.Drawing2D { public Color [] LinearColors { get { int [] colors = new int [2]; - Status status = GDIPlus.GdipGetLineColors (nativeObject, colors); + Status status = GDIPlus.GdipGetLineColors (NativeBrush, colors); GDIPlus.CheckStatus (status); Color [] linearColors = new Color [2]; linearColors [0] = Color.FromArgb (colors [0]); @@ -217,7 +230,7 @@ namespace System.Drawing.Drawing2D { } set { // no null check, MS throws a NullReferenceException here - Status status = GDIPlus.GdipSetLineColors (nativeObject, value [0].ToArgb (), value [1].ToArgb ()); + Status status = GDIPlus.GdipSetLineColors (NativeBrush, value [0].ToArgb (), value [1].ToArgb ()); GDIPlus.CheckStatus (status); } } @@ -231,7 +244,7 @@ namespace System.Drawing.Drawing2D { public Matrix Transform { get { Matrix matrix = new Matrix (); - Status status = GDIPlus.GdipGetLineTransform (nativeObject, matrix.nativeMatrix); + Status status = GDIPlus.GdipGetLineTransform (NativeBrush, matrix.nativeMatrix); GDIPlus.CheckStatus (status); return matrix; @@ -240,7 +253,7 @@ namespace System.Drawing.Drawing2D { if (value == null) throw new ArgumentNullException ("Transform"); - Status status = GDIPlus.GdipSetLineTransform (nativeObject, value.nativeMatrix); + Status status = GDIPlus.GdipSetLineTransform (NativeBrush, value.nativeMatrix); GDIPlus.CheckStatus (status); } } @@ -248,7 +261,7 @@ namespace System.Drawing.Drawing2D { public WrapMode WrapMode { get { WrapMode wrapMode; - Status status = GDIPlus.GdipGetLineWrapMode (nativeObject, out wrapMode); + Status status = GDIPlus.GdipGetLineWrapMode (NativeBrush, out wrapMode); GDIPlus.CheckStatus (status); return wrapMode; @@ -258,7 +271,7 @@ namespace System.Drawing.Drawing2D { if ((value < WrapMode.Tile) || (value > WrapMode.Clamp)) throw new InvalidEnumArgumentException ("WrapMode"); - Status status = GDIPlus.GdipSetLineWrapMode (nativeObject, value); + Status status = GDIPlus.GdipSetLineWrapMode (NativeBrush, value); GDIPlus.CheckStatus (status); } } @@ -275,13 +288,13 @@ namespace System.Drawing.Drawing2D { if (matrix == null) throw new ArgumentNullException ("matrix"); - Status status = GDIPlus.GdipMultiplyLineTransform (nativeObject, matrix.nativeMatrix, order); + Status status = GDIPlus.GdipMultiplyLineTransform (NativeBrush, matrix.nativeMatrix, order); GDIPlus.CheckStatus (status); } public void ResetTransform () { - Status status = GDIPlus.GdipResetLineTransform (nativeObject); + Status status = GDIPlus.GdipResetLineTransform (NativeBrush); GDIPlus.CheckStatus (status); } @@ -292,7 +305,7 @@ namespace System.Drawing.Drawing2D { public void RotateTransform (float angle, MatrixOrder order) { - Status status = GDIPlus.GdipRotateLineTransform (nativeObject, angle, order); + Status status = GDIPlus.GdipRotateLineTransform (NativeBrush, angle, order); GDIPlus.CheckStatus (status); } @@ -303,7 +316,7 @@ namespace System.Drawing.Drawing2D { public void ScaleTransform (float sx, float sy, MatrixOrder order) { - Status status = GDIPlus.GdipScaleLineTransform (nativeObject, sx, sy, order); + Status status = GDIPlus.GdipScaleLineTransform (NativeBrush, sx, sy, order); GDIPlus.CheckStatus (status); } @@ -317,7 +330,7 @@ namespace System.Drawing.Drawing2D { if (focus < 0 || focus > 1 || scale < 0 || scale > 1) throw new ArgumentException ("Invalid parameter passed."); - Status status = GDIPlus.GdipSetLineLinearBlend (nativeObject, focus, scale); + Status status = GDIPlus.GdipSetLineLinearBlend (NativeBrush, focus, scale); GDIPlus.CheckStatus (status); } @@ -331,7 +344,7 @@ namespace System.Drawing.Drawing2D { if (focus < 0 || focus > 1 || scale < 0 || scale > 1) throw new ArgumentException ("Invalid parameter passed."); - Status status = GDIPlus.GdipSetLineSigmaBlend (nativeObject, focus, scale); + Status status = GDIPlus.GdipSetLineSigmaBlend (NativeBrush, focus, scale); GDIPlus.CheckStatus (status); } @@ -342,14 +355,14 @@ namespace System.Drawing.Drawing2D { public void TranslateTransform (float dx, float dy, MatrixOrder order) { - Status status = GDIPlus.GdipTranslateLineTransform (nativeObject, dx, dy, order); + Status status = GDIPlus.GdipTranslateLineTransform (NativeBrush, dx, dy, order); GDIPlus.CheckStatus (status); } public override object Clone () { IntPtr clonePtr; - Status status = GDIPlus.GdipCloneBrush (nativeObject, out clonePtr); + Status status = GDIPlus.GdipCloneBrush (NativeBrush, out clonePtr); GDIPlus.CheckStatus (status); return new LinearGradientBrush (clonePtr); diff --git a/mcs/class/System.Drawing/System.Drawing.Drawing2D/PathGradientBrush.cs b/mcs/class/System.Drawing/System.Drawing.Drawing2D/PathGradientBrush.cs index 72aa010af3a..98df40bc60d 100644 --- a/mcs/class/System.Drawing/System.Drawing.Drawing2D/PathGradientBrush.cs +++ b/mcs/class/System.Drawing/System.Drawing.Drawing2D/PathGradientBrush.cs @@ -36,8 +36,9 @@ namespace System.Drawing.Drawing2D { [MonoTODO ("libgdiplus/cairo doesn't support path gradients - unless it can be mapped to a radial gradient")] public sealed class PathGradientBrush : Brush { - internal PathGradientBrush (IntPtr native) : base (native) + internal PathGradientBrush (IntPtr native) { + SetNativeBrush (native); } public PathGradientBrush (GraphicsPath path) @@ -45,8 +46,10 @@ namespace System.Drawing.Drawing2D { if (path == null) throw new ArgumentNullException ("path"); + IntPtr nativeObject; Status status = GDIPlus.GdipCreatePathGradientFromPath (path.NativeObject, out nativeObject); GDIPlus.CheckStatus (status); + SetNativeBrush (nativeObject); } public PathGradientBrush (Point [] points) : this (points, WrapMode.Clamp) @@ -64,8 +67,10 @@ namespace System.Drawing.Drawing2D { if ((wrapMode < WrapMode.Tile) || (wrapMode > WrapMode.Clamp)) throw new InvalidEnumArgumentException ("WrapMode"); + IntPtr nativeObject; Status status = GDIPlus.GdipCreatePathGradientI (points, points.Length, wrapMode, out nativeObject); GDIPlus.CheckStatus (status); + SetNativeBrush (nativeObject); } public PathGradientBrush (PointF [] points, WrapMode wrapMode) @@ -75,8 +80,10 @@ namespace System.Drawing.Drawing2D { if ((wrapMode < WrapMode.Tile) || (wrapMode > WrapMode.Clamp)) throw new InvalidEnumArgumentException ("WrapMode"); + IntPtr nativeObject; Status status = GDIPlus.GdipCreatePathGradient (points, points.Length, wrapMode, out nativeObject); GDIPlus.CheckStatus (status); + SetNativeBrush (nativeObject); } // Properties @@ -84,11 +91,11 @@ namespace System.Drawing.Drawing2D { public Blend Blend { get { int count; - Status status = GDIPlus.GdipGetPathGradientBlendCount (nativeObject, out count); + Status status = GDIPlus.GdipGetPathGradientBlendCount (NativeBrush, out count); GDIPlus.CheckStatus (status); float [] factors = new float [count]; float [] positions = new float [count]; - status = GDIPlus.GdipGetPathGradientBlend (nativeObject, factors, positions, count); + status = GDIPlus.GdipGetPathGradientBlend (NativeBrush, factors, positions, count); GDIPlus.CheckStatus (status); Blend blend = new Blend (); @@ -116,7 +123,7 @@ namespace System.Drawing.Drawing2D { if (positions [count - 1] != 1.0F) throw new ArgumentException ("Invalid Blend object. The positions array must have 1.0 as its last element."); - Status status = GDIPlus.GdipSetPathGradientBlend (nativeObject, factors, positions, count); + Status status = GDIPlus.GdipSetPathGradientBlend (NativeBrush, factors, positions, count); GDIPlus.CheckStatus (status); } } @@ -124,12 +131,12 @@ namespace System.Drawing.Drawing2D { public Color CenterColor { get { int centerColor; - Status status = GDIPlus.GdipGetPathGradientCenterColor (nativeObject, out centerColor); + Status status = GDIPlus.GdipGetPathGradientCenterColor (NativeBrush, out centerColor); GDIPlus.CheckStatus (status); return Color.FromArgb (centerColor); } set { - Status status = GDIPlus.GdipSetPathGradientCenterColor (nativeObject, value.ToArgb ()); + Status status = GDIPlus.GdipSetPathGradientCenterColor (NativeBrush, value.ToArgb ()); GDIPlus.CheckStatus (status); } } @@ -137,14 +144,14 @@ namespace System.Drawing.Drawing2D { public PointF CenterPoint { get { PointF center; - Status status = GDIPlus.GdipGetPathGradientCenterPoint (nativeObject, out center); + Status status = GDIPlus.GdipGetPathGradientCenterPoint (NativeBrush, out center); GDIPlus.CheckStatus (status); return center; } set { PointF center = value; - Status status = GDIPlus.GdipSetPathGradientCenterPoint (nativeObject, ref center); + Status status = GDIPlus.GdipSetPathGradientCenterPoint (NativeBrush, ref center); GDIPlus.CheckStatus (status); } } @@ -153,13 +160,13 @@ namespace System.Drawing.Drawing2D { get { float xScale; float yScale; - Status status = GDIPlus.GdipGetPathGradientFocusScales (nativeObject, out xScale, out yScale); + Status status = GDIPlus.GdipGetPathGradientFocusScales (NativeBrush, out xScale, out yScale); GDIPlus.CheckStatus (status); return new PointF (xScale, yScale); } set { - Status status = GDIPlus.GdipSetPathGradientFocusScales (nativeObject, value.X, value.Y); + Status status = GDIPlus.GdipSetPathGradientFocusScales (NativeBrush, value.X, value.Y); GDIPlus.CheckStatus (status); } } @@ -167,7 +174,7 @@ namespace System.Drawing.Drawing2D { public ColorBlend InterpolationColors { get { int count; - Status status = GDIPlus.GdipGetPathGradientPresetBlendCount (nativeObject, out count); + Status status = GDIPlus.GdipGetPathGradientPresetBlendCount (NativeBrush, out count); GDIPlus.CheckStatus (status); // if no failure, then the "managed" minimum is 1 if (count < 1) @@ -177,7 +184,7 @@ namespace System.Drawing.Drawing2D { float [] positions = new float [count]; // status would fail if we ask points or types with a < 2 count if (count > 1) { - status = GDIPlus.GdipGetPathGradientPresetBlend (nativeObject, intcolors, positions, count); + status = GDIPlus.GdipGetPathGradientPresetBlend (NativeBrush, intcolors, positions, count); GDIPlus.CheckStatus (status); } @@ -213,7 +220,7 @@ namespace System.Drawing.Drawing2D { for (int i = 0; i < colors.Length; i++) blend [i] = colors [i].ToArgb (); - Status status = GDIPlus.GdipSetPathGradientPresetBlend (nativeObject, blend, positions, count); + Status status = GDIPlus.GdipSetPathGradientPresetBlend (NativeBrush, blend, positions, count); GDIPlus.CheckStatus (status); } } @@ -221,7 +228,7 @@ namespace System.Drawing.Drawing2D { public RectangleF Rectangle { get { RectangleF rect; - Status status = GDIPlus.GdipGetPathGradientRect (nativeObject, out rect); + Status status = GDIPlus.GdipGetPathGradientRect (NativeBrush, out rect); GDIPlus.CheckStatus (status); return rect; @@ -231,11 +238,11 @@ namespace System.Drawing.Drawing2D { public Color [] SurroundColors { get { int count; - Status status = GDIPlus.GdipGetPathGradientSurroundColorCount (nativeObject, out count); + Status status = GDIPlus.GdipGetPathGradientSurroundColorCount (NativeBrush, out count); GDIPlus.CheckStatus (status); int [] intcolors = new int [count]; - status = GDIPlus.GdipGetPathGradientSurroundColorsWithCount (nativeObject, intcolors, ref count); + status = GDIPlus.GdipGetPathGradientSurroundColorsWithCount (NativeBrush, intcolors, ref count); GDIPlus.CheckStatus (status); Color [] colors = new Color [count]; @@ -251,7 +258,7 @@ namespace System.Drawing.Drawing2D { for (int i = 0; i < count; i++) colors [i] = value [i].ToArgb (); - Status status = GDIPlus.GdipSetPathGradientSurroundColorsWithCount (nativeObject, colors, ref count); + Status status = GDIPlus.GdipSetPathGradientSurroundColorsWithCount (NativeBrush, colors, ref count); GDIPlus.CheckStatus (status); } } @@ -259,7 +266,7 @@ namespace System.Drawing.Drawing2D { public Matrix Transform { get { Matrix matrix = new Matrix (); - Status status = GDIPlus.GdipGetPathGradientTransform (nativeObject, matrix.nativeMatrix); + Status status = GDIPlus.GdipGetPathGradientTransform (NativeBrush, matrix.nativeMatrix); GDIPlus.CheckStatus (status); return matrix; @@ -268,7 +275,7 @@ namespace System.Drawing.Drawing2D { if (value == null) throw new ArgumentNullException ("Transform"); - Status status = GDIPlus.GdipSetPathGradientTransform (nativeObject, value.nativeMatrix); + Status status = GDIPlus.GdipSetPathGradientTransform (NativeBrush, value.nativeMatrix); GDIPlus.CheckStatus (status); } } @@ -276,7 +283,7 @@ namespace System.Drawing.Drawing2D { public WrapMode WrapMode { get { WrapMode wrapMode; - Status status = GDIPlus.GdipGetPathGradientWrapMode (nativeObject, out wrapMode); + Status status = GDIPlus.GdipGetPathGradientWrapMode (NativeBrush, out wrapMode); GDIPlus.CheckStatus (status); return wrapMode; @@ -285,7 +292,7 @@ namespace System.Drawing.Drawing2D { if ((value < WrapMode.Tile) || (value > WrapMode.Clamp)) throw new InvalidEnumArgumentException ("WrapMode"); - Status status = GDIPlus.GdipSetPathGradientWrapMode (nativeObject, value); + Status status = GDIPlus.GdipSetPathGradientWrapMode (NativeBrush, value); GDIPlus.CheckStatus (status); } } @@ -302,13 +309,13 @@ namespace System.Drawing.Drawing2D { if (matrix == null) throw new ArgumentNullException ("matrix"); - Status status = GDIPlus.GdipMultiplyPathGradientTransform (nativeObject, matrix.nativeMatrix, order); + Status status = GDIPlus.GdipMultiplyPathGradientTransform (NativeBrush, matrix.nativeMatrix, order); GDIPlus.CheckStatus (status); } public void ResetTransform () { - Status status = GDIPlus.GdipResetPathGradientTransform (nativeObject); + Status status = GDIPlus.GdipResetPathGradientTransform (NativeBrush); GDIPlus.CheckStatus (status); } @@ -319,7 +326,7 @@ namespace System.Drawing.Drawing2D { public void RotateTransform (float angle, MatrixOrder order) { - Status status = GDIPlus.GdipRotatePathGradientTransform (nativeObject, angle, order); + Status status = GDIPlus.GdipRotatePathGradientTransform (NativeBrush, angle, order); GDIPlus.CheckStatus (status); } @@ -330,7 +337,7 @@ namespace System.Drawing.Drawing2D { public void ScaleTransform (float sx, float sy, MatrixOrder order) { - Status status = GDIPlus.GdipScalePathGradientTransform (nativeObject, sx, sy, order); + Status status = GDIPlus.GdipScalePathGradientTransform (NativeBrush, sx, sy, order); GDIPlus.CheckStatus (status); } @@ -344,7 +351,7 @@ namespace System.Drawing.Drawing2D { if (focus < 0 || focus > 1 || scale < 0 || scale > 1) throw new ArgumentException ("Invalid parameter passed."); - Status status = GDIPlus.GdipSetPathGradientLinearBlend (nativeObject, focus, scale); + Status status = GDIPlus.GdipSetPathGradientLinearBlend (NativeBrush, focus, scale); GDIPlus.CheckStatus (status); } @@ -358,7 +365,7 @@ namespace System.Drawing.Drawing2D { if (focus < 0 || focus > 1 || scale < 0 || scale > 1) throw new ArgumentException ("Invalid parameter passed."); - Status status = GDIPlus.GdipSetPathGradientSigmaBlend (nativeObject, focus, scale); + Status status = GDIPlus.GdipSetPathGradientSigmaBlend (NativeBrush, focus, scale); GDIPlus.CheckStatus (status); } @@ -369,14 +376,14 @@ namespace System.Drawing.Drawing2D { public void TranslateTransform (float dx, float dy, MatrixOrder order) { - Status status = GDIPlus.GdipTranslatePathGradientTransform (nativeObject, dx, dy, order); + Status status = GDIPlus.GdipTranslatePathGradientTransform (NativeBrush, dx, dy, order); GDIPlus.CheckStatus (status); } public override object Clone () { IntPtr clonePtr; - Status status = GDIPlus.GdipCloneBrush (nativeObject, out clonePtr); + Status status = GDIPlus.GdipCloneBrush (NativeBrush, out clonePtr); GDIPlus.CheckStatus (status); PathGradientBrush clone = new PathGradientBrush (clonePtr); diff --git a/mcs/class/System.Drawing/System.Drawing.Imaging/ImageAttributes.cs b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageAttributes.cs index dbbf98d5fa1..a4938a7be01 100644 --- a/mcs/class/System.Drawing/System.Drawing.Imaging/ImageAttributes.cs +++ b/mcs/class/System.Drawing/System.Drawing.Imaging/ImageAttributes.cs @@ -45,6 +45,13 @@ namespace System.Drawing.Imaging { return nativeImageAttr; } } + + // For compatibility with CoreFX sources + internal IntPtr nativeImageAttributes { + get { + return nativeImageAttr; + } + } internal ImageAttributes (IntPtr native) { diff --git a/mcs/class/System.Drawing/System.Drawing.dll.sources b/mcs/class/System.Drawing/System.Drawing.dll.sources index 398431a7cb4..ae98c3a9370 100755 --- a/mcs/class/System.Drawing/System.Drawing.dll.sources +++ b/mcs/class/System.Drawing/System.Drawing.dll.sources @@ -1,10 +1,22 @@ +corefx/SR.cs +System.Drawing/SR.cs Assembly/AssemblyInfo.cs ../../build/common/Consts.cs ../../build/common/Locale.cs +../../../external/corefx/src/System.Drawing.Common/src/misc/ClientUtils.cs +../../../external/corefx/src/System.Drawing.Common/src/misc/HandleCollector.cs +../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Gdiplus.cs +../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/NativeMethods.cs +../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/UnsafeNativeMethods.cs +../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Internal/GPPOINT.cs +../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Internal/GPPOINTF.cs +../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Internal/GPRECT.cs +../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Internal/GPRECTF.cs +../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Internal/ISystemEventTracker.cs System.Drawing/Bitmap.cs ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/BitmapSuffixInSameAssemblyAttribute.cs ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/BitmapSuffixInSatelliteAssemblyAttribute.cs -System.Drawing/Brush.cs +../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Brush.cs System.Drawing/Brushes.cs System.Drawing/BufferedGraphics.cs System.Drawing/BufferedGraphicsManager.cs @@ -18,6 +30,7 @@ System.Drawing/ComIStreamMarshaler.cs System.Drawing/ComIStreamWrapper.cs System.Drawing/ContentAlignment.cs System.Drawing/CopyPixelOperation.cs +System.Drawing/ExternDll.cs System.Drawing/Font.cs System.Drawing/FontConverter.cs System.Drawing/FontFamily.cs @@ -50,7 +63,7 @@ System.Drawing/SizeConverter.cs System.Drawing/Size.cs System.Drawing/SizeF.cs System.Drawing/SizeFConverter.cs -System.Drawing/SolidBrush.cs +../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/SolidBrush.cs System.Drawing/SRDescriptionAttribute.cs ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/StringAlignment.cs ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/StringDigitSubstitute.cs @@ -58,12 +71,12 @@ System.Drawing/StringFormat.cs ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/StringFormatFlags.cs ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/StringTrimming.cs ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/StringUnit.cs -System.Drawing/SystemBrushes.cs +../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/SystemBrushes.cs System.Drawing/SystemColors.cs System.Drawing/SystemFonts.cs System.Drawing/SystemIcons.cs System.Drawing/SystemPens.cs -System.Drawing/TextureBrush.cs +../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/TextureBrush.cs System.Drawing/ToolboxBitmapAttribute.cs ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/UITypeEditorEditStyle.cs ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Design/IPropertyValueUIService.cs @@ -92,6 +105,7 @@ System.Drawing.Drawing2D/AdjustableArrowCap.cs ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/CompositingQuality.cs ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/CoordinateSpace.cs System.Drawing.Drawing2D/CustomLineCap.cs +../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/CustomLineCapType.cs System.Drawing.Drawing2D/DashCap.cs ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/DashStyle.cs ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/FillMode.cs @@ -100,7 +114,7 @@ System.Drawing.Drawing2D/GraphicsContainer.cs System.Drawing.Drawing2D/GraphicsPath.cs System.Drawing.Drawing2D/GraphicsPathIterator.cs System.Drawing.Drawing2D/GraphicsState.cs -System.Drawing.Drawing2D/HatchBrush.cs +../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/HatchBrush.cs ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/HatchStyle.cs ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/InterpolationMode.cs System.Drawing.Drawing2D/LinearGradientBrush.cs @@ -133,6 +147,7 @@ System.Drawing.Imaging/ColorMatrix.cs System.Drawing.Imaging/ColorPalette.cs ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/EmfPlusRecordType.cs ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/EmfType.cs +../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/EmfPlusFlags.cs ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/Encoder.cs System.Drawing.Imaging/EncoderParameter.cs System.Drawing.Imaging/EncoderParameters.cs @@ -148,12 +163,15 @@ System.Drawing.Imaging/ImageFormat.cs System.Drawing.Imaging/Metafile.cs System.Drawing.Imaging/MetafileFrameUnit.cs System.Drawing.Imaging/MetafileHeader.cs +../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/MetafileHeaderWmf.cs +../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/MetafileHeaderEmf.cs ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/MetafileType.cs System.Drawing.Imaging/MetaHeader.cs ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/PaletteFlags.cs ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/PixelFormat.cs ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/PlayRecordCallback.cs ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/PropertyItem.cs +../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/PropertyItemInternal.cs ../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/WmfPlaceableFileHeader.cs System.Drawing.Printing/Duplex.cs System.Drawing.Printing/InvalidPrinterException.cs diff --git a/mcs/class/System.Drawing/System.Drawing/Brush.cs b/mcs/class/System.Drawing/System.Drawing/Brush.cs deleted file mode 100644 index 14612ff4069..00000000000 --- a/mcs/class/System.Drawing/System.Drawing/Brush.cs +++ /dev/null @@ -1,84 +0,0 @@ -// -// System.Drawing.Brush.cs -// -// Authors: -// Miguel de Icaza (miguel@ximian.com) -// Ravindra (rkumar@novell.com) -// -// (C) Ximian, Inc. http://www.ximian.com -// Copyright (C) 2004,2006-2007 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -namespace System.Drawing { - - public abstract class Brush : MarshalByRefObject, ICloneable, IDisposable { - - internal IntPtr nativeObject; - - abstract public object Clone (); - - internal Brush (IntPtr ptr) - { - nativeObject = ptr; - } - - internal IntPtr NativeObject { - get { - return nativeObject; - } - set { - nativeObject = value; - } - } - - protected Brush () - { - } - - protected internal void SetNativeBrush (IntPtr brush) - { - nativeObject = brush; - } - - public void Dispose () - { - Dispose (true); - System.GC.SuppressFinalize (this); - } - - protected virtual void Dispose (bool disposing) - { - // NOTE: this has been known to fail in the past (cairo) - // but it's the only way to reclaim brush related memory - if (nativeObject != IntPtr.Zero) { - Status status = GDIPlus.GdipDeleteBrush (nativeObject); - nativeObject = IntPtr.Zero; - GDIPlus.CheckStatus (status); - } - } - - ~Brush () - { - Dispose (false); - } - } -} diff --git a/mcs/class/System.Drawing/System.Drawing/ExternDll.cs b/mcs/class/System.Drawing/System.Drawing/ExternDll.cs new file mode 100644 index 00000000000..2dd8f986cf7 --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing/ExternDll.cs @@ -0,0 +1,45 @@ +// +// ExternDll.cs +// +// Author: +// Frederik Carlier (frederik.carlier@quamotion.mobi) +// +// Copyright (C) 2017 Quamotion bvba http://quamotion.mobi +// + +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +namespace System.Drawing +{ + internal class ExternDll + { + public const string Gdiplus = "gdiplus"; + public const string User32 = "user32"; + public const string Gdi32 = "gdi32"; + public const string Kernel32 = "kernel32"; + public const string Winspool = "winspool.drv"; + public const string Comdlg32 = "comdlg32.dll"; + public const string Comctl32 = "comctl32.dll"; + public const string Shell32 = "shell32.dll"; + public const string Oleaut32 = "oleaut32.dll"; + } +} diff --git a/mcs/class/System.Drawing/System.Drawing/Graphics.cs b/mcs/class/System.Drawing/System.Drawing/Graphics.cs index 9c002db4162..6dc07045480 100644 --- a/mcs/class/System.Drawing/System.Drawing/Graphics.cs +++ b/mcs/class/System.Drawing/System.Drawing/Graphics.cs @@ -1180,7 +1180,7 @@ namespace System.Drawing if (s == null || s.Length == 0) return; - Status status = GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject, ref layoutRectangle, format != null ? format.NativeObject : IntPtr.Zero, brush.nativeObject); + Status status = GDIPlus.GdipDrawString (nativeObject, s, s.Length, font.NativeObject, ref layoutRectangle, format != null ? format.NativeObject : IntPtr.Zero, brush.NativeBrush); GDIPlus.CheckStatus (status); } @@ -1431,7 +1431,7 @@ namespace System.Drawing throw new ArgumentNullException ("brush"); if (points == null) throw new ArgumentNullException ("points"); - Status status = GDIPlus.GdipFillClosedCurve (nativeObject, brush.NativeObject, points, points.Length); + Status status = GDIPlus.GdipFillClosedCurve (nativeObject, brush.NativeBrush, points, points.Length); GDIPlus.CheckStatus (status); } @@ -1441,7 +1441,7 @@ namespace System.Drawing throw new ArgumentNullException ("brush"); if (points == null) throw new ArgumentNullException ("points"); - Status status = GDIPlus.GdipFillClosedCurveI (nativeObject, brush.NativeObject, points, points.Length); + Status status = GDIPlus.GdipFillClosedCurveI (nativeObject, brush.NativeBrush, points, points.Length); GDIPlus.CheckStatus (status); } @@ -1470,7 +1470,7 @@ namespace System.Drawing throw new ArgumentNullException ("brush"); if (points == null) throw new ArgumentNullException ("points"); - Status status = GDIPlus.GdipFillClosedCurve2 (nativeObject, brush.NativeObject, points, points.Length, tension, fillmode); + Status status = GDIPlus.GdipFillClosedCurve2 (nativeObject, brush.NativeBrush, points, points.Length, tension, fillmode); GDIPlus.CheckStatus (status); } @@ -1480,7 +1480,7 @@ namespace System.Drawing throw new ArgumentNullException ("brush"); if (points == null) throw new ArgumentNullException ("points"); - Status status = GDIPlus.GdipFillClosedCurve2I (nativeObject, brush.NativeObject, points, points.Length, tension, fillmode); + Status status = GDIPlus.GdipFillClosedCurve2I (nativeObject, brush.NativeBrush, points, points.Length, tension, fillmode); GDIPlus.CheckStatus (status); } @@ -1502,7 +1502,7 @@ namespace System.Drawing { if (brush == null) throw new ArgumentNullException ("brush"); - Status status = GDIPlus.GdipFillEllipse (nativeObject, brush.nativeObject, x, y, width, height); + Status status = GDIPlus.GdipFillEllipse (nativeObject, brush.NativeBrush, x, y, width, height); GDIPlus.CheckStatus (status); } @@ -1510,7 +1510,7 @@ namespace System.Drawing { if (brush == null) throw new ArgumentNullException ("brush"); - Status status = GDIPlus.GdipFillEllipseI (nativeObject, brush.nativeObject, x, y, width, height); + Status status = GDIPlus.GdipFillEllipseI (nativeObject, brush.NativeBrush, x, y, width, height); GDIPlus.CheckStatus (status); } @@ -1520,7 +1520,7 @@ namespace System.Drawing throw new ArgumentNullException ("brush"); if (path == null) throw new ArgumentNullException ("path"); - Status status = GDIPlus.GdipFillPath (nativeObject, brush.NativeObject, path.NativeObject); + Status status = GDIPlus.GdipFillPath (nativeObject, brush.NativeBrush, path.NativeObject); GDIPlus.CheckStatus (status); } @@ -1528,7 +1528,7 @@ namespace System.Drawing { if (brush == null) throw new ArgumentNullException ("brush"); - Status status = GDIPlus.GdipFillPie (nativeObject, brush.NativeObject, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle); + Status status = GDIPlus.GdipFillPie (nativeObject, brush.NativeBrush, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle); GDIPlus.CheckStatus (status); } @@ -1536,7 +1536,7 @@ namespace System.Drawing { if (brush == null) throw new ArgumentNullException ("brush"); - Status status = GDIPlus.GdipFillPieI (nativeObject, brush.NativeObject, x, y, width, height, startAngle, sweepAngle); + Status status = GDIPlus.GdipFillPieI (nativeObject, brush.NativeBrush, x, y, width, height, startAngle, sweepAngle); GDIPlus.CheckStatus (status); } @@ -1544,7 +1544,7 @@ namespace System.Drawing { if (brush == null) throw new ArgumentNullException ("brush"); - Status status = GDIPlus.GdipFillPie (nativeObject, brush.NativeObject, x, y, width, height, startAngle, sweepAngle); + Status status = GDIPlus.GdipFillPie (nativeObject, brush.NativeBrush, x, y, width, height, startAngle, sweepAngle); GDIPlus.CheckStatus (status); } @@ -1554,7 +1554,7 @@ namespace System.Drawing throw new ArgumentNullException ("brush"); if (points == null) throw new ArgumentNullException ("points"); - Status status = GDIPlus.GdipFillPolygon2 (nativeObject, brush.nativeObject, points, points.Length); + Status status = GDIPlus.GdipFillPolygon2 (nativeObject, brush.NativeBrush, points, points.Length); GDIPlus.CheckStatus (status); } @@ -1564,7 +1564,7 @@ namespace System.Drawing throw new ArgumentNullException ("brush"); if (points == null) throw new ArgumentNullException ("points"); - Status status = GDIPlus.GdipFillPolygon2I (nativeObject, brush.nativeObject, points, points.Length); + Status status = GDIPlus.GdipFillPolygon2I (nativeObject, brush.NativeBrush, points, points.Length); GDIPlus.CheckStatus (status); } @@ -1574,7 +1574,7 @@ namespace System.Drawing throw new ArgumentNullException ("brush"); if (points == null) throw new ArgumentNullException ("points"); - Status status = GDIPlus.GdipFillPolygonI (nativeObject, brush.nativeObject, points, points.Length, fillMode); + Status status = GDIPlus.GdipFillPolygonI (nativeObject, brush.NativeBrush, points, points.Length, fillMode); GDIPlus.CheckStatus (status); } @@ -1584,7 +1584,7 @@ namespace System.Drawing throw new ArgumentNullException ("brush"); if (points == null) throw new ArgumentNullException ("points"); - Status status = GDIPlus.GdipFillPolygon (nativeObject, brush.nativeObject, points, points.Length, fillMode); + Status status = GDIPlus.GdipFillPolygon (nativeObject, brush.NativeBrush, points, points.Length, fillMode); GDIPlus.CheckStatus (status); } @@ -1607,7 +1607,7 @@ namespace System.Drawing if (brush == null) throw new ArgumentNullException ("brush"); - Status status = GDIPlus.GdipFillRectangleI (nativeObject, brush.nativeObject, x, y, width, height); + Status status = GDIPlus.GdipFillRectangleI (nativeObject, brush.NativeBrush, x, y, width, height); GDIPlus.CheckStatus (status); } @@ -1616,7 +1616,7 @@ namespace System.Drawing if (brush == null) throw new ArgumentNullException ("brush"); - Status status = GDIPlus.GdipFillRectangle (nativeObject, brush.nativeObject, x, y, width, height); + Status status = GDIPlus.GdipFillRectangle (nativeObject, brush.NativeBrush, x, y, width, height); GDIPlus.CheckStatus (status); } @@ -1627,7 +1627,7 @@ namespace System.Drawing if (rects == null) throw new ArgumentNullException ("rects"); - Status status = GDIPlus.GdipFillRectanglesI (nativeObject, brush.nativeObject, rects, rects.Length); + Status status = GDIPlus.GdipFillRectanglesI (nativeObject, brush.NativeBrush, rects, rects.Length); GDIPlus.CheckStatus (status); } @@ -1638,7 +1638,7 @@ namespace System.Drawing if (rects == null) throw new ArgumentNullException ("rects"); - Status status = GDIPlus.GdipFillRectangles (nativeObject, brush.nativeObject, rects, rects.Length); + Status status = GDIPlus.GdipFillRectangles (nativeObject, brush.NativeBrush, rects, rects.Length); GDIPlus.CheckStatus (status); } @@ -1650,7 +1650,7 @@ namespace System.Drawing if (region == null) throw new ArgumentNullException ("region"); - Status status = GDIPlus.GdipFillRegion (nativeObject, brush.NativeObject, region.NativeObject); + Status status = GDIPlus.GdipFillRegion (nativeObject, brush.NativeBrush, region.NativeObject); GDIPlus.CheckStatus(status); } diff --git a/mcs/class/System.Drawing/System.Drawing/Image.cs b/mcs/class/System.Drawing/System.Drawing/Image.cs index 528d91004fa..a1970e969bd 100644 --- a/mcs/class/System.Drawing/System.Drawing/Image.cs +++ b/mcs/class/System.Drawing/System.Drawing/Image.cs @@ -169,6 +169,12 @@ public abstract class Image : MarshalByRefObject, IDisposable , ICloneable, ISer return img; } + // For compatiblity with CoreFX sources + internal static Image CreateImageObject (IntPtr nativeImage) + { + return CreateFromHandle (nativeImage); + } + internal static Image CreateFromHandle (IntPtr handle) { ImageType type; @@ -791,6 +797,13 @@ public abstract class Image : MarshalByRefObject, IDisposable , ICloneable, ISer nativeObject = value; } } + + // For compatiblity with CoreFX sources + internal IntPtr nativeImage { + get { + return nativeObject; + } + } public void Dispose () { diff --git a/mcs/class/System.Drawing/System.Drawing/Pen.cs b/mcs/class/System.Drawing/System.Drawing/Pen.cs index 42b54b1dc81..a6dee933aed 100644 --- a/mcs/class/System.Drawing/System.Drawing/Pen.cs +++ b/mcs/class/System.Drawing/System.Drawing/Pen.cs @@ -62,7 +62,7 @@ namespace System.Drawing if (brush == null) throw new ArgumentNullException ("brush"); - Status status = GDIPlus.GdipCreatePen2 (brush.nativeObject, width, GraphicsUnit.World, out nativeObject); + Status status = GDIPlus.GdipCreatePen2 (brush.NativeBrush, width, GraphicsUnit.World, out nativeObject); GDIPlus.CheckStatus (status); color = Color.Empty; } @@ -112,7 +112,7 @@ namespace System.Drawing if (!isModifiable) throw new ArgumentException (Locale.GetText ("This Pen object can't be modified.")); - Status status = GDIPlus.GdipSetPenBrushFill (nativeObject, value.nativeObject); + Status status = GDIPlus.GdipSetPenBrushFill (nativeObject, value.NativeBrush); GDIPlus.CheckStatus (status); color = Color.Empty; } diff --git a/mcs/class/System.Drawing/System.Drawing/SR.cs b/mcs/class/System.Drawing/System.Drawing/SR.cs new file mode 100644 index 00000000000..c7d6bc65e4e --- /dev/null +++ b/mcs/class/System.Drawing/System.Drawing/SR.cs @@ -0,0 +1,37 @@ +// +// SR.cs +// +// Author: +// Frederik Carlier (frederik.carlier@quamotion.mobi) +// +// Copyright (C) 2017 Quamotion bvba http://quamotion.mobi +// + +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +partial class SR +{ + public static string Format (string format, params object[] args) + { + return string.Format (format, args); + } +} diff --git a/mcs/class/System.Drawing/System.Drawing/SolidBrush.cs b/mcs/class/System.Drawing/System.Drawing/SolidBrush.cs deleted file mode 100644 index f356be3d26a..00000000000 --- a/mcs/class/System.Drawing/System.Drawing/SolidBrush.cs +++ /dev/null @@ -1,89 +0,0 @@ -// -// System.Drawing.SolidBrush.cs -// -// Author: -// Dennis Hayes (dennish@Raytek.com) -// Alexandre Pigolkine(pigolkine@gmx.de) -// Ravindra (rkumar@novell.com) -// -// (C) 2002 Ximian, Inc. -// Copyright (C) 2004, 2007 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -namespace System.Drawing { - - public sealed class SolidBrush : Brush { - - internal bool isModifiable = true; - // we keep this cached because calling GdipGetSolidFillColor - // wouldn't return a "named" color like SD is expected to do - private Color color; - - internal SolidBrush (IntPtr ptr) - : base (ptr) - { - int val; - Status status = GDIPlus.GdipGetSolidFillColor (ptr, out val); - GDIPlus.CheckStatus (status); - color = Color.FromArgb (val); - } - - public SolidBrush (Color color) - { - this.color = color; - Status status = GDIPlus.GdipCreateSolidFill (color.ToArgb (), out nativeObject); - GDIPlus.CheckStatus (status); - } - - public Color Color { - get { - return color; - } - set { - if (isModifiable) { - color = value; - Status status = GDIPlus.GdipSetSolidFillColor (nativeObject, value.ToArgb ()); - GDIPlus.CheckStatus (status); - } - else - throw new ArgumentException (Locale.GetText ("This SolidBrush object can't be modified.")); - } - } - - public override object Clone () - { - IntPtr clonePtr; - Status status = GDIPlus.GdipCloneBrush (nativeObject, out clonePtr); - GDIPlus.CheckStatus (status); - // we loose the named color in this case (but so does MS SD) - return new SolidBrush (clonePtr); - } - - protected override void Dispose (bool disposing) - { - if (disposing && !isModifiable) - throw new ArgumentException (Locale.GetText ("This SolidBrush object can't be modified.")); - - base.Dispose (disposing); - } - } -} diff --git a/mcs/class/System.Drawing/System.Drawing/SystemBrushes.cs b/mcs/class/System.Drawing/System.Drawing/SystemBrushes.cs deleted file mode 100644 index abb365abdcd..00000000000 --- a/mcs/class/System.Drawing/System.Drawing/SystemBrushes.cs +++ /dev/null @@ -1,460 +0,0 @@ -// -// System.Drawing.SystemBrushes.cs -// -// Authors: -// Dennis Hayes (dennish@Raytek.com) -// Ravindra (rkumar@novell.com) -// Jordi Mas i Hernandez <jordimash@gmail.com> -// -// Copyright (C) 2002 Ximian, Inc. http://www.ximian.com -// Copyright (C) 2004 Novell, Inc. http://www.novell.com -// - -// -// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; - -namespace System.Drawing -{ - /// <summary> - /// Summary description for SystemBrushes. - /// </summary> - public sealed class SystemBrushes - { - static SolidBrush active_border; - static SolidBrush active_caption; - static SolidBrush active_caption_text; - static SolidBrush app_workspace; - static SolidBrush control; - static SolidBrush control_dark; - static SolidBrush control_dark_dark; - static SolidBrush control_light; - static SolidBrush control_light_light; - static SolidBrush control_text; - static SolidBrush desktop; - static SolidBrush highlight; - static SolidBrush highlight_text; - static SolidBrush hot_track; - static SolidBrush inactive_border; - static SolidBrush inactive_caption; - static SolidBrush info; - static SolidBrush menu; - static SolidBrush scroll_bar; - static SolidBrush window; - static SolidBrush window_text; - static SolidBrush button_face; - static SolidBrush button_highlight; - static SolidBrush button_shadow; - static SolidBrush gradient_activecaption; - static SolidBrush gradient_inactivecaption; - static SolidBrush graytext; - static SolidBrush inactive_captiontext; - static SolidBrush infotext; - static SolidBrush menubar; - static SolidBrush menu_highlight; - static SolidBrush menu_text; - static SolidBrush window_fame; - - private SystemBrushes() { } - - public static Brush ActiveBorder - { - get { - if (active_border == null) { - active_border = new SolidBrush (SystemColors.ActiveBorder); - active_border.isModifiable = false; - } - - return active_border; - } - } - - public static Brush ActiveCaption - { - get { - if (active_caption == null) { - active_caption = new SolidBrush (SystemColors.ActiveCaption); - active_caption.isModifiable = false; - } - - return active_caption; - } - } - - public static Brush ActiveCaptionText - { - get { - if (active_caption_text == null) { - active_caption_text = new SolidBrush (SystemColors.ActiveCaptionText); - active_caption_text.isModifiable = false; - } - - return active_caption_text; - } - } - - public static Brush AppWorkspace - { - get { - if (app_workspace == null) { - app_workspace = new SolidBrush (SystemColors.AppWorkspace); - app_workspace.isModifiable = false; - } - - return app_workspace; - } - } - - public static Brush Control { - get { - if (control == null) { - control = new SolidBrush (SystemColors.Control); - control.isModifiable = false; - } - - return control; - } - } - - public static Brush ControlLight { - get { - if (control_light == null) { - control_light = new SolidBrush (SystemColors.ControlLight); - control_light.isModifiable = false; - } - - return control_light; - } - } - - public static Brush ControlLightLight { - get { - if (control_light_light == null) { - control_light_light = new SolidBrush (SystemColors.ControlLightLight); - control_light_light.isModifiable = false; - } - - return control_light_light; - } - } - - public static Brush ControlDark { - get { - if (control_dark == null) { - control_dark = new SolidBrush (SystemColors.ControlDark); - control_dark.isModifiable = false; - } - - return control_dark; - } - } - - public static Brush ControlDarkDark { - get { - if (control_dark_dark == null) { - control_dark_dark = new SolidBrush (SystemColors.ControlDarkDark); - control_dark_dark.isModifiable = false; - } - - return control_dark_dark; - } - } - - public static Brush ControlText { - get { - if (control_text == null) { - control_text = new SolidBrush (SystemColors.ControlText); - control_text.isModifiable = false; - } - - return control_text; - } - } - - public static Brush Highlight { - get { - if (highlight == null) { - highlight = new SolidBrush (SystemColors.Highlight); - highlight.isModifiable = false; - } - - return highlight; - } - } - - public static Brush HighlightText { - get { - if (highlight_text == null) { - highlight_text = new SolidBrush (SystemColors.HighlightText); - highlight_text.isModifiable = false; - } - - return highlight_text; - } - } - - public static Brush Window { - get { - if (window == null) { - window = new SolidBrush (SystemColors.Window); - window.isModifiable = false; - } - - return window; - } - } - public static Brush WindowText { - get { - if (window_text == null) { - window_text = new SolidBrush (SystemColors.WindowText); - window_text.isModifiable = false; - } - - return window_text; - } - } - - public static Brush InactiveBorder { - get { - if (inactive_border == null) { - inactive_border = new SolidBrush (SystemColors.InactiveBorder); - inactive_border.isModifiable = false; - } - - return inactive_border; - } - } - - public static Brush Desktop { - get { - if (desktop == null) { - desktop = new SolidBrush (SystemColors.Desktop); - desktop.isModifiable = false; - } - - return desktop; - } - } - - public static Brush HotTrack { - get { - if (hot_track == null) { - hot_track = new SolidBrush (SystemColors.HotTrack); - hot_track.isModifiable = false; - } - - return hot_track; - } - } - - public static Brush InactiveCaption { - get { - if (inactive_caption == null) { - inactive_caption = new SolidBrush (SystemColors.InactiveCaption); - inactive_caption.isModifiable = false; - } - - return inactive_caption; - } - } - - public static Brush Info { - get { - if (info == null) { - info = new SolidBrush (SystemColors.Info); - info.isModifiable = false; - } - - return info; - } - } - - public static Brush Menu { - get { - if (menu == null) { - menu = new SolidBrush (SystemColors.Menu); - menu.isModifiable = false; - } - - return menu; - } - } - - public static Brush ScrollBar { - get { - if (scroll_bar == null) { - scroll_bar = new SolidBrush (SystemColors.ScrollBar); - scroll_bar.isModifiable = false; - } - - return scroll_bar; - } - } - - public static Brush FromSystemColor (Color c) - { - if (c.IsSystemColor) { - SolidBrush newBrush = new SolidBrush (c); - newBrush.isModifiable = false; - return newBrush; - } - - String message = String.Format ("The color {0} is not a system color.", c); - throw new ArgumentException (message); - } - - public static Brush ButtonFace { - get { - if (button_face == null) { - button_face = new SolidBrush (SystemColors.ButtonFace); - button_face.isModifiable = false; - } - - return button_face; - } - } - - public static Brush ButtonHighlight { - get { - if (button_highlight == null) { - button_highlight = new SolidBrush (SystemColors.ButtonHighlight); - button_highlight.isModifiable = false; - } - - return button_highlight; - } - } - - public static Brush ButtonShadow { - get { - if (button_shadow == null) { - button_shadow = new SolidBrush (SystemColors.ButtonShadow); - button_shadow.isModifiable = false; - } - - return button_shadow; - } - } - - public static Brush GradientActiveCaption { - get { - if (gradient_activecaption == null) { - gradient_activecaption = new SolidBrush (SystemColors.GradientActiveCaption); - gradient_activecaption.isModifiable = false; - } - - return gradient_activecaption; - } - } - - public static Brush GradientInactiveCaption { - get { - if (gradient_inactivecaption == null) { - gradient_inactivecaption = new SolidBrush (SystemColors.GradientInactiveCaption); - gradient_inactivecaption.isModifiable = false; - } - - return gradient_inactivecaption; - } - } - - public static Brush GrayText { - get { - if (graytext == null) { - graytext = new SolidBrush (SystemColors.GrayText); - graytext.isModifiable = false; - } - - return graytext; - } - } - - public static Brush InactiveCaptionText { - get { - if (inactive_captiontext == null) { - inactive_captiontext = new SolidBrush (SystemColors.InactiveCaptionText); - inactive_captiontext.isModifiable = false; - } - - return inactive_captiontext; - } - } - - public static Brush InfoText { - get { - if (infotext == null) { - infotext = new SolidBrush (SystemColors.InfoText); - infotext.isModifiable = false; - } - - return infotext; - } - } - - public static Brush MenuBar { - get { - if (menubar == null) { - menubar = new SolidBrush (SystemColors.MenuBar); - menubar.isModifiable = false; - } - - return menubar; - } - } - - public static Brush MenuHighlight { - get { - if (menu_highlight == null) { - menu_highlight = new SolidBrush (SystemColors.MenuHighlight); - menu_highlight.isModifiable = false; - } - - return menu_highlight; - } - } - - public static Brush MenuText { - get { - if (menu_text == null) { - menu_text = new SolidBrush (SystemColors.MenuText); - menu_text.isModifiable = false; - } - - return menu_text; - } - } - - public static Brush WindowFrame { - get { - if (window_fame == null) { - window_fame = new SolidBrush (SystemColors.WindowFrame); - window_fame.isModifiable = false; - } - - return window_fame; - } - } - - } -} diff --git a/mcs/class/System.Drawing/System.Drawing/TextureBrush.cs b/mcs/class/System.Drawing/System.Drawing/TextureBrush.cs deleted file mode 100644 index 3982e5747b4..00000000000 --- a/mcs/class/System.Drawing/System.Drawing/TextureBrush.cs +++ /dev/null @@ -1,231 +0,0 @@ -// -// System.Drawing.TextureBrush.cs -// -// Authors: -// Dennis Hayes (dennish@Raytek.com) -// Ravindra (rkumar@novell.com) -// Sebastien Pouliot <sebastien@ximian.com> -// -// (C) 2002 Ximian, Inc -// Copyright (C) 2004,2006-2007 Novell, Inc (http://www.novell.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System.ComponentModel; -using System.Drawing.Drawing2D; -using System.Drawing.Imaging; - -namespace System.Drawing { - - public sealed class TextureBrush : Brush { - - internal TextureBrush (IntPtr ptr) : - base (ptr) - { - } - - public TextureBrush (Image bitmap) : - this (bitmap, WrapMode.Tile) - { - } - - public TextureBrush (Image image, Rectangle dstRect) : - this (image, WrapMode.Tile, dstRect) - { - } - - public TextureBrush (Image image, RectangleF dstRect) : - this (image, WrapMode.Tile, dstRect) - { - } - - public TextureBrush (Image image, WrapMode wrapMode) - { - if (image == null) - throw new ArgumentNullException ("image"); - if ((wrapMode < WrapMode.Tile) || (wrapMode > WrapMode.Clamp)) - throw new InvalidEnumArgumentException ("WrapMode"); - - Status status = GDIPlus.GdipCreateTexture (image.nativeObject, wrapMode, out nativeObject); - GDIPlus.CheckStatus (status); - } - - [MonoLimitation ("ImageAttributes are ignored when using libgdiplus")] - public TextureBrush (Image image, Rectangle dstRect, ImageAttributes imageAttr) - { - if (image == null) - throw new ArgumentNullException ("image"); - - IntPtr attr = imageAttr == null ? IntPtr.Zero : imageAttr.NativeObject; - Status status = GDIPlus.GdipCreateTextureIAI (image.nativeObject, attr, dstRect.X, dstRect.Y, - dstRect.Width, dstRect.Height, out nativeObject); - GDIPlus.CheckStatus (status); - } - - [MonoLimitation ("ImageAttributes are ignored when using libgdiplus")] - public TextureBrush (Image image, RectangleF dstRect, ImageAttributes imageAttr) - { - if (image == null) - throw new ArgumentNullException ("image"); - - IntPtr attr = imageAttr == null ? IntPtr.Zero : imageAttr.NativeObject; - Status status = GDIPlus.GdipCreateTextureIA (image.nativeObject, attr, dstRect.X, dstRect.Y, - dstRect.Width, dstRect.Height, out nativeObject); - GDIPlus.CheckStatus (status); - } - - public TextureBrush (Image image, WrapMode wrapMode, Rectangle dstRect) - { - if (image == null) - throw new ArgumentNullException ("image"); - if ((wrapMode < WrapMode.Tile) || (wrapMode > WrapMode.Clamp)) - throw new InvalidEnumArgumentException ("WrapMode"); - - Status status = GDIPlus.GdipCreateTexture2I (image.nativeObject, wrapMode, dstRect.X, dstRect.Y, - dstRect.Width, dstRect.Height, out nativeObject); - GDIPlus.CheckStatus (status); - } - - public TextureBrush (Image image, WrapMode wrapMode, RectangleF dstRect) - { - if (image == null) - throw new ArgumentNullException ("image"); - if ((wrapMode < WrapMode.Tile) || (wrapMode > WrapMode.Clamp)) - throw new InvalidEnumArgumentException ("WrapMode"); - - Status status = GDIPlus.GdipCreateTexture2 (image.nativeObject, wrapMode, dstRect.X, dstRect.Y, - dstRect.Width, dstRect.Height, out nativeObject); - GDIPlus.CheckStatus (status); - } - - // properties - - public Image Image { - get { - // this check is required here as GDI+ doesn't check for it - if (nativeObject == IntPtr.Zero) - throw new ArgumentException ("Object was disposed"); - - IntPtr img; - Status status = GDIPlus.GdipGetTextureImage (nativeObject, out img); - GDIPlus.CheckStatus (status); - return new Bitmap (img); - } - } - - public Matrix Transform { - get { - Matrix matrix = new Matrix (); - Status status = GDIPlus.GdipGetTextureTransform (nativeObject, matrix.nativeMatrix); - GDIPlus.CheckStatus (status); - - return matrix; - } - set { - if (value == null) - throw new ArgumentNullException ("Transform"); - - Status status = GDIPlus.GdipSetTextureTransform (nativeObject, value.nativeMatrix); - GDIPlus.CheckStatus (status); - } - } - - public WrapMode WrapMode { - get { - WrapMode mode; - Status status = GDIPlus.GdipGetTextureWrapMode (nativeObject, out mode); - GDIPlus.CheckStatus (status); - return mode; - } - set { - if ((value < WrapMode.Tile) || (value > WrapMode.Clamp)) - throw new InvalidEnumArgumentException ("WrapMode"); - - Status status = GDIPlus.GdipSetTextureWrapMode (nativeObject, value); - GDIPlus.CheckStatus (status); - } - } - - // public methods - - public override object Clone () - { - IntPtr clonePtr; - Status status = GDIPlus.GdipCloneBrush (nativeObject, out clonePtr); - GDIPlus.CheckStatus (status); - - return new TextureBrush (clonePtr); - } - - public void MultiplyTransform (Matrix matrix) - { - MultiplyTransform (matrix, MatrixOrder.Prepend); - } - - public void MultiplyTransform (Matrix matrix, MatrixOrder order) - { - if (matrix == null) - throw new ArgumentNullException ("matrix"); - - Status status = GDIPlus.GdipMultiplyTextureTransform (nativeObject, matrix.nativeMatrix, order); - GDIPlus.CheckStatus (status); - } - - public void ResetTransform () - { - Status status = GDIPlus.GdipResetTextureTransform (nativeObject); - GDIPlus.CheckStatus (status); - } - - public void RotateTransform (float angle) - { - RotateTransform (angle, MatrixOrder.Prepend); - } - - public void RotateTransform (float angle, MatrixOrder order) - { - Status status = GDIPlus.GdipRotateTextureTransform (nativeObject, angle, order); - GDIPlus.CheckStatus (status); - } - - public void ScaleTransform (float sx, float sy) - { - ScaleTransform (sx, sy, MatrixOrder.Prepend); - } - - public void ScaleTransform (float sx, float sy, MatrixOrder order) - { - Status status = GDIPlus.GdipScaleTextureTransform (nativeObject, sx, sy, order); - GDIPlus.CheckStatus (status); - } - - public void TranslateTransform (float dx, float dy) - { - TranslateTransform (dx, dy, MatrixOrder.Prepend); - } - - public void TranslateTransform (float dx, float dy, MatrixOrder order) - { - Status status = GDIPlus.GdipTranslateTextureTransform (nativeObject, dx, dy, order); - GDIPlus.CheckStatus (status); - } - } -} diff --git a/mcs/class/System.Drawing/System.Drawing_test.dll.sources b/mcs/class/System.Drawing/System.Drawing_test.dll.sources index 4b7cf62280f..bbde755ab8a 100644 --- a/mcs/class/System.Drawing/System.Drawing_test.dll.sources +++ b/mcs/class/System.Drawing/System.Drawing_test.dll.sources @@ -1,5 +1,22 @@ ../../test-helpers/NunitHelpers.cs ../../../build/common/Locale.cs +../../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Gdiplus.cs +../../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/NativeMethods.cs +../../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/UnsafeNativeMethods.cs +../../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Internal/GPPOINT.cs +../../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Internal/GPPOINTF.cs +../../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Internal/GPRECT.cs +../../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Internal/GPRECTF.cs +../../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Drawing2D/CustomLineCapType.cs +../../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/PropertyItemInternal.cs +../../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/PropertyItem.cs +../../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/MetafileHeaderWmf.cs +../../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/MetafileHeaderEmf.cs +../../../../external/corefx/src/System.Drawing.Common/src/System/Drawing/Imaging/EmfPlusFlags.cs +../../../../external/corefx/src/System.Drawing.Common/src/misc/HandleCollector.cs +../corefx/SR.cs +../System.Drawing/SR.cs +../System.Drawing/ExternDll.cs ../System.Drawing/gdipEnums.cs ../System.Drawing/gdipFunctions.cs ../System.Drawing/gdipStructs.cs diff --git a/mcs/class/System.Drawing/corefx/SR.cs b/mcs/class/System.Drawing/corefx/SR.cs new file mode 100644 index 00000000000..9575948818d --- /dev/null +++ b/mcs/class/System.Drawing/corefx/SR.cs @@ -0,0 +1,98 @@ +// +// This file was generated by resx2sr tool +// + +partial class SR +{ + public const string CantTellPrinterName = "(printer name protected due to security restrictions)"; + public const string CantChangeImmutableObjects = "Changes cannot be made to {0} because permissions are not valid."; + public const string CantMakeIconTransparent = "Bitmaps that are icons cannot be made transparent. Icons natively support transparency. Use the Icon constructor to create an icon."; + public const string ColorNotSystemColor = "The color {0} is not a system color."; + public const string DotNET_ComponentType = ".NET Component"; + public const string GdiplusAborted = "Function was ended."; + public const string GdiplusAccessDenied = "File access is denied."; + public const string GdiplusCannotCreateGraphicsFromIndexedPixelFormat = "A Graphics object cannot be created from an image that has an indexed pixel format."; + public const string GdiplusCannotSetPixelFromIndexedPixelFormat = "SetPixel is not supported for images with indexed pixel formats."; + public const string GdiplusDestPointsInvalidParallelogram = "Destination points define a parallelogram which must have a length of 3. These points will represent the upper-left, upper-right, and lower-left coordinates (defined in that order)."; + public const string GdiplusDestPointsInvalidLength = "Destination points must be an array with a length of 3 or 4. A length of 3 defines a parallelogram with the upper-left, upper-right, and lower-left corners. A length of 4 defines a quadrilateral with the fourth element of the array specifying the lower-right coordinate."; + public const string GdiplusFileNotFound = "File not found."; + public const string GdiplusFontFamilyNotFound = "Font '{0}' cannot be found."; + public const string GdiplusFontStyleNotFound = "Font '{0}' does not support style '{1}'."; + public const string GdiplusGenericError = "A generic error occurred in GDI+."; + public const string GdiplusInsufficientBuffer = "Buffer is too small (internal GDI+ error)."; + public const string GdiplusInvalidParameter = "Parameter is not valid."; + public const string GdiplusInvalidRectangle = "Rectangle '{0}' cannot have a width or height equal to 0."; + public const string GdiplusInvalidSize = "Operation requires a transformation of the image from GDI+ to GDI. GDI does not support images with a width or height greater than 32767."; + public const string GdiplusOutOfMemory = "Out of memory."; + public const string GdiplusNotImplemented = "Not implemented."; + public const string GdiplusNotInitialized = "GDI+ is not properly initialized (internal GDI+ error)."; + public const string GdiplusNotTrueTypeFont = "Only TrueType fonts are supported. '{0}' is not a TrueType font."; + public const string GdiplusNotTrueTypeFont_NoName = "Only TrueType fonts are supported. This is not a TrueType font."; + public const string GdiplusObjectBusy = "Object is currently in use elsewhere."; + public const string GdiplusOverflow = "Overflow error."; + public const string GdiplusPropertyNotFoundError = "Property cannot be found."; + public const string GdiplusPropertyNotSupportedError = "Property is not supported."; + public const string GdiplusUnknown = "Unknown GDI+ error occurred."; + public const string GdiplusUnknownImageFormat = "Image format is unknown."; + public const string GdiplusUnsupportedGdiplusVersion = "Current version of GDI+ does not support this feature."; + public const string GdiplusWrongState = "Bitmap region is already locked."; + public const string GlobalAssemblyCache = " (Global Assembly Cache)"; + public const string GraphicsBufferCurrentlyBusy = "BufferedGraphicsContext cannot be disposed of because a buffer operation is currently in progress."; + public const string GraphicsBufferQueryFail = "Screen-compatible bitmap cannot be created. The screen bitmap format cannot be determined."; + public const string ToolboxItemLocked = "Toolbox item cannot be modified."; + public const string ToolboxItemInvalidPropertyType = "Property {0} requires an argument of type {1}."; + public const string ToolboxItemValueNotSerializable = "Data type {0} is not serializable. Items added to a property dictionary must be serializable."; + public const string ToolboxItemInvalidKey = "Argument should be a non-empty string."; + public const string IllegalState = "Internal state of the {0} class is invalid."; + public const string InterpolationColorsColorBlendNotSet = "Property must be set to a valid ColorBlend object to use interpolation colors."; + public const string InterpolationColorsCommon = "{0}{1} ColorBlend objects must be constructed with the same number of positions and color values. Positions must be between 0.0 and 1.0, 1.0 indicating the last element in the array."; + public const string InterpolationColorsInvalidColorBlendObject = "ColorBlend object that was set is not valid."; + public const string InterpolationColorsInvalidStartPosition = "Position's first element must be equal to 0."; + public const string InterpolationColorsInvalidEndPosition = "Position's last element must be equal to 1.0."; + public const string InterpolationColorsLength = "Array of colors and positions must contain at least two elements."; + public const string InterpolationColorsLengthsDiffer = "Colors and positions do not have the same number of elements."; + public const string InvalidArgument = "Value of '{1}' is not valid for '{0}'."; + public const string InvalidBoundArgument = "Value of '{1}' is not valid for '{0}'. '{0}' should be greater than {2} and less than or equal to {3}."; + public const string InvalidClassName = "Class name is not valid."; + public const string InvalidColor = "Color '{0}' is not valid."; + public const string InvalidDashPattern = "DashPattern value is not valid."; + public const string InvalidEx2BoundArgument = "Value of '{1}' is not valid for '{0}'. '{0}' should be greater than or equal to {2} and less than or equal to {3}."; + public const string InvalidFrame = "Frame is not valid. Frame must be between 0 and FrameCount."; + public const string InvalidGDIHandle = "Win32 handle that was passed to {0} is not valid or is the wrong type."; + public const string InvalidImage = "Image type is unknown."; + public const string InvalidLowBoundArgumentEx = "Value of '{1}' is not valid for '{0}'. '{0}' must be greater than or equal to {2}."; + public const string InvalidPermissionLevel = "Permission level is not valid."; + public const string InvalidPermissionState = "Permission state is not valid."; + public const string InvalidPictureType = "Argument '{0}' must be a picture that can be used as a {1}."; + public const string InvalidPrinterException_InvalidPrinter = "Settings to access printer '{0}' are not valid."; + public const string InvalidPrinterException_NoDefaultPrinter = "No printers are installed."; + public const string InvalidPrinterHandle = "Handle {0} is not valid."; + public const string ValidRangeX = "Parameter must be positive and < Width."; + public const string ValidRangeY = "Parameter must be positive and < Height."; + public const string NativeHandle0 = "Native handle is 0."; + public const string NoDefaultPrinter = "Default printer is not set."; + public const string NotImplemented = "Not implemented."; + public const string PDOCbeginPrintDescr = "Occurs when the document is about to be printed."; + public const string PDOCdocumentNameDescr = "The name of the document shown to the user."; + public const string PDOCdocumentPageSettingsDescr = "The page settings of the page currently being printed."; + public const string PDOCendPrintDescr = "Occurs after the document has been printed."; + public const string PDOCoriginAtMarginsDescr = "Indicates that the graphics origin is located at the user-specified page margins."; + public const string PDOCprintControllerDescr = "Retrieves the print controller for this document."; + public const string PDOCprintPageDescr = "Occurs once for each page to be printed."; + public const string PDOCprinterSettingsDescr = "Retrieves the settings for the printer the document is currently being printed to."; + public const string PDOCqueryPageSettingsDescr = "Occurs before each page is printed. Useful for changing PageSettings for a particular page."; + public const string PrintDocumentDesc = "Defines an object that sends output to a printer."; + public const string PrintingPermissionBadXml = "XML is not valid."; + public const string PrintingPermissionAttributeInvalidPermissionLevel = "Permission level must be between PrintingPermissionLevel.NoPrinting and PrintingPermissionLevel.AllPrinting."; + public const string PropertyValueInvalidEntry = "IDictionary parameter contains at least one entry that is not valid. Ensure all values are consistent with the object's properties."; + public const string PSizeNotCustom = "PaperSize cannot be changed unless the Kind property is set to Custom."; + public const string ResourceNotFound = "Resource '{1}' cannot be found in class '{0}'."; + public const string TargetNotPrintingPermission = "Target does not have permission to print."; + public const string TextParseFailedFormat = "Text \"{0}\" cannot be parsed. The expected text format is \"{1}\"."; + public const string TriStateCompareError = "TriState.Default cannot be converted into a Boolean."; + public const string toStringIcon = "(Icon)"; + public const string toStringNone = "(none)"; + public const string DCTypeInvalid = "GetObjectType on this dc returned an invalid value."; + public const string InvalidEnumArgument = "The value of argument '{0}' ({1}) is invalid for Enum type '{2}'."; + public const string ConvertInvalidPrimitive = "{0} is not a valid value for {1}."; +} |