You've already forked linux-packaging-mono
Imported Upstream version 3.10.0
Former-commit-id: 172c8e3c300b39d5785c7a3e8dfb08ebdbc1a99b
This commit is contained in:
@ -54,11 +54,9 @@ using System.Runtime.InteropServices;
|
||||
[assembly: ComCompatibleVersion (1, 0, 3300, 0)]
|
||||
[assembly: AllowPartiallyTrustedCallers]
|
||||
|
||||
#if !TARGET_JVM
|
||||
[assembly: CLSCompliant (true)]
|
||||
[assembly: AssemblyDelaySign (true)]
|
||||
[assembly: AssemblyKeyFile("../msfinal.pub")]
|
||||
#endif
|
||||
|
||||
[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
|
||||
[assembly: CompilationRelaxations (CompilationRelaxations.NoStringInterning)]
|
||||
|
@ -1,76 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace Mainsoft.Drawing.Configuration
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for ResolutionConfiguration.
|
||||
/// </summary>
|
||||
public class ResolutionConfiguration : IComparable
|
||||
{
|
||||
string _imageFormat = "";
|
||||
|
||||
string _xResPath = "";
|
||||
string _yResPath = "";
|
||||
string _unitsTypePath = "";
|
||||
|
||||
string _xResDefault = "";
|
||||
string _yResDefault = "";
|
||||
string _unitsTypeDefault = "";
|
||||
|
||||
Hashtable _unitScale;
|
||||
|
||||
public ResolutionConfiguration(
|
||||
string imageFormat,
|
||||
string xresPath, string yresPath, string unitsTypePath,
|
||||
string xresDefault, string yresDefault, string unitsTypeDefault,
|
||||
Hashtable unitScale)
|
||||
{
|
||||
_imageFormat = imageFormat;
|
||||
|
||||
_xResPath = xresPath;
|
||||
_yResPath = yresPath;
|
||||
_unitsTypePath = unitsTypePath;
|
||||
|
||||
_xResDefault = xresDefault;
|
||||
_yResDefault = yresDefault;
|
||||
_unitsTypeDefault = unitsTypeDefault;
|
||||
|
||||
_unitScale = unitScale;
|
||||
}
|
||||
|
||||
public string XResPath {
|
||||
get { return _xResPath; }
|
||||
}
|
||||
public string XResDefault {
|
||||
get { return _xResDefault; }
|
||||
}
|
||||
public string YResPath {
|
||||
get { return _yResPath; }
|
||||
}
|
||||
public string YResDefault {
|
||||
get { return _yResDefault; }
|
||||
}
|
||||
public string UnitsTypePath {
|
||||
get { return _unitsTypePath; }
|
||||
}
|
||||
public string UnitsTypeDefault {
|
||||
get { return _unitsTypeDefault; }
|
||||
}
|
||||
public string ImageFormat {
|
||||
get { return _imageFormat; }
|
||||
}
|
||||
public Hashtable UnitsScale {
|
||||
get { return _unitScale; }
|
||||
}
|
||||
|
||||
#region IComparable Members
|
||||
|
||||
public int CompareTo(object obj) {
|
||||
return _imageFormat.CompareTo(((ResolutionConfiguration)obj).ImageFormat);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
@ -1,93 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace Mainsoft.Drawing.Configuration {
|
||||
/// <summary>
|
||||
/// Summary description for MetadataConfigurationCollection.
|
||||
/// </summary>
|
||||
public class ResolutionConfigurationCollection : IEnumerable, ICollection {
|
||||
|
||||
ArrayList _resolutionConfigurations;
|
||||
|
||||
#region ctors
|
||||
|
||||
internal ResolutionConfigurationCollection(ResolutionConfigurationCollection parent) {
|
||||
_resolutionConfigurations = new ArrayList();
|
||||
|
||||
if (parent != null)
|
||||
_resolutionConfigurations.AddRange(parent);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region methods
|
||||
|
||||
internal void Add(ResolutionConfiguration value) {
|
||||
_resolutionConfigurations.Add(value);
|
||||
}
|
||||
|
||||
internal void Sort() {
|
||||
_resolutionConfigurations.Sort();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region props
|
||||
|
||||
public ResolutionConfiguration this[int index] {
|
||||
get {
|
||||
return (ResolutionConfiguration)_resolutionConfigurations[index];
|
||||
}
|
||||
}
|
||||
|
||||
public ResolutionConfiguration this[string ImageFormat] {
|
||||
get {
|
||||
for (int i=0; i < _resolutionConfigurations.Count; i++)
|
||||
if ( ((ResolutionConfiguration)_resolutionConfigurations[i]).ImageFormat == ImageFormat )
|
||||
return (ResolutionConfiguration)_resolutionConfigurations[i];
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IEnumerable Members
|
||||
|
||||
public IEnumerator GetEnumerator() {
|
||||
// TODO: Add ResolutionConfigurationCollection.GetEnumerator implementation
|
||||
return _resolutionConfigurations.GetEnumerator();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ICollection Members
|
||||
|
||||
public bool IsSynchronized {
|
||||
get {
|
||||
// TODO: Add ResolutionConfigurationCollection.IsSynchronized getter implementation
|
||||
return _resolutionConfigurations.IsSynchronized;
|
||||
}
|
||||
}
|
||||
|
||||
public int Count {
|
||||
get {
|
||||
// TODO: Add ResolutionConfigurationCollection.Count getter implementation
|
||||
return _resolutionConfigurations.Count;
|
||||
}
|
||||
}
|
||||
|
||||
public void CopyTo(Array array, int index) {
|
||||
// TODO: Add ResolutionConfigurationCollection.CopyTo implementation
|
||||
_resolutionConfigurations.CopyTo(array, index);
|
||||
}
|
||||
|
||||
public object SyncRoot {
|
||||
get {
|
||||
// TODO: Add ResolutionConfigurationCollection.SyncRoot getter implementation
|
||||
return _resolutionConfigurations.SyncRoot;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -1,140 +0,0 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Configuration;
|
||||
using System.Xml;
|
||||
|
||||
|
||||
namespace Mainsoft.Drawing.Configuration
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for MetadataConfigurationHandler.
|
||||
/// </summary>
|
||||
public class ResolutionConfigurationHandler : IConfigurationSectionHandler
|
||||
{
|
||||
public ResolutionConfigurationHandler()
|
||||
{
|
||||
//
|
||||
// TODO: Add constructor logic here
|
||||
//
|
||||
}
|
||||
|
||||
public virtual object Create (object parent, object configContext, XmlNode section) {
|
||||
|
||||
if (section.Attributes != null && section.Attributes.Count != 0)
|
||||
HandlersUtil.ThrowException ("Unrecognized attribute", section);
|
||||
|
||||
ResolutionConfigurationCollection col =
|
||||
new ResolutionConfigurationCollection(parent as ResolutionConfigurationCollection);
|
||||
|
||||
XmlNodeList imageFormats = section.ChildNodes;
|
||||
foreach (XmlNode child in imageFormats) {
|
||||
|
||||
XmlNodeType ntype = child.NodeType;
|
||||
if (ntype == XmlNodeType.Whitespace || ntype == XmlNodeType.Comment)
|
||||
continue;
|
||||
|
||||
if (ntype != XmlNodeType.Element)
|
||||
HandlersUtil.ThrowException ("Only elements allowed", child);
|
||||
|
||||
string imageFormatName = HandlersUtil.ExtractAttributeValue ("name", child, false, false);
|
||||
|
||||
string xResPath = HandlersUtil.ExtractNodeValue(child["xresolution"]);
|
||||
string yResPath = HandlersUtil.ExtractNodeValue(child["yresolution"]);
|
||||
string unitsType = HandlersUtil.ExtractNodeValue(child["unitstype"], false, true);
|
||||
|
||||
string xResDefault = HandlersUtil.ExtractAttributeValue ("default", child["xresolution"]);
|
||||
string yResDefault = HandlersUtil.ExtractAttributeValue ("default", child["yresolution"]);
|
||||
string unitsTypeDefault = HandlersUtil.ExtractAttributeValue ("default", child["unitstype"], true);
|
||||
|
||||
Hashtable unitScale = new Hashtable(3);
|
||||
|
||||
XmlNodeList unitScaleNodes = child.SelectNodes("unitscale");
|
||||
foreach (XmlNode unitScaleNode in unitScaleNodes) {
|
||||
unitScale.Add(
|
||||
HandlersUtil.ExtractAttributeValue ("value", unitScaleNode),
|
||||
HandlersUtil.ExtractNodeValue(unitScaleNode) );
|
||||
}
|
||||
|
||||
ResolutionConfiguration resConf = new ResolutionConfiguration(
|
||||
imageFormatName,
|
||||
xResPath, yResPath, unitsType,
|
||||
xResDefault, yResDefault, unitsTypeDefault,
|
||||
unitScale);
|
||||
|
||||
col.Add(resConf);
|
||||
}
|
||||
|
||||
col.Sort();
|
||||
return col;
|
||||
}
|
||||
}
|
||||
|
||||
internal sealed class HandlersUtil {
|
||||
private HandlersUtil () {
|
||||
}
|
||||
|
||||
static internal string ExtractNodeValue(XmlNode node, bool optional, bool allowEmpty) {
|
||||
if (node == null) {
|
||||
if (optional)
|
||||
return null;
|
||||
ThrowException ("Required node not found", node);
|
||||
}
|
||||
|
||||
string nodeValue = node.InnerText;
|
||||
|
||||
if (!allowEmpty && nodeValue == String.Empty) {
|
||||
string opt = optional ? "Optional" : "Required";
|
||||
ThrowException (opt + " node is empty", node);
|
||||
}
|
||||
|
||||
return nodeValue;
|
||||
}
|
||||
|
||||
static internal string ExtractNodeValue(XmlNode node, bool optional) {
|
||||
return ExtractNodeValue(node, false, false);
|
||||
}
|
||||
|
||||
static internal string ExtractNodeValue(XmlNode node) {
|
||||
return ExtractNodeValue(node, false);
|
||||
}
|
||||
|
||||
static internal string ExtractAttributeValue (string attKey, XmlNode node) {
|
||||
return ExtractAttributeValue (attKey, node, false);
|
||||
}
|
||||
|
||||
static internal string ExtractAttributeValue (string attKey, XmlNode node, bool optional) {
|
||||
return ExtractAttributeValue (attKey, node, optional, false);
|
||||
}
|
||||
|
||||
static internal string ExtractAttributeValue (string attKey, XmlNode node, bool optional,
|
||||
bool allowEmpty) {
|
||||
if (node.Attributes == null) {
|
||||
if (optional)
|
||||
return null;
|
||||
|
||||
ThrowException ("Required attribute not found: " + attKey, node);
|
||||
}
|
||||
|
||||
XmlNode att = node.Attributes.RemoveNamedItem (attKey);
|
||||
if (att == null) {
|
||||
if (optional)
|
||||
return null;
|
||||
ThrowException ("Required attribute not found: " + attKey, node);
|
||||
}
|
||||
|
||||
string value = att.Value;
|
||||
if (!allowEmpty && value == String.Empty) {
|
||||
string opt = optional ? "Optional" : "Required";
|
||||
ThrowException (opt + " attribute is empty: " + attKey, node);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
static internal void ThrowException (string msg, XmlNode node) {
|
||||
if (node != null && node.Name != String.Empty)
|
||||
msg = msg + " (node name: " + node.Name + ") ";
|
||||
throw new ConfigurationException (msg, node);
|
||||
}
|
||||
}
|
||||
}
|
@ -13,13 +13,6 @@ TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -define:TEST -resource:Test/resources/indexed.
|
||||
-r:System.Drawing.dll -r:System.Runtime.Serialization.Formatters.Soap.dll -r:System.Xml.dll \
|
||||
-nowarn:0618 -nowarn:219 -nowarn:169 -nowarn:1595
|
||||
|
||||
ifeq (net_1_1_java, $(PROFILE))
|
||||
LIB_MCS_FLAGS += \
|
||||
-r:System.Xml.dll \
|
||||
-r:rt.dll \
|
||||
-r:J2SE.Helpers.dll
|
||||
endif
|
||||
|
||||
include ../../build/library.make
|
||||
|
||||
EXTRA_DISTFILES = Test/resources/indexed.png \
|
||||
|
@ -86,7 +86,6 @@ namespace System.Drawing.Design
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#if !TARGET_JVM
|
||||
public void PaintValue (object value, Graphics canvas, Rectangle rectangle)
|
||||
{
|
||||
PaintValue (new PaintValueEventArgs (null, value, canvas, rectangle));
|
||||
@ -99,7 +98,6 @@ namespace System.Drawing.Design
|
||||
// but on the other hand the class is not abstract. Could never observe it did paint anything
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
#if NET_2_0
|
||||
public virtual bool IsDropDownResizable {
|
||||
get { return false; }
|
||||
|
@ -1,103 +0,0 @@
|
||||
//
|
||||
// System.Drawing.Drawing2D.AdjustableArrowCap.cs
|
||||
//
|
||||
// Authors:
|
||||
// Dennis Hayes (dennish@Raytek.com)
|
||||
// Ravindra (rkumar@novell.com)
|
||||
//
|
||||
// Copyright (C) 2002/3 Ximian, Inc. http://www.ximian.com
|
||||
// Copyright (C) 2004 Novell, Inc. http://www.novell.com
|
||||
//
|
||||
|
||||
//
|
||||
// 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 AdjustableArrowCap.
|
||||
/// </summary>
|
||||
[MonoNotSupported ("")]
|
||||
public sealed class AdjustableArrowCap : CustomLineCap
|
||||
{
|
||||
// Constructors
|
||||
|
||||
[MonoNotSupported ("")]
|
||||
public AdjustableArrowCap (float width, float height) : this (width, height, true)
|
||||
{
|
||||
}
|
||||
|
||||
[MonoNotSupported ("")]
|
||||
public AdjustableArrowCap (float width, float height, bool isFilled)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
// Public Properities
|
||||
[MonoTODO]
|
||||
public bool Filled {
|
||||
get {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
set {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public float Width {
|
||||
get {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
set {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public float Height {
|
||||
get {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
set {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public float MiddleInset {
|
||||
get {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
set {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -38,9 +38,6 @@ namespace System.Drawing.Drawing2D
|
||||
/// <summary>
|
||||
/// Summary description for Blend.
|
||||
/// </summary>
|
||||
#if TARGET_JVM
|
||||
[MonoTODO]
|
||||
#endif
|
||||
public sealed class Blend
|
||||
{
|
||||
private float [] positions;
|
||||
|
@ -1,131 +0,0 @@
|
||||
//
|
||||
// System.Drawing.Drawing2D.CustomLineCap.cs
|
||||
//
|
||||
// Authors:
|
||||
// Dennis Hayes (dennish@Raytek.com)
|
||||
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
|
||||
// Ravindra (rkumar@novell.com)
|
||||
//
|
||||
// Copyright (C) 2002/3 Ximian, Inc. http://www.ximian.com
|
||||
// Copyright (C) 2004 Novell, Inc. http://www.novell.com
|
||||
//
|
||||
|
||||
//
|
||||
// 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 CustomLineCap.
|
||||
/// </summary>
|
||||
[MonoNotSupported ("")]
|
||||
public class CustomLineCap : MarshalByRefObject, ICloneable
|
||||
{
|
||||
private bool disposed;
|
||||
|
||||
// Constructors
|
||||
|
||||
internal CustomLineCap () { }
|
||||
|
||||
[MonoNotSupported ("")]
|
||||
public CustomLineCap (GraphicsPath fillPath, GraphicsPath strokePath) : this (fillPath, strokePath, LineCap.Flat, 0)
|
||||
{
|
||||
}
|
||||
|
||||
[MonoNotSupported ("")]
|
||||
public CustomLineCap (GraphicsPath fillPath, GraphicsPath strokePath, LineCap baseCap) : this (fillPath, strokePath, baseCap, 0)
|
||||
{
|
||||
}
|
||||
|
||||
[MonoNotSupported ("")]
|
||||
public CustomLineCap(GraphicsPath fillPath, GraphicsPath strokePath, LineCap baseCap, float baseInset)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public LineCap BaseCap {
|
||||
get {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
set {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public LineJoin StrokeJoin {
|
||||
get {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
set {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public float BaseInset {
|
||||
get {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
set {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public float WidthScale {
|
||||
get {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
set {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
// Public Methods
|
||||
[MonoTODO]
|
||||
public virtual object Clone ()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public void GetStrokeCaps (out LineCap startCap, out LineCap endCap)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public void SetStrokeCaps(LineCap startCap, LineCap endCap)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,105 +0,0 @@
|
||||
//
|
||||
// System.Drawing.Drawing2D.GeneralPathIterator.cs
|
||||
//
|
||||
// Author:
|
||||
// Bors Kirzner <boris@mainsoft.com>
|
||||
//
|
||||
// Copyright (C) 2005 Mainsoft Corporation, (http://www.mainsoft.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;
|
||||
|
||||
using java.awt.geom;
|
||||
|
||||
namespace System.Drawing.Drawing2D
|
||||
{
|
||||
internal class GeneralPathIterator : PathIterator
|
||||
{
|
||||
#region Fields
|
||||
|
||||
int typeIdx = 0;
|
||||
int pointIdx = 0;
|
||||
ExtendedGeneralPath _path;
|
||||
AffineTransform _affine;
|
||||
|
||||
private static readonly int [] curvesize = {2, 2, 4, 6, 0};
|
||||
|
||||
#endregion // Fileds
|
||||
|
||||
#region Constructors
|
||||
|
||||
public GeneralPathIterator(ExtendedGeneralPath _path) : this (_path, null)
|
||||
{
|
||||
}
|
||||
|
||||
public GeneralPathIterator(ExtendedGeneralPath _path, AffineTransform at)
|
||||
{
|
||||
this._path = _path;
|
||||
this._affine = at;
|
||||
}
|
||||
|
||||
#endregion // Constructors
|
||||
|
||||
#region Methods
|
||||
|
||||
public int getWindingRule()
|
||||
{
|
||||
return _path.getWindingRule ();
|
||||
}
|
||||
|
||||
public bool isDone()
|
||||
{
|
||||
return (typeIdx >= _path.TypesCount);
|
||||
}
|
||||
|
||||
public void next()
|
||||
{
|
||||
int type = _path.Types [typeIdx++] & ExtendedGeneralPath.SEG_MASK;
|
||||
pointIdx += curvesize [type];
|
||||
}
|
||||
|
||||
public int currentSegment(float [] coords) {
|
||||
int type = _path.Types [typeIdx] & ExtendedGeneralPath.SEG_MASK;
|
||||
int numCoords = curvesize [type];
|
||||
if (numCoords > 0 && _affine != null)
|
||||
_affine.transform (_path.Coords, pointIdx, coords, 0, numCoords/2);
|
||||
else
|
||||
Array.Copy (_path.Coords, pointIdx, coords, 0, numCoords);
|
||||
return type;
|
||||
}
|
||||
|
||||
public int currentSegment(double [] coords)
|
||||
{
|
||||
int type = _path.Types [typeIdx] & ExtendedGeneralPath.SEG_MASK;
|
||||
int numCoords = curvesize [type];
|
||||
if (numCoords > 0 && _affine != null)
|
||||
_affine.transform (_path.Coords, pointIdx, coords, 0, numCoords/2);
|
||||
else
|
||||
for (int i=0; i < numCoords; i++)
|
||||
coords [i] = _path.Coords [pointIdx + i];
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
#endregion // Methods
|
||||
}
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
//
|
||||
// System.Drawing.Drawing2D.GraphicsContainer.cs
|
||||
//
|
||||
// Authors:
|
||||
// Dennis Hayes (dennish@Raytek.com)
|
||||
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
|
||||
//
|
||||
// (C) 2002/3 Ximian, 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 GraphicsContainer.
|
||||
/// </summary>
|
||||
public sealed class GraphicsContainer : MarshalByRefObject
|
||||
{
|
||||
readonly GraphicsState _stateObject;
|
||||
|
||||
internal GraphicsContainer (GraphicsState stateObject)
|
||||
{
|
||||
_stateObject = stateObject;
|
||||
}
|
||||
|
||||
internal GraphicsState StateObject
|
||||
{
|
||||
get {return _stateObject;}
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -1,220 +0,0 @@
|
||||
//
|
||||
// System.Drawing.Drawing2D.GraphicsPathIterator.cs
|
||||
//
|
||||
// Author:
|
||||
// Bors Kirzner <boris@mainsoft.com>
|
||||
//
|
||||
// Copyright (C) 2005 Mainsoft Corporation, (http://www.mainsoft.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;
|
||||
using System.Drawing;
|
||||
|
||||
namespace System.Drawing.Drawing2D
|
||||
{
|
||||
public sealed class GraphicsPathIterator : MarshalByRefObject, IDisposable
|
||||
{
|
||||
#region Fields
|
||||
|
||||
private readonly GraphicsPath _path;
|
||||
private int _marker = -1;
|
||||
private int _subpath = -1;
|
||||
|
||||
#endregion // Fields
|
||||
|
||||
#region Constructors
|
||||
|
||||
public GraphicsPathIterator (GraphicsPath path)
|
||||
{
|
||||
_path = path;
|
||||
}
|
||||
|
||||
#endregion // Constructors
|
||||
|
||||
#region Properites
|
||||
|
||||
public int Count
|
||||
{
|
||||
get { return _path.NativeObject.PointCount; }
|
||||
}
|
||||
|
||||
public int SubpathCount {
|
||||
get {
|
||||
int count = 0;
|
||||
int start, end;
|
||||
bool isClosed;
|
||||
while (NextSubpath (out start, out end, out isClosed) != 0)
|
||||
count++;
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion // Properties
|
||||
|
||||
#region Methods
|
||||
|
||||
public int CopyData (ref PointF [] points, ref byte [] types, int startIndex, int endIndex)
|
||||
{
|
||||
int j = 0;
|
||||
for (int i = startIndex; i <= endIndex && i < _path.PointCount; i++) {
|
||||
points [j] = _path.PathPoints [i];
|
||||
types [j++] = _path.PathTypes [i];
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
public void Dispose ()
|
||||
{
|
||||
}
|
||||
|
||||
public int Enumerate (ref PointF [] points, ref byte [] types)
|
||||
{
|
||||
return CopyData (ref points, ref types, 0, _path.PointCount);
|
||||
}
|
||||
|
||||
public bool HasCurve ()
|
||||
{
|
||||
byte [] types = _path.PathTypes;
|
||||
for (int i=0; i < types.Length; i++)
|
||||
if ((types [i] & (byte)PathPointType.PathTypeMask) == (byte)PathPointType.Bezier3)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public int NextMarker (GraphicsPath path)
|
||||
{
|
||||
if (path == null)
|
||||
return 0;
|
||||
|
||||
int startIndex;
|
||||
int endIndex;
|
||||
int count = NextMarker (out startIndex, out endIndex);
|
||||
|
||||
if (count != 0)
|
||||
SetPath (_path, startIndex, count, path);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
public int NextMarker (out int startIndex, out int endIndex)
|
||||
{
|
||||
if (_marker >= _path.PointCount) {
|
||||
startIndex = 0;
|
||||
endIndex = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
startIndex = ++_marker;
|
||||
while ((_marker < _path.PointCount) && ((_path.PathTypes [_marker] & (byte)PathPointType.PathMarker) == 0))
|
||||
_marker++;
|
||||
|
||||
endIndex = (_marker < _path.PointCount) ? _marker : _path.PointCount - 1;
|
||||
return endIndex - startIndex + 1;
|
||||
}
|
||||
|
||||
public int NextPathType (out byte pathType, out int startIndex, out int endIndex)
|
||||
{
|
||||
if ((_subpath >= _path.PointCount - 1) | (_subpath < 0)) {
|
||||
startIndex = 0;
|
||||
endIndex = 0;
|
||||
pathType = (_subpath < 0) ? (byte)PathPointType.Start : _path.PathTypes [_path.PointCount - 1];
|
||||
return 0;
|
||||
}
|
||||
|
||||
// .net acts different, but it seems to be a bug
|
||||
if ((_path.PathTypes [_subpath + 1] & (byte)PathPointType.PathMarker) != 0) {
|
||||
startIndex = 0;
|
||||
endIndex = 0;
|
||||
pathType = _path.PathTypes [_subpath];
|
||||
return 0;
|
||||
}
|
||||
|
||||
startIndex = _subpath++;
|
||||
endIndex = startIndex;
|
||||
pathType = (byte)(_path.PathTypes [startIndex + 1] & (byte)PathPointType.PathTypeMask);
|
||||
|
||||
while (((_subpath) < _path.PointCount) && ((_path.PathTypes [_subpath] & (byte)PathPointType.PathTypeMask) == pathType))
|
||||
_subpath++;
|
||||
|
||||
endIndex = (_subpath < _path.PointCount) ? --_subpath : _path.PointCount - 1;
|
||||
return endIndex - startIndex + 1;
|
||||
}
|
||||
|
||||
public int NextSubpath (GraphicsPath path, out bool isClosed)
|
||||
{
|
||||
int startIndex;
|
||||
int endIndex;
|
||||
int count = NextSubpath (out startIndex, out endIndex, out isClosed);
|
||||
|
||||
if ((count != 0) && (path != null))
|
||||
SetPath (_path, startIndex, count, path);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
private void SetPath (GraphicsPath source, int start, int count, GraphicsPath target)
|
||||
{
|
||||
PointF [] points = new PointF [count];
|
||||
byte [] types = new byte [count];
|
||||
PointF [] pathPoints = _path.PathPoints;
|
||||
byte [] pathTypes = _path.PathTypes;
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
points [i] = pathPoints [start + i];
|
||||
types [i] = pathTypes [start + i];
|
||||
}
|
||||
|
||||
target.SetPath (points, types);
|
||||
}
|
||||
|
||||
public int NextSubpath (out int startIndex, out int endIndex, out bool isClosed)
|
||||
{
|
||||
_subpath++;
|
||||
while (((_subpath) < _path.PointCount) && (_path.PathTypes [_subpath] != (byte)PathPointType.Start))
|
||||
_subpath++;
|
||||
|
||||
|
||||
if (_subpath >= _path.PointCount - 1) {
|
||||
startIndex = 0;
|
||||
endIndex = 0;
|
||||
isClosed = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
startIndex = _subpath;
|
||||
int offset = 1;
|
||||
while (((_subpath + offset) < _path.PointCount) && (_path.PathTypes [_subpath + offset] != (byte)PathPointType.Start))
|
||||
offset++;
|
||||
|
||||
endIndex = ((_subpath + offset) < _path.PointCount) ? _subpath + offset - 1 : _path.PointCount - 1;
|
||||
isClosed = (_path.PathTypes [endIndex] & (byte)PathPointType.CloseSubpath) != 0;
|
||||
return endIndex - startIndex + 1;
|
||||
}
|
||||
|
||||
public void Rewind ()
|
||||
{
|
||||
_marker = -1;
|
||||
_subpath = -1;
|
||||
}
|
||||
|
||||
#endregion // Methods
|
||||
}
|
||||
}
|
@ -1,150 +0,0 @@
|
||||
//
|
||||
// System.Drawing.Drawing2D.ExtendedGraphicsState.jvm.cs
|
||||
//
|
||||
// Author:
|
||||
// Vladimir Krasnov (vladimirk@mainsoft.com)
|
||||
//
|
||||
// Copyright (C) 2005 Mainsoft Corporation (http://www.mainsoft.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;
|
||||
using System.Drawing.Text;
|
||||
using geom = java.awt.geom;
|
||||
using awt = java.awt;
|
||||
|
||||
namespace System.Drawing.Drawing2D
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for GraphicsState.
|
||||
/// </summary>
|
||||
public sealed class GraphicsState : MarshalByRefObject
|
||||
{
|
||||
readonly CompositingMode _compositingMode;
|
||||
readonly CompositingQuality _compositingQuality;
|
||||
readonly Region _clip;
|
||||
readonly awt.Shape _baseClip;
|
||||
readonly InterpolationMode _interpolationMode;
|
||||
readonly float _pageScale;
|
||||
readonly GraphicsUnit _pageUnit;
|
||||
readonly PixelOffsetMode _pixelOffsetMode;
|
||||
readonly Point _renderingOrigin;
|
||||
readonly SmoothingMode _smoothingMode;
|
||||
readonly int _textContrast;
|
||||
readonly TextRenderingHint _textRenderingHint;
|
||||
|
||||
// additional transform in case that new container has one
|
||||
readonly Matrix _transform;
|
||||
readonly Matrix _baseTransform;
|
||||
|
||||
GraphicsState _next = null;
|
||||
|
||||
internal GraphicsState(Graphics graphics, bool resetState)
|
||||
: this(graphics, Matrix.IdentityTransform, resetState) {}
|
||||
|
||||
internal GraphicsState Next {
|
||||
get {
|
||||
return _next;
|
||||
}
|
||||
set {
|
||||
_next = value;
|
||||
}
|
||||
}
|
||||
|
||||
internal GraphicsState(Graphics graphics, Matrix matrix, bool resetState)
|
||||
{
|
||||
_compositingMode = graphics.CompositingMode;
|
||||
_compositingQuality = graphics.CompositingQuality;
|
||||
_clip = graphics.ScaledClip;
|
||||
_baseClip = graphics.NativeObject.getClip();
|
||||
_interpolationMode = graphics.InterpolationMode;
|
||||
_pageScale = graphics.PageScale;
|
||||
_pageUnit = graphics.PageUnit;
|
||||
_pixelOffsetMode = graphics.PixelOffsetMode;
|
||||
|
||||
// FIXME: render orign is not implemented yet
|
||||
//_renderingOrigin = new Point( g.RenderingOrigin.X, g.RenderingOrigin.Y );
|
||||
|
||||
_smoothingMode = graphics.SmoothingMode;
|
||||
_transform = graphics.Transform;
|
||||
_baseTransform = graphics.BaseTransform;
|
||||
|
||||
_textContrast = graphics.TextContrast;
|
||||
_textRenderingHint = graphics.TextRenderingHint;
|
||||
|
||||
if (resetState)
|
||||
ResetState(graphics, matrix);
|
||||
}
|
||||
|
||||
internal void RestoreState(Graphics graphics)
|
||||
{
|
||||
graphics.CompositingMode = _compositingMode;
|
||||
graphics.CompositingQuality = _compositingQuality;
|
||||
graphics.ScaledClip = _clip;
|
||||
graphics.InterpolationMode = _interpolationMode;
|
||||
graphics.PageScale = _pageScale;
|
||||
graphics.PageUnit = _pageUnit;
|
||||
graphics.PixelOffsetMode = _pixelOffsetMode;
|
||||
|
||||
// FIXME: render orign is not implemented yet
|
||||
//graphics.RenderingOrigin = new Point( _renderingOrigin.X, _renderingOrigin.Y );
|
||||
|
||||
graphics.SmoothingMode = _smoothingMode;
|
||||
graphics.Transform = _transform;
|
||||
graphics.BaseTransform = _baseTransform;
|
||||
graphics.TextContrast = _textContrast;
|
||||
graphics.TextRenderingHint = _textRenderingHint;
|
||||
|
||||
// must be set after the base transform is restored
|
||||
graphics.NativeObject.setClip(_baseClip);
|
||||
}
|
||||
|
||||
void ResetState(Graphics graphics, Matrix matrix)
|
||||
{
|
||||
//should be set before the base transform is changed
|
||||
if (_baseClip == null)
|
||||
graphics.IntersectScaledClipWithBase(graphics.VisibleShape);
|
||||
|
||||
graphics.CompositingMode = CompositingMode.SourceOver;
|
||||
graphics.CompositingQuality = CompositingQuality.Default;
|
||||
graphics.ScaledClip = Region.InfiniteRegion;
|
||||
graphics.InterpolationMode = InterpolationMode.Bilinear;
|
||||
graphics.PageScale = 1.0f;
|
||||
graphics.PageUnit = GraphicsUnit.Display;
|
||||
graphics.PixelOffsetMode = PixelOffsetMode.Default;
|
||||
|
||||
// FIXME: render orign is not implemented yet
|
||||
//graphics.RenderingOrigin = new Point(0, 0);
|
||||
|
||||
graphics.SmoothingMode = SmoothingMode.None;
|
||||
graphics.ResetTransform();
|
||||
graphics.PrependBaseTransform(Graphics.GetFinalTransform(_transform.NativeObject, _pageUnit, _pageScale));
|
||||
graphics.PrependBaseTransform(matrix.NativeObject);
|
||||
graphics.TextContrast = 4;
|
||||
graphics.TextRenderingHint = TextRenderingHint.SystemDefault;
|
||||
}
|
||||
|
||||
internal void RestoreBaseClip(Graphics graphics) {
|
||||
graphics.NativeObject.setClip(_baseClip);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
|
||||
using System;
|
||||
using java.awt;
|
||||
namespace System.Drawing.Drawing2D
|
||||
{
|
||||
/// <summary>
|
||||
/// Summary description for HatchBrush.
|
||||
/// </summary>
|
||||
public sealed class HatchBrush : Brush
|
||||
{
|
||||
private HatchStyle _style;
|
||||
private Color _foreColor;
|
||||
private Color _backColor;
|
||||
|
||||
[MonoTODO]
|
||||
public HatchBrush (HatchStyle hatchStyle, Color foreColor)
|
||||
: this (hatchStyle, foreColor, Color.Black)
|
||||
{
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public HatchBrush(HatchStyle hatchStyle, Color foreColor, Color backColor)
|
||||
{
|
||||
_style = hatchStyle;
|
||||
_foreColor = foreColor;
|
||||
_backColor = backColor;
|
||||
}
|
||||
|
||||
public Color BackgroundColor {
|
||||
get {
|
||||
return _backColor;
|
||||
}
|
||||
}
|
||||
|
||||
public Color ForegroundColor {
|
||||
get {
|
||||
return _foreColor;
|
||||
}
|
||||
}
|
||||
|
||||
public HatchStyle HatchStyle {
|
||||
get {
|
||||
return _style;
|
||||
}
|
||||
}
|
||||
|
||||
public override object Clone ()
|
||||
{
|
||||
return new HatchBrush (_style, _foreColor, _backColor);
|
||||
}
|
||||
|
||||
protected override Paint NativeObject {
|
||||
get {
|
||||
// FALLBACK: Solid color brush will be used
|
||||
return _foreColor.NativeObject;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,346 +0,0 @@
|
||||
using System;
|
||||
using java.awt;
|
||||
using awt = java.awt;
|
||||
using geom = java.awt.geom;
|
||||
using image = java.awt.image;
|
||||
|
||||
namespace System.Drawing.Drawing2D {
|
||||
/// <summary>
|
||||
/// Summary description for LinearGradientBrush.
|
||||
/// </summary>
|
||||
public sealed class LinearGradientBrush : Brush {
|
||||
Blend _blend;
|
||||
bool _gammaCorrection;
|
||||
ColorBlend _interpolationColors;
|
||||
WrapMode _wrapmode;
|
||||
RectangleF _gradientRectangle;
|
||||
|
||||
// gradient brush data
|
||||
float _x1 = 0;
|
||||
float _y1 = 0;
|
||||
|
||||
float _x2 = 0;
|
||||
float _y2 = 0;
|
||||
|
||||
Color _color1, _color2;
|
||||
bool _cyclic;
|
||||
|
||||
#region NativeObject
|
||||
|
||||
GradientPaint _nativeObject = null;
|
||||
protected override Paint NativeObject {
|
||||
get {
|
||||
if ( _nativeObject == null )
|
||||
_nativeObject = new GradientPaint(
|
||||
_x1, _y1,
|
||||
new java.awt.Color(_color1.R, _color1.G, _color1.B, _color1.A),
|
||||
_x2, _y2,
|
||||
new java.awt.Color(_color2.R, _color2.G, _color2.B, _color2.A), _cyclic);
|
||||
|
||||
return _nativeObject;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Initialization
|
||||
|
||||
private void Init(float x1, float y1, Color color1, float x2, float y2, Color color2, bool cyclic) {
|
||||
_x1 = x1;
|
||||
_y1 = y1;
|
||||
_color1 = color1;
|
||||
|
||||
_x2 = x2;
|
||||
_y2 = y2;
|
||||
_color2 = color2;
|
||||
|
||||
_cyclic = cyclic;
|
||||
_nativeObject = null;
|
||||
}
|
||||
|
||||
private void Init(float x1, float y1, Color color1, float x2, float y2, Color color2, float angle) {
|
||||
_gradientRectangle = new RectangleF(x1, y1, x2-x1, y2-y1);
|
||||
PointF [] points = GetMedianeEnclosingRect(x1, y1, x2, y2, angle);
|
||||
Init(points[0].X, points[0].Y, color1, points[1].X, points[1].Y, color2, false);
|
||||
}
|
||||
|
||||
private void Init(float x1, float y1, Color color1, float x2, float y2, Color color2, LinearGradientMode linearGradientMode) {
|
||||
_gradientRectangle = new RectangleF(x1, y1, x2-x1, y2-y1);
|
||||
PointF [] points;
|
||||
|
||||
switch (linearGradientMode) {
|
||||
case LinearGradientMode.Horizontal :
|
||||
Init(x1, y1, color1, x2, y1, color2, false);
|
||||
break;
|
||||
|
||||
case LinearGradientMode.Vertical :
|
||||
Init(x1, y1, color1, x1, y2, color2, false);
|
||||
break;
|
||||
|
||||
case LinearGradientMode.BackwardDiagonal :
|
||||
points = GetMedianeEnclosingRect(x1, y1, x2, y2, false);
|
||||
Init(points[0].X, points[0].Y, color2, points[1].X, points[1].Y, color1, false);
|
||||
break;
|
||||
|
||||
case LinearGradientMode.ForwardDiagonal :
|
||||
points = GetMedianeEnclosingRect(x1, y1, x2, y2, true);
|
||||
Init(points[0].X, points[0].Y, color1, points[1].X, points[1].Y, color2, false);
|
||||
break;
|
||||
|
||||
default :
|
||||
throw new ArgumentException("LinearGradientMode");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
private LinearGradientBrush (float x1, float y1, Color color1, float x2, float y2, Color color2, bool cyclic) {
|
||||
Init(x1, y1, color1, x2, y2, color2, cyclic);
|
||||
}
|
||||
|
||||
internal LinearGradientBrush (float x1, float y1, Color color1, float x2, float y2, Color color2, LinearGradientMode mode) {
|
||||
Init(x1, y1, color1, x2, y2, color2, mode);
|
||||
}
|
||||
internal LinearGradientBrush (float x1, float y1, Color color1, float x2, float y2, Color color2) {
|
||||
Init(x1, y2, color1, x1, y2, color2, false);
|
||||
}
|
||||
public LinearGradientBrush (Point point1, Point point2, Color color1, Color color2) {
|
||||
_gradientRectangle = new RectangleF(point1.X, point1.Y, point2.X - point1.X, point2.Y - point2.Y);
|
||||
Init(point1.X, point1.Y, color1, point2.X, point2.Y, color2, false);
|
||||
}
|
||||
public LinearGradientBrush (PointF point1, PointF point2, Color color1, Color color2) {
|
||||
_gradientRectangle = new RectangleF(point1.X, point1.Y, point2.X - point1.X, point2.Y - point2.Y);
|
||||
Init(point1.X, point1.Y, color1, point2.X, point2.Y, color2, false);
|
||||
}
|
||||
public LinearGradientBrush (Rectangle rect, Color color1, Color color2, LinearGradientMode linearGradientMode) {
|
||||
Init(rect.X, rect.Y, color1, rect.X + rect.Width, rect.Y + rect.Height, color2, linearGradientMode);
|
||||
}
|
||||
public LinearGradientBrush (RectangleF rect, Color color1, Color color2, LinearGradientMode linearGradientMode) {
|
||||
Init(rect.X, rect.Y, color1, rect.X + rect.Width, rect.Y + rect.Height, color2, linearGradientMode);
|
||||
}
|
||||
public LinearGradientBrush (Rectangle rect, Color color1, Color color2, float angle) {
|
||||
Init(rect.X, rect.Y, color1, rect.X + rect.Width, rect.Y + rect.Height, color2, angle);
|
||||
}
|
||||
public LinearGradientBrush (RectangleF rect, Color color1, Color color2, float angle) {
|
||||
Init(rect.X, rect.Y, color1, rect.X + rect.Width, rect.Y + rect.Height, color2, angle);
|
||||
}
|
||||
public LinearGradientBrush (Rectangle rect, Color color1, Color color2, float angle, bool isAngleScaleable):
|
||||
this(rect, color1, color2, angle) {
|
||||
}
|
||||
public LinearGradientBrush (RectangleF rect, Color color1, Color color2, float angle, bool isAngleScaleable):
|
||||
this(rect, color1, color2, angle) {
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region GetMedianeEnclosingRect
|
||||
|
||||
internal PointF [] GetMedianeEnclosingRect(float x1, float y1, float x2, float y2, float rotateAngle) {
|
||||
float width = x2 - x1;
|
||||
float height = y2 - y1;
|
||||
PointF rectCenter = new PointF(x1 + width/2, y1 + height/2);
|
||||
float gradLen = width * Math.Abs((float)Math.Cos(rotateAngle * Math.PI / 180)) +
|
||||
height * Math.Abs((float)Math.Sin(rotateAngle * Math.PI / 180));
|
||||
|
||||
PointF [] points = new PointF []{ new PointF(rectCenter.X - gradLen/2, rectCenter.Y),
|
||||
new PointF(rectCenter.X + gradLen/2, rectCenter.Y) };
|
||||
|
||||
Matrix mx = new Matrix();
|
||||
mx.RotateAt((float)rotateAngle, rectCenter);
|
||||
mx.TransformPoints(points);
|
||||
return points;
|
||||
}
|
||||
internal PointF [] GetMedianeEnclosingRect(float x1, float y1, float x2, float y2, bool forwardDiagonal) {
|
||||
float width = x2 - x1;
|
||||
float height = y2 - y1;
|
||||
PointF rectCenter = new PointF(x1 + width/2, y1 + height/2);
|
||||
float rotateAngle = (float)Math.Atan2(width, height);
|
||||
float gradLen = width * (float)Math.Cos(rotateAngle);
|
||||
|
||||
if (!forwardDiagonal)
|
||||
rotateAngle = -rotateAngle;
|
||||
|
||||
PointF [] points = new PointF []{ new PointF(rectCenter.X - gradLen, rectCenter.Y),
|
||||
new PointF(rectCenter.X + gradLen, rectCenter.Y) };
|
||||
|
||||
Matrix mx = new Matrix();
|
||||
mx.RotateAt((float)rotateAngle * (float)(180/Math.PI), rectCenter);
|
||||
mx.TransformPoints(points);
|
||||
return points;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Properties
|
||||
|
||||
// FALLBACK: no functionality implemented for this property
|
||||
[MonoTODO]
|
||||
public Blend Blend {
|
||||
get {
|
||||
return _blend;
|
||||
}
|
||||
set {
|
||||
_blend = value;
|
||||
}
|
||||
}
|
||||
|
||||
// FALLBACK: no functionality implemented for this property
|
||||
[MonoTODO]
|
||||
public bool GammaCorrection {
|
||||
get {
|
||||
return _gammaCorrection;
|
||||
}
|
||||
set {
|
||||
_gammaCorrection = value;
|
||||
}
|
||||
}
|
||||
|
||||
// FALLBACK: functionality of two color gradient is implemented
|
||||
[MonoTODO]
|
||||
public ColorBlend InterpolationColors {
|
||||
get {
|
||||
return _interpolationColors;
|
||||
}
|
||||
set {
|
||||
if (value == null)
|
||||
throw new ArgumentNullException("ColorBlend");
|
||||
|
||||
if ( (value.Colors == null) || (value.Colors.Length == 0) )
|
||||
throw new ArgumentException("ColorBlend");
|
||||
|
||||
_interpolationColors = value;
|
||||
|
||||
_color1 = value.Colors[0];
|
||||
_color2 = value.Colors[value.Colors.Length - 1];
|
||||
_nativeObject = null;
|
||||
}
|
||||
}
|
||||
|
||||
public Color [] LinearColors {
|
||||
get {
|
||||
Color [] cl = new Color[2];
|
||||
cl[0] = _color1;
|
||||
cl[1] = _color2;
|
||||
return cl;
|
||||
}
|
||||
set {
|
||||
if (value == null)
|
||||
throw new ArgumentNullException("colors");
|
||||
|
||||
_color1 = value[0];
|
||||
_color2 = value[1];
|
||||
_nativeObject = null;
|
||||
}
|
||||
}
|
||||
|
||||
public RectangleF Rectangle {
|
||||
get {
|
||||
return _gradientRectangle;
|
||||
}
|
||||
}
|
||||
|
||||
public Matrix Transform {
|
||||
get { return BrushTransform; }
|
||||
set { BrushTransform = value; }
|
||||
}
|
||||
|
||||
// FALLBACK: not functionality implemented for this property
|
||||
[MonoTODO]
|
||||
public WrapMode WrapMode {
|
||||
get {
|
||||
return _wrapmode;
|
||||
}
|
||||
set {
|
||||
_wrapmode = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void MultiplyTransform (Matrix matrix) {
|
||||
BrushMultiplyTransform(matrix, MatrixOrder.Prepend);
|
||||
}
|
||||
|
||||
public void MultiplyTransform (Matrix matrix, MatrixOrder order) {
|
||||
BrushMultiplyTransform(matrix, order);
|
||||
}
|
||||
|
||||
public void ResetTransform () {
|
||||
BrushResetTransform();
|
||||
}
|
||||
|
||||
public void RotateTransform (float angle) {
|
||||
BrushRotateTransform(angle, MatrixOrder.Prepend);
|
||||
}
|
||||
|
||||
public void RotateTransform (float angle, MatrixOrder order) {
|
||||
BrushRotateTransform(angle, order);
|
||||
}
|
||||
|
||||
public void ScaleTransform (float sx, float sy) {
|
||||
BrushScaleTransform(sx, sy, MatrixOrder.Prepend);
|
||||
}
|
||||
|
||||
public void ScaleTransform (float sx, float sy, MatrixOrder order) {
|
||||
BrushScaleTransform(sx, sy, order);
|
||||
}
|
||||
|
||||
public void SetBlendTriangularShape (float focus) {
|
||||
SetBlendTriangularShape (focus, 1.0F);
|
||||
}
|
||||
|
||||
public void SetBlendTriangularShape (float focus, float scale) {
|
||||
_x2 = (_x1 + _x2) / 2;
|
||||
_y2 = (_y1 + _y2) / 2;
|
||||
_cyclic = true;
|
||||
_nativeObject = null;
|
||||
}
|
||||
|
||||
public void SetSigmaBellShape (float focus) {
|
||||
SetSigmaBellShape (focus, 1.0F);
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public void SetSigmaBellShape (float focus, float scale) {
|
||||
// FALLBACK: Triangle shape used
|
||||
SetBlendTriangularShape (focus, scale);
|
||||
}
|
||||
|
||||
public void TranslateTransform (float dx, float dy) {
|
||||
BrushTranslateTransform (dx, dy);
|
||||
}
|
||||
|
||||
public void TranslateTransform (float dx, float dy, MatrixOrder order) {
|
||||
BrushTranslateTransform(dx, dy, order);
|
||||
}
|
||||
|
||||
public override object Clone () {
|
||||
LinearGradientBrush copy = (LinearGradientBrush)InternalClone();
|
||||
|
||||
if (copy._nativeObject != null)
|
||||
copy._nativeObject = null;
|
||||
|
||||
if (_interpolationColors != null) {
|
||||
copy._interpolationColors = new ColorBlend();
|
||||
if (_interpolationColors.Colors != null)
|
||||
copy._interpolationColors.Colors = (Color[])_interpolationColors.Colors.Clone();
|
||||
if (_interpolationColors.Positions != null)
|
||||
copy._interpolationColors.Positions = (float[])_interpolationColors.Positions.Clone();
|
||||
}
|
||||
|
||||
if (_blend != null) {
|
||||
copy._blend = new Blend();
|
||||
if (_blend.Factors != null)
|
||||
copy._blend.Factors = (float[])_blend.Factors.Clone();
|
||||
if (_blend.Positions != null)
|
||||
copy._blend.Positions = (float[])_blend.Positions.Clone();
|
||||
}
|
||||
|
||||
copy.LinearColors = (Color[])LinearColors.Clone();
|
||||
return copy;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -1,295 +0,0 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
using geom = java.awt.geom;
|
||||
using JMath = java.lang.Math;
|
||||
|
||||
namespace System.Drawing.Drawing2D
|
||||
{
|
||||
public sealed class Matrix : MarshalByRefObject, IDisposable
|
||||
{
|
||||
#region fields
|
||||
|
||||
static internal readonly Matrix IdentityTransform = new Matrix();
|
||||
readonly geom.AffineTransform _nativeMatrix;
|
||||
|
||||
#endregion
|
||||
|
||||
#region ctors
|
||||
|
||||
internal Matrix (geom.AffineTransform ptr)
|
||||
{
|
||||
_nativeMatrix = ptr;
|
||||
}
|
||||
|
||||
public Matrix () : this(new geom.AffineTransform())
|
||||
{
|
||||
}
|
||||
|
||||
public Matrix (Rectangle rect , Point[] plgpts)
|
||||
{
|
||||
double x1 = plgpts[1].X - plgpts[0].X;
|
||||
double y1 = plgpts[1].Y - plgpts[0].Y;
|
||||
|
||||
double x2 = plgpts[2].X - plgpts[0].X;
|
||||
double y2 = plgpts[2].Y - plgpts[0].Y;
|
||||
|
||||
_nativeMatrix = new geom.AffineTransform(x1/rect.Width, y1/rect.Width, x2/rect.Height, y2/rect.Height, plgpts[0].X, plgpts[0].Y);
|
||||
_nativeMatrix.translate(-rect.X,-rect.Y);
|
||||
}
|
||||
|
||||
public Matrix (RectangleF rect , PointF[] plgpts)
|
||||
{
|
||||
double x1 = plgpts[1].X - plgpts[0].X;
|
||||
double y1 = plgpts[1].Y - plgpts[0].Y;
|
||||
|
||||
double x2 = plgpts[2].X - plgpts[0].X;
|
||||
double y2 = plgpts[2].Y - plgpts[0].Y;
|
||||
|
||||
_nativeMatrix = new geom.AffineTransform(x1/rect.Width, y1/rect.Width, x2/rect.Height, y2/rect.Height, plgpts[0].X, plgpts[0].Y);
|
||||
_nativeMatrix.translate(-rect.X,-rect.Y);
|
||||
}
|
||||
|
||||
public Matrix (float m11, float m12, float m21, float m22, float dx, float dy)
|
||||
: this(new geom.AffineTransform(m11,m12,m21,m22,dx,dy))
|
||||
{
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region properties
|
||||
|
||||
public float[] Elements
|
||||
{
|
||||
get
|
||||
{
|
||||
float [] elems = new float[] {
|
||||
(float)NativeObject.getScaleX(),
|
||||
(float)NativeObject.getShearY(),
|
||||
(float)NativeObject.getShearX(),
|
||||
(float)NativeObject.getScaleY(),
|
||||
(float)NativeObject.getTranslateX(),
|
||||
(float)NativeObject.getTranslateY()};
|
||||
return elems;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsIdentity
|
||||
{
|
||||
get
|
||||
{
|
||||
return NativeObject.isIdentity();
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsInvertible
|
||||
{
|
||||
get
|
||||
{
|
||||
try
|
||||
{
|
||||
return NativeObject.getDeterminant() != 0.0;
|
||||
}
|
||||
catch(geom.NoninvertibleTransformException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public float OffsetX
|
||||
{
|
||||
get
|
||||
{
|
||||
return (float)NativeObject.getTranslateX();
|
||||
}
|
||||
}
|
||||
|
||||
public float OffsetY
|
||||
{
|
||||
get
|
||||
{
|
||||
return (float)NativeObject.getTranslateY();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region methods
|
||||
|
||||
public Matrix Clone()
|
||||
{
|
||||
return new Matrix ((geom.AffineTransform) NativeObject.clone ());
|
||||
}
|
||||
|
||||
|
||||
public void Dispose ()
|
||||
{
|
||||
}
|
||||
|
||||
internal void CopyTo(Matrix matrix) {
|
||||
matrix.NativeObject.setTransform(NativeObject);
|
||||
}
|
||||
|
||||
public override bool Equals (object obj)
|
||||
{
|
||||
Matrix m = obj as Matrix;
|
||||
|
||||
|
||||
if (m == null)
|
||||
return false;
|
||||
|
||||
return NativeObject.Equals(m.NativeObject);
|
||||
}
|
||||
|
||||
public override int GetHashCode ()
|
||||
{
|
||||
return NativeObject.GetHashCode();
|
||||
}
|
||||
|
||||
public void Invert ()
|
||||
{
|
||||
try {
|
||||
_nativeMatrix.setTransform( _nativeMatrix.createInverse() );
|
||||
}
|
||||
catch(geom.NoninvertibleTransformException e) {
|
||||
throw new ArgumentException(e.Message, e);
|
||||
}
|
||||
}
|
||||
|
||||
public void Multiply (Matrix matrix)
|
||||
{
|
||||
Multiply (matrix, MatrixOrder.Prepend);
|
||||
}
|
||||
|
||||
public void Multiply (Matrix matrix, MatrixOrder order)
|
||||
{
|
||||
Multiply(matrix.NativeObject, order);
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
NativeObject.setToIdentity();
|
||||
}
|
||||
|
||||
public void Rotate (float angle)
|
||||
{
|
||||
NativeObject.rotate (JMath.toRadians(angle));
|
||||
}
|
||||
|
||||
public void Rotate (float angle, MatrixOrder order)
|
||||
{
|
||||
Multiply(geom.AffineTransform.getRotateInstance(JMath.toRadians(angle)), order);
|
||||
}
|
||||
|
||||
public void RotateAt (float angle, PointF point)
|
||||
{
|
||||
NativeObject.rotate (JMath.toRadians(angle), point.X, point.Y);
|
||||
}
|
||||
|
||||
public void RotateAt (float angle, PointF point, MatrixOrder order)
|
||||
{
|
||||
Multiply(geom.AffineTransform.getRotateInstance(JMath.toRadians(angle),point.X, point.Y), order);
|
||||
}
|
||||
|
||||
public void Scale (float scaleX, float scaleY)
|
||||
{
|
||||
NativeObject.scale (scaleX, scaleY);
|
||||
}
|
||||
|
||||
public void Scale (float scaleX, float scaleY, MatrixOrder order)
|
||||
{
|
||||
Multiply(geom.AffineTransform.getScaleInstance(scaleX, scaleY), order);
|
||||
}
|
||||
|
||||
public void Shear (float shearX, float shearY)
|
||||
{
|
||||
NativeObject.shear(shearX, shearY);
|
||||
}
|
||||
|
||||
public void Shear (float shearX, float shearY, MatrixOrder order)
|
||||
{
|
||||
Multiply(geom.AffineTransform.getShearInstance (shearX, shearY), order);
|
||||
}
|
||||
|
||||
public void TransformPoints (Point[] pts)
|
||||
{
|
||||
geom.Point2D.Float pt = new geom.Point2D.Float();
|
||||
for(int i =0;i < pts.Length;i++) {
|
||||
pt.setLocation(pts[i].X,pts[i].Y);
|
||||
NativeObject.transform(pt,pt);
|
||||
pts[i].X=(int)pt.getX();
|
||||
pts[i].Y=(int)pt.getY();
|
||||
}
|
||||
}
|
||||
|
||||
public void TransformPoints (PointF[] pts)
|
||||
{
|
||||
geom.Point2D.Float pt = new geom.Point2D.Float();
|
||||
for(int i =0;i < pts.Length;i++) {
|
||||
pt.setLocation(pts[i].X,pts[i].Y);
|
||||
NativeObject.transform(pt,pt);
|
||||
pts[i].X=(float)pt.getX();
|
||||
pts[i].Y=(float)pt.getY();
|
||||
}
|
||||
}
|
||||
|
||||
public void TransformVectors (Point[] pts)
|
||||
{
|
||||
geom.Point2D.Float pt = new geom.Point2D.Float();
|
||||
for(int i =0;i < pts.Length;i++) {
|
||||
pt.setLocation(pts[i].X,pts[i].Y);
|
||||
NativeObject.deltaTransform(pt,pt);
|
||||
pts[i].X=(int)pt.getX();
|
||||
pts[i].Y=(int)pt.getY();
|
||||
}
|
||||
}
|
||||
|
||||
public void TransformVectors (PointF[] pts)
|
||||
{
|
||||
geom.Point2D.Float pt = new geom.Point2D.Float();
|
||||
for(int i =0;i < pts.Length;i++) {
|
||||
pt.setLocation(pts[i].X,pts[i].Y);
|
||||
NativeObject.deltaTransform(pt,pt);
|
||||
pts[i].X=(float)pt.getX();
|
||||
pts[i].Y=(float)pt.getY();
|
||||
}
|
||||
}
|
||||
|
||||
public void Translate (float offsetX, float offsetY)
|
||||
{
|
||||
NativeObject.translate (offsetX, offsetY);
|
||||
}
|
||||
|
||||
public void Translate (float offsetX, float offsetY, MatrixOrder order)
|
||||
{
|
||||
Multiply(geom.AffineTransform.getTranslateInstance(offsetX, offsetY), order);
|
||||
}
|
||||
|
||||
public void VectorTransformPoints (Point[] pts)
|
||||
{
|
||||
TransformVectors (pts);
|
||||
}
|
||||
|
||||
internal geom.AffineTransform NativeObject
|
||||
{
|
||||
get
|
||||
{
|
||||
return _nativeMatrix;
|
||||
}
|
||||
}
|
||||
|
||||
void Multiply(geom.AffineTransform at, MatrixOrder order) {
|
||||
Multiply(NativeObject, at, order);
|
||||
}
|
||||
|
||||
internal static void Multiply(geom.AffineTransform to, geom.AffineTransform add, MatrixOrder order) {
|
||||
if(order == MatrixOrder.Prepend)
|
||||
to.concatenate(add);
|
||||
else
|
||||
to.preConcatenate(add);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -1,286 +0,0 @@
|
||||
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
using awt = java.awt;
|
||||
|
||||
namespace System.Drawing.Drawing2D {
|
||||
/// <summary>
|
||||
/// Summary description for PathGradientBrush.
|
||||
/// </summary>
|
||||
[MonoTODO]
|
||||
public sealed class PathGradientBrush : Brush {
|
||||
Brush _nativeObject;
|
||||
Blend _blend;
|
||||
Color _centerColor;
|
||||
PointF _center;
|
||||
PointF _focus;
|
||||
RectangleF _rectangle;
|
||||
Color [] _surroundColors;
|
||||
ColorBlend _interpolationColors;
|
||||
WrapMode _wrapMode;
|
||||
GraphicsPath _texturePath;
|
||||
bool _triangularShape = false;
|
||||
|
||||
protected override java.awt.Paint NativeObject {
|
||||
get {
|
||||
return _nativeObject;
|
||||
}
|
||||
}
|
||||
|
||||
#region initialize
|
||||
|
||||
void Initialize(GraphicsPath path, WrapMode wrapMode, bool initColors, bool calcCenter) {
|
||||
|
||||
_texturePath = path;
|
||||
_wrapMode = wrapMode;
|
||||
_rectangle = path.GetBounds();
|
||||
|
||||
if (initColors) {
|
||||
_centerColor = Color.Black;
|
||||
_surroundColors = new Color []{ Color.White };
|
||||
}
|
||||
|
||||
Bitmap texture = new Bitmap( (int)_rectangle.Width, (int)_rectangle.Height );
|
||||
Graphics g = Graphics.FromImage( texture );
|
||||
PointF [] pathPoints = path.PathPoints;
|
||||
|
||||
if (calcCenter) {
|
||||
for (int i=0; i < pathPoints.Length; i++) {
|
||||
_center.X += pathPoints[i].X;
|
||||
_center.Y += pathPoints[i].Y;
|
||||
}
|
||||
_center.X /= pathPoints.Length;
|
||||
_center.Y /= pathPoints.Length;
|
||||
}
|
||||
|
||||
int outerColor = 0;
|
||||
DrawSector( g, CenterPoint, pathPoints[pathPoints.Length-1], pathPoints[0], CenterColor, SurroundColors[outerColor] );
|
||||
for(int i=0; i < pathPoints.Length - 1; i++) {
|
||||
if (outerColor < SurroundColors.Length - 1)
|
||||
outerColor++;
|
||||
DrawSector( g, CenterPoint, pathPoints[i], pathPoints[i+1], CenterColor, SurroundColors[outerColor] );
|
||||
}
|
||||
|
||||
_nativeObject = new TextureBrush( texture );
|
||||
}
|
||||
private void DrawSector(Graphics g, PointF center, PointF p1, PointF p2, Color innerColor, Color outerColor) {
|
||||
GraphicsPath pt = new GraphicsPath();
|
||||
pt.AddLine(p1, center);
|
||||
pt.AddLine(center, p2);
|
||||
LinearGradientBrush lgb = new LinearGradientBrush( GetVertical(center, p1, p2) , center, outerColor, innerColor );
|
||||
if (_triangularShape)
|
||||
lgb.SetBlendTriangularShape(0.5f);
|
||||
g.FillPath( lgb, pt );
|
||||
}
|
||||
private PointF GetVertical(PointF c, PointF p1, PointF p2) {
|
||||
if (p1.X == p2.X)
|
||||
return new PointF(p1.X, c.Y);
|
||||
if (p1.Y == p2.Y)
|
||||
return new PointF(c.X, p2.Y);
|
||||
|
||||
float a = (float)(p2.Y - p1.Y) / (p2.X - p1.X);
|
||||
float av = - 1 / a;
|
||||
|
||||
float b1 = p1.Y - a * p1.X;
|
||||
float b2 = c.Y - av * c.X;
|
||||
|
||||
float ox = (b1 - b2) / (av - a);
|
||||
float oy = av * ox + b2;
|
||||
|
||||
return new PointF(ox, oy);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region ctors
|
||||
|
||||
public PathGradientBrush (GraphicsPath path) {
|
||||
Initialize( path, WrapMode.Clamp, true, true );
|
||||
}
|
||||
|
||||
public PathGradientBrush (Point [] points) : this (points, WrapMode.Clamp) {
|
||||
}
|
||||
|
||||
public PathGradientBrush (PointF [] points) : this (points, WrapMode.Clamp) {
|
||||
}
|
||||
|
||||
public PathGradientBrush (Point [] points, WrapMode wrapMode) {
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
path.AddLines( points );
|
||||
Initialize( path, wrapMode, true, true );
|
||||
}
|
||||
|
||||
public PathGradientBrush (PointF [] points, WrapMode wrapMode) {
|
||||
GraphicsPath path = new GraphicsPath();
|
||||
path.AddLines( points );
|
||||
Initialize( path, wrapMode, true, true );
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties
|
||||
|
||||
[MonoTODO]
|
||||
public Blend Blend {
|
||||
get {
|
||||
return _blend;
|
||||
}
|
||||
set {
|
||||
_blend = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Color CenterColor {
|
||||
get {
|
||||
return _centerColor;
|
||||
}
|
||||
set {
|
||||
_centerColor = value;
|
||||
Initialize(_texturePath, _wrapMode, false, false );
|
||||
}
|
||||
}
|
||||
|
||||
public PointF CenterPoint {
|
||||
get {
|
||||
return _center;
|
||||
}
|
||||
set {
|
||||
_center = value;
|
||||
Initialize(_texturePath, _wrapMode, false, false );
|
||||
}
|
||||
}
|
||||
|
||||
public PointF FocusScales {
|
||||
get {
|
||||
return _focus;
|
||||
}
|
||||
set {
|
||||
_focus = value;
|
||||
}
|
||||
}
|
||||
|
||||
public ColorBlend InterpolationColors {
|
||||
get {
|
||||
return _interpolationColors;
|
||||
}
|
||||
set {
|
||||
_interpolationColors = value;
|
||||
}
|
||||
}
|
||||
|
||||
public RectangleF Rectangle {
|
||||
get {
|
||||
return _rectangle;
|
||||
}
|
||||
}
|
||||
|
||||
public Color [] SurroundColors {
|
||||
get {
|
||||
return _surroundColors;
|
||||
}
|
||||
set {
|
||||
_surroundColors = value;
|
||||
Initialize(_texturePath, _wrapMode, false, false );
|
||||
}
|
||||
}
|
||||
|
||||
public Matrix Transform {
|
||||
get {
|
||||
return BrushTransform;
|
||||
}
|
||||
set {
|
||||
BrushTransform = value;
|
||||
}
|
||||
}
|
||||
|
||||
public WrapMode WrapMode {
|
||||
get {
|
||||
return _wrapMode;
|
||||
}
|
||||
set {
|
||||
_wrapMode = value;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
public void MultiplyTransform (Matrix matrix) {
|
||||
base.BrushMultiplyTransform( matrix );
|
||||
}
|
||||
|
||||
public void MultiplyTransform (Matrix matrix, MatrixOrder order) {
|
||||
base.BrushMultiplyTransform( matrix, order );
|
||||
}
|
||||
|
||||
public void ResetTransform () {
|
||||
base.BrushResetTransform();
|
||||
}
|
||||
|
||||
public void RotateTransform (float angle) {
|
||||
base.BrushRotateTransform( angle );
|
||||
}
|
||||
|
||||
public void RotateTransform (float angle, MatrixOrder order) {
|
||||
base.BrushRotateTransform( angle, order );
|
||||
}
|
||||
|
||||
public void ScaleTransform (float sx, float sy) {
|
||||
base.BrushScaleTransform( sx, sy );
|
||||
}
|
||||
|
||||
public void ScaleTransform (float sx, float sy, MatrixOrder order) {
|
||||
base.BrushScaleTransform( sx, sy, order );
|
||||
}
|
||||
|
||||
public void SetBlendTriangularShape (float focus) {
|
||||
SetBlendTriangularShape (focus, 1.0F);
|
||||
}
|
||||
|
||||
public void SetBlendTriangularShape (float focus, float scale) {
|
||||
_triangularShape = true;
|
||||
Initialize( _texturePath, _wrapMode, false, false );
|
||||
}
|
||||
|
||||
public void SetSigmaBellShape (float focus) {
|
||||
SetSigmaBellShape (focus, 1.0F);
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public void SetSigmaBellShape (float focus, float scale) {
|
||||
// FALLBACK: Triangle shape used
|
||||
SetBlendTriangularShape (focus, scale);
|
||||
}
|
||||
|
||||
public void TranslateTransform (float dx, float dy) {
|
||||
base.BrushTranslateTransform( dx, dy );
|
||||
}
|
||||
|
||||
public void TranslateTransform (float dx, float dy, MatrixOrder order) {
|
||||
base.BrushTranslateTransform( dx, dy, order );
|
||||
}
|
||||
|
||||
public override object Clone () {
|
||||
PathGradientBrush copy = (PathGradientBrush)InternalClone();
|
||||
|
||||
if (copy._nativeObject != null)
|
||||
copy._nativeObject = (Brush)copy._nativeObject.Clone();
|
||||
|
||||
if (copy._surroundColors != null)
|
||||
copy._surroundColors = (Color[])copy._surroundColors.Clone();
|
||||
|
||||
if (copy._texturePath != null)
|
||||
copy._texturePath = (GraphicsPath)copy._texturePath.Clone();
|
||||
|
||||
//TBD: clone _blend, _interpolationColors
|
||||
//copy._blend = copy._blend
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -34,9 +34,6 @@ namespace System.Drawing.Imaging
|
||||
{
|
||||
// MUST BE KEPT IN SYNC WITH gdip.h in libgdiplus!
|
||||
// The first 6 fields MUST also match MS definition
|
||||
#if TARGET_JVM
|
||||
[MonoTODO]
|
||||
#endif
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public sealed class BitmapData {
|
||||
private int width;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user