Imported Upstream version 3.10.0

Former-commit-id: 172c8e3c300b39d5785c7a3e8dfb08ebdbc1a99b
This commit is contained in:
Jo Shields
2014-10-04 11:27:48 +01:00
parent fe777c5c82
commit 8b9b85e7f5
970 changed files with 20242 additions and 31308 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,85 +0,0 @@
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Runtime.InteropServices;
using awt = java.awt;
using geom = java.awt.geom;
namespace System.Drawing
{
/// <summary>
/// Summary description for BasicShape.
/// </summary>
public abstract class BasicShape : MarshalByRefObject, awt.Shape, IDisposable
{
awt.Shape _shape;
protected BasicShape(awt.Shape shape)
{
_shape = shape;
}
protected awt.Shape Shape {
get {
return _shape;
}
set {
_shape = value;
}
}
#region IDisposable
public void Dispose () {
Dispose (true);
}
void Dispose (bool disposing) {
}
#endregion
#region Shape Members
awt.Rectangle awt.Shape.getBounds() {
return Shape.getBounds();
}
bool awt.Shape.contains(double arg_0, double arg_1) {
return Shape.contains(arg_0, arg_1);
}
bool awt.Shape.contains(geom.Point2D arg_0) {
return Shape.contains(arg_0);
}
bool awt.Shape.contains(double arg_0, double arg_1, double arg_2, double arg_3) {
return Shape.contains(arg_0, arg_1, arg_2, arg_3);
}
bool awt.Shape.contains(geom.Rectangle2D arg_0) {
return Shape.contains(arg_0);
}
geom.PathIterator awt.Shape.getPathIterator(geom.AffineTransform arg_0) {
return Shape.getPathIterator(arg_0);
}
geom.PathIterator awt.Shape.getPathIterator(geom.AffineTransform arg_0, double arg_1) {
return Shape.getPathIterator(arg_0, arg_1);
}
geom.Rectangle2D awt.Shape.getBounds2D() {
return Shape.getBounds2D();
}
bool awt.Shape.intersects(double arg_0, double arg_1, double arg_2, double arg_3) {
return Shape.intersects(arg_0, arg_1, arg_2, arg_3);
}
bool awt.Shape.intersects(geom.Rectangle2D arg_0) {
return Shape.intersects(arg_0);
}
#endregion
}
}

View File

@ -1,427 +0,0 @@
using System;
using System.IO;
using System.Drawing.Imaging;
using System.Runtime.Serialization;
using Mainsoft.Drawing.Imaging;
using io = java.io;
using imageio = javax.imageio;
using stream = javax.imageio.stream;
using spi = javax.imageio.spi;
using BufferedImage = java.awt.image.BufferedImage;
using JavaImage = java.awt.Image;
using awt = java.awt;
using image = java.awt.image;
namespace System.Drawing
{
public sealed class Bitmap : Image {
# region Static fields
static readonly image.ColorModel _jpegColorModel = new image.DirectColorModel(24, 0x00ff0000, 0x0000ff00, 0x000000ff, 0x0);
#endregion
#region constructors
Bitmap (PlainImage orig) {
base.Initialize( orig, false );
}
[MonoTODO]
private Bitmap (SerializationInfo info, StreamingContext context) {
throw new NotImplementedException ();
}
public Bitmap (int width, int height, Graphics g)
:this (width, height, PixelFormat.Format32bppArgb) {
CurrentImage.HorizontalResolution = g.DpiX;
CurrentImage.VerticalResolution = g.DpiY;
}
public Bitmap (Image original)
:this (original, original.Size) {}
public Bitmap (Image orig, Size newSize)
:this (orig, newSize.Width, newSize.Height) {}
public Bitmap (Image orig, int width, int height)
:base (CreateScaledImage (orig, width, height), ImageFormat.MemoryBmp) {}
internal Bitmap (java.awt.Image nativeObject, ImageFormat format)
:base (nativeObject, format) {}
[MonoTODO]
private Bitmap (java.awt.Image nativeObject, ImageFormat format, PixelFormat pixFormat)
:this (nativeObject, format) {
if (pixFormat != this.PixelFormat)
throw new NotImplementedException ("Converting PixelFormat is not implemented yet.");
}
public Bitmap (int width, int height)
:this (width, height, PixelFormat.Format32bppArgb) {}
public Bitmap (int width, int height, PixelFormat format)
:base (
new java.awt.image.BufferedImage (width, height,
ToBufferedImageFormat (format)),
ImageFormat.Bmp) {
}
public Bitmap (Stream stream)
:this (stream, false) {}
public Bitmap (string filename)
:this (filename, false) {}
[MonoTODO]
public Bitmap (Stream stream, bool useIcm)
:this (stream, useIcm, null) {}
[MonoTODO]
public Bitmap (string filename, bool useIcm)
:this (filename, useIcm, null) {}
internal Bitmap (Stream stream, bool useIcm, ImageFormat format) {
// TBD: useIcm param
io.InputStream jis = vmw.common.IOUtils.ToInputStream (stream);
Initialize (new stream.MemoryCacheImageInputStream (jis), format);
}
internal Bitmap (string filename, bool useIcm, ImageFormat format) {
using(FileStream stream = new FileStream(filename, FileMode.Open, FileAccess.Read)) {
// TBD: useIcm param
io.InputStream jis = vmw.common.IOUtils.ToInputStream (stream);
Initialize (new stream.MemoryCacheImageInputStream (jis), format);
}
}
public Bitmap (Type type, string resource) {
using (Stream s = type.Assembly.GetManifestResourceStream (resource)) {
if (s == null)
throw new ArgumentException("Resource '" + resource + "' could not be found in class '" + type.ToString() + "'");
io.InputStream jis = vmw.common.IOUtils.ToInputStream (s);
Initialize (new stream.MemoryCacheImageInputStream (jis), null);
}
}
#if INTPTR_SUPPORT
[MonoTODO]
public Bitmap (int width, int height, int stride, PixelFormat format, IntPtr scan0)
{
throw new NotImplementedException();
}
#endif
#endregion
#region Internal Initialization
private void Initialize (stream.ImageInputStream input, ImageFormat format) {
ImageCodec ic = null;
if (format == null)
ic = ImageCodec.CreateReader(input);
else
ic = ImageCodec.CreateReader(format);
if (ic == null)
throw new ArgumentException ("Parameter is not valid.");
try {
ic.NativeStream = input;
PlainImage pi = ic.ReadPlainImage();
base.Initialize( pi, false );
pi = ic.ReadNextPlainImage();
while ( pi != null) {
base.Initialize( pi, true );
pi = ic.ReadNextPlainImage();
}
_flags |= (int)(ImageFlags.ImageFlagsReadOnly | ImageFlags.ImageFlagsHasRealPixelSize);
}
catch (IOException ex) {
throw ex;
}
finally {
ic.Dispose();
}
}
#endregion
#region InternalSave
protected override void InternalSave (stream.ImageOutputStream output, Guid clsid) {
ImageCodec ic = ImageCodec.CreateWriter( clsid );
using (ic) {
PlainImage plainImage = CurrentImage;
plainImage.NativeImage.flush();
if ( ImageCodec.ClsidToImageFormat( clsid ).Equals( ImageFormat.Jpeg ) ) {
image.ColorModel cm = ((image.BufferedImage)CurrentImage.NativeImage).getColorModel();
if (cm.hasAlpha()) {
if (cm is image.DirectColorModel) {
image.Raster raster = ((image.BufferedImage)CurrentImage.NativeImage).getRaster();
image.DataBuffer db = raster.getDataBuffer();
image.DirectColorModel dcm = (image.DirectColorModel)cm;
image.SinglePixelPackedSampleModel jpegSampleModel = new image.SinglePixelPackedSampleModel(
db.getDataType(), Width, Height,
new int[] {dcm.getRedMask(), dcm.getGreenMask(), dcm.getBlueMask()} );
image.BufferedImage tb = new image.BufferedImage(
_jpegColorModel,
image.Raster.createWritableRaster( jpegSampleModel, db, null ),
false, null );
plainImage = new PlainImage( tb, plainImage.Thumbnails, ImageFormat.Jpeg, plainImage.HorizontalResolution, plainImage.VerticalResolution, plainImage.Dimension );
plainImage.NativeMetadata = plainImage.NativeMetadata;
}
}
}
ic.NativeStream = output;
ic.WritePlainImage( plainImage );
}
}
#endregion
#region private statics: ToBufferedImageFormat, CreateScaledImage
private static int ToBufferedImageFormat (PixelFormat format) {
switch(format) {
case PixelFormat.Format16bppGrayScale:
return BufferedImage.TYPE_USHORT_GRAY;
case PixelFormat.Format1bppIndexed:
return BufferedImage.TYPE_BYTE_GRAY;
case PixelFormat.Format32bppArgb:
return BufferedImage.TYPE_INT_ARGB;
case PixelFormat.Format32bppRgb:
return BufferedImage.TYPE_INT_RGB;
case PixelFormat.Format32bppPArgb:
return BufferedImage.TYPE_INT_ARGB_PRE;
case PixelFormat.Format16bppRgb555:
return BufferedImage.TYPE_USHORT_555_RGB;
case PixelFormat.Format16bppRgb565:
return BufferedImage.TYPE_USHORT_565_RGB;
case PixelFormat.Indexed:
return BufferedImage.TYPE_BYTE_INDEXED;
default:
return BufferedImage.TYPE_INT_ARGB;
}
}
private static java.awt.Image CreateScaledImage(Image original, int width, int height) {
JavaImage oldscaled = original.CurrentImage.NativeImage.getScaledInstance(width, height,
JavaImage.SCALE_DEFAULT);
BufferedImage newimage = new BufferedImage(oldscaled.getWidth(null),
oldscaled.getHeight(null),
BufferedImage.TYPE_INT_ARGB);
java.awt.Graphics2D graphics2d = newimage.createGraphics();
graphics2d.drawImage(oldscaled, 0, 0, null);
graphics2d.dispose();
return newimage;
}
#endregion
#region Get-SetPixel
public Color GetPixel (int x, int y)
{
int argb = NativeObject.getRGB(x,y);
return Color.FromArgb(argb);
}
public void SetPixel (int x, int y, Color color)
{
int rgb = color.ToArgb();
NativeObject.setRGB(x,y,rgb);
}
#endregion
#region Clone
public override object Clone () {
return new Bitmap ( (PlainImage)CurrentImage.Clone() );
}
public Bitmap Clone (Rectangle rect, PixelFormat pixFormat)
{
return Clone(new RectangleF( rect.X, rect.Y, rect.Width, rect.Height ), pixFormat);
}
public Bitmap Clone (RectangleF rect, PixelFormat pixFormat)
{
PlainImage plainImage = CurrentImage.Clone(false);
BufferedImage clone = new BufferedImage( (int)rect.Width, (int)rect.Height, ToBufferedImageFormat( pixFormat ) );
awt.Graphics2D g = clone.createGraphics();
try {
g.drawImage( NativeObject, -(int)rect.X, -(int)rect.Y, null );
}
finally {
g.dispose();
}
plainImage.NativeImage = clone;
return new Bitmap(plainImage);
}
#endregion
#region LockBits
[MonoTODO]
public BitmapData LockBits (Rectangle rect, ImageLockMode flags, PixelFormat format) {
throw new NotImplementedException();
}
#if NET_2_0
public
#endif
BitmapData LockBits (Rectangle rect, ImageLockMode flags, PixelFormat format, BitmapData bitmapData) {
throw new NotImplementedException();
}
#endregion
#region MakeTransparent
public void MakeTransparent ()
{
Color clr = Color.FromArgb(0,0,0);
MakeTransparent (clr);
}
public void MakeTransparent (Color transparentColor)
{
image.WritableRaster raster = NativeObject.getRaster();
int numBands = raster.getNumBands();
if (numBands != 4)
return;
int maxWidth = raster.getWidth() + raster.getMinX();
int maxHeight = raster.getHeight() + raster.getMinY();
int[] srcPix = new int[numBands];
for (int y = raster.getMinY(); y < maxHeight; y++) {
for (int x = raster.getMinX(); x < maxWidth; x++) {
/*srcPix =*/ raster.getPixel(x, y, srcPix);
if (srcPix[0] == transparentColor.R &&
srcPix[1] == transparentColor.G &&
srcPix[2] == transparentColor.B) {
srcPix[3] = 0;
raster.setPixel(x, y, srcPix);
}
}
}
}
#endregion
#region SetResolution
public void SetResolution (float xDpi, float yDpi)
{
CurrentImage.HorizontalResolution = xDpi;
CurrentImage.VerticalResolution = yDpi;
}
#endregion
#region UnlockBits
[MonoTODO]
public void UnlockBits (BitmapData bitmap_data)
{
throw new NotImplementedException();
}
#endregion
#region NativeObject
internal new BufferedImage NativeObject {
get {
return (BufferedImage)base.NativeObject.CurrentImage.NativeImage;
}
}
protected override java.awt.Image[] CloneNativeObjects(java.awt.Image[] src) {
if (src == null)
return null;
awt.Image[] dst = new awt.Image[src.Length];
for (int i = 0; i < dst.Length; i++) {
BufferedImage image = src[i] as BufferedImage;
if (image == null)
throw new ArgumentException(String.Format("Unsupported image type '{0}'", src[i].ToString()), "src");
dst[i] = new BufferedImage(image.getColorModel(), image.copyData(null), image.isAlphaPremultiplied(), null);
}
return dst;
}
#endregion
#region InternalPixelFormat
protected override PixelFormat InternalPixelFormat {
get {
int t = NativeObject.getType();
switch(t) {
case 11://JavaImage.TYPE_USHORT_GRAY:
return PixelFormat.Format16bppGrayScale;
case 10://JavaImage.TYPE_BYTE_GRAY:
return PixelFormat.Format8bppIndexed;
case 1: //JavaImage.TYPE_INT_RGB
return PixelFormat.Format32bppRgb;
case 2: //JavaImage.TYPE_INT_ARGB:
return PixelFormat.Format32bppArgb;
case 3://JavaImage.TYPE_INT_ARGB_PRE:
return PixelFormat.Format32bppPArgb;
case 9://JavaImage.TYPE_USHORT_555_RGB:
return PixelFormat.Format16bppRgb555;
case 8://JavaImage.TYPE_USHORT_565_RGB:
return PixelFormat.Format16bppRgb565;
case 13://JavaImage.TYPE_BYTE_INDEXED:
return PixelFormat.Indexed;
//TBD: support this
case 12://JavaImage.TYPE_BYTE_BINARY:
case 0://JavaImage.TYPE_CUSTOM:
case 4://JavaImage.TYPE_INT_BGR:
case 5://JavaImage.TYPE_3BYTE_BGR:
case 6://JavaImage.TYPE_4BYTE_ABGR:
case 7://JavaImage.TYPE_4BYTE_ABGR_PRE:
default:
return PixelFormat.Undefined;
}
}
}
#endregion
#if INTPTR_SUPPORT
[MonoTODO]
public static Bitmap FromHicon (IntPtr hicon)
{
throw new NotImplementedException();
}
[MonoTODO]
public static Bitmap FromResource (IntPtr hinstance, string bitmapName) //TBD: Untested
{
throw new NotImplementedException();
}
[MonoTODO]
public IntPtr GetHbitmap ()
{
throw new NotImplementedException();
}
[MonoTODO]
public IntPtr GetHbitmap (Color background)
{
throw new NotImplementedException();
}
[MonoTODO]
public IntPtr GetHicon ()
{
throw new NotImplementedException();
}
#endif
}
}

View File

@ -1,104 +0,0 @@
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Collections;
using awt = java.awt;
using image = java.awt.image;
using geom = java.awt.geom;
namespace System.Drawing
{
public abstract class Brush : MarshalByRefObject, ICloneable, IDisposable, awt.Paint {
#region fields
private Matrix _brushTransform = new Matrix();
#endregion
protected abstract java.awt.Paint NativeObject {
get;
}
awt.PaintContext awt.Paint.createContext (image.ColorModel cm,
awt.Rectangle deviceBounds, geom.Rectangle2D userBounds, geom.AffineTransform xform,
awt.RenderingHints hints) {
return createContextInternal(cm, deviceBounds, userBounds, xform, hints);
}
protected virtual awt.PaintContext createContextInternal (image.ColorModel cm,
awt.Rectangle deviceBounds, geom.Rectangle2D userBounds, geom.AffineTransform xform,
awt.RenderingHints hints) {
Matrix.Multiply(xform, _brushTransform.NativeObject, MatrixOrder.Append);
return NativeObject.createContext (cm, deviceBounds, userBounds, xform, hints);
}
int awt.Transparency.getTransparency () {
return NativeObject.getTransparency ();
}
abstract public object Clone ();
public void Dispose () {
Dispose (true);
}
protected virtual void Dispose (bool disposing) {
}
protected Brush InternalClone() {
Brush brush = (Brush)this.MemberwiseClone();
brush._brushTransform = this._brushTransform.Clone();
return brush;
}
#region Brush transform
internal Matrix BrushTransform {
get { return _brushTransform.Clone(); }
set {
if (value == null)
throw new ArgumentNullException("matrix");
value.CopyTo( _brushTransform );
}
}
protected internal void BrushTranslateTransform (float dx, float dy) {
BrushTranslateTransform(dx, dy, MatrixOrder.Prepend);
}
protected internal void BrushTranslateTransform (float dx, float dy, MatrixOrder order) {
_brushTransform.Translate(dx,dy,order);
}
protected internal void BrushResetTransform () {
_brushTransform.Reset();
}
protected internal void BrushRotateTransform (float angle) {
BrushRotateTransform(angle, MatrixOrder.Prepend);
}
protected internal void BrushRotateTransform (float angle, MatrixOrder order) {
_brushTransform.Rotate(angle, order);
}
protected internal void BrushScaleTransform (float sx, float sy) {
BrushScaleTransform(sx, sy, MatrixOrder.Prepend);
}
protected internal void BrushScaleTransform (float sx, float sy, MatrixOrder order) {
_brushTransform.Scale(sx, sy, order);
}
protected internal void BrushMultiplyTransform (Matrix matrix) {
BrushMultiplyTransform(matrix, MatrixOrder.Prepend);
}
protected internal void BrushMultiplyTransform (Matrix matrix, MatrixOrder order) {
if (matrix == null)
throw new ArgumentNullException("matrix");
_brushTransform.Multiply(matrix, order);
}
#endregion
}
}

View File

@ -42,9 +42,7 @@ namespace System.Drawing
#if ONLY_1_1
[ComVisible (true)]
#endif
#if !TARGET_JVM
[Editor ("System.Drawing.Design.ColorEditor, " + Consts.AssemblySystem_Drawing_Design, typeof (System.Drawing.Design.UITypeEditor))]
#endif
[Serializable]
public struct Color {
@ -71,29 +69,6 @@ namespace System.Drawing
// however it's bad to keep a string (reference) in a struct
internal string name;
// #endif
#if TARGET_JVM
internal java.awt.Color NativeObject {
get {
return new java.awt.Color (R, G, B, A);
}
}
internal static Color FromArgbNamed (int alpha, int red, int green, int blue, string name, KnownColor knownColor)
{
Color color = FromArgb (alpha, red, green, blue);
color.state = (short) (ColorType.Known|ColorType.Named);
color.name = KnownColors.GetName (knownColor);
color.knownColor = (short) knownColor;
return color;
}
internal static Color FromArgbSystem (int alpha, int red, int green, int blue, string name, KnownColor knownColor)
{
Color color = FromArgbNamed (alpha, red, green, blue, name, knownColor);
color.state |= (short) ColorType.System;
return color;
}
#endif
public string Name {
get {

View File

@ -225,15 +225,10 @@ namespace System.Drawing
lock (creatingCached) {
if (cached != null)
return cached;
#if TARGET_JVM
Color [] colors = new Color [KnownColors.Values.Length - 1];
Array.Copy (KnownColors.Values, 1, colors, 0, colors.Length);
#else
Array colors = Array.CreateInstance (typeof (Color), KnownColors.ArgbValues.Length - 1);
for (int i=1; i < KnownColors.ArgbValues.Length; i++) {
colors.SetValue (KnownColors.FromKnownColor ((KnownColor)i), i - 1);
}
#endif
Array.Sort (colors, 0, colors.Length, new CompareColors ());
cached = new StandardValuesCollection (colors);

View File

@ -1,382 +0,0 @@
using System.Runtime.Serialization;
using System.Runtime.InteropServices;
using System.ComponentModel;
using awt = java.awt;
using TextAttribute = java.awt.font.TextAttribute;
namespace System.Drawing {
[Serializable]
public sealed class Font: MarshalByRefObject, ISerializable, ICloneable, IDisposable {
#region variables
const byte DEFAULT_CHARSET = 1;
private readonly GraphicsUnit _gUnit = GraphicsUnit.Point;
private readonly FontFamily _fontFamily;
private readonly awt.Font _jFont;
private readonly byte _charset;
static readonly float [] _screenResolutionConverter = {
1, // World
1, // Display
1, // Pixel
Graphics.DefaultScreenResolution, // Point
Graphics.DefaultScreenResolution, // Inch
Graphics.DefaultScreenResolution, // Document
Graphics.DefaultScreenResolution // Millimeter
};
#if NET_2_0
private readonly string _systemFontName;
#endif
#endregion
internal awt.Font NativeObject {
get {
return _jFont;
}
}
#region ISerializable
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context) {
info.AddValue("Name", Name);
info.AddValue("Size", Size);
info.AddValue("Style", Style, typeof(FontStyle));
info.AddValue("Unit", Unit, typeof(GraphicsUnit));
}
#endregion
#region ctors
private Font (SerializationInfo info, StreamingContext context)
: this(
info.GetString("Name"),
info.GetSingle("Size"),
(FontStyle)info.GetValue("Style", typeof(FontStyle)),
(GraphicsUnit)info.GetValue("Unit", typeof(GraphicsUnit)) ) {
}
public Font(Font original, FontStyle style) {
_jFont = original.NativeObject.deriveFont( DeriveStyle(original.NativeObject.getAttributes(), style, true) );
_gUnit = original._gUnit;
_fontFamily = original._fontFamily;
_charset = original._charset;
}
public Font(FontFamily family, float emSize)
: this(family, emSize, FontStyle.Regular, GraphicsUnit.Point, DEFAULT_CHARSET, false) {
}
public Font(FontFamily family, float emSize, FontStyle style)
: this(family, emSize, style, GraphicsUnit.Point, DEFAULT_CHARSET, false) {
}
public Font(FontFamily family, float emSize, GraphicsUnit unit)
: this(family, emSize, FontStyle.Regular, unit, DEFAULT_CHARSET, false) {
}
public Font(FontFamily family, float emSize, FontStyle style, GraphicsUnit unit)
: this(family, emSize, style, unit, DEFAULT_CHARSET, false) {
}
public Font(FontFamily family, float emSize, FontStyle style, GraphicsUnit unit, byte charSet)
: this(family, emSize, style, unit, charSet, false) {
}
public Font(FontFamily family, float emSize, FontStyle style, GraphicsUnit unit, byte charSet, bool isVertical) {
if (family == null)
throw new ArgumentNullException("family");
_gUnit = unit;
_fontFamily = family;
_charset = charSet;
java.util.Hashtable attribs = new java.util.Hashtable();
attribs.put(TextAttribute.FAMILY, family.Name/*TODO: family doungrade possibility*/);
//init defaults
attribs.put(TextAttribute.POSTURE, TextAttribute.POSTURE_REGULAR);
float newSize = emSize * Graphics.UnitConversion[ (int)_gUnit ];
attribs.put(TextAttribute.SIZE, new java.lang.Float(newSize));
DeriveStyle(attribs, style, false);
_jFont = family.FamilyFont.deriveFont(attribs);
}
public Font(string familyName, float emSize)
: this(familyName, emSize, FontStyle.Regular, GraphicsUnit.Point, (byte)0, false) {
}
public Font(string familyName, float emSize, FontStyle style)
: this(familyName, emSize, style, GraphicsUnit.Point, (byte)0, false) {
}
public Font(string familyName, float emSize, GraphicsUnit unit)
: this(familyName, emSize, FontStyle.Regular, unit, (byte)0, false) {
}
public Font(string familyName, float emSize, FontStyle style, GraphicsUnit unit)
: this(familyName, emSize, style, unit, (byte)0, false) {
}
public Font(string familyName, float emSize, FontStyle style, GraphicsUnit unit, byte charSet)
: this(familyName, emSize, style, unit, charSet, false) {
}
public Font(string familyName, float emSize, FontStyle style, GraphicsUnit unit, byte charSet, bool isVertical)
: this (GetFontFamily (familyName), emSize, style, unit, charSet, isVertical) {
}
#if NET_2_0
internal Font (string familyName, float emSize, string systemName)
: this (familyName, emSize) {
_systemFontName = systemName;
}
#endif
static FontFamily GetFontFamily (string familyName) {
#if ONLY_1_1
if (familyName == null)
throw new ArgumentNullException ("familyName");
#endif
// NOTE: If family name is null, empty or invalid,
// MS creates Microsoft Sans Serif font.
try {
return new FontFamily (familyName);
}
catch {
return FontFamily.GenericSansSerif;
}
}
#endregion
#region IDisposable members
public void Dispose() {
}
#endregion
#region ICloneable
public object Clone() {
return (Font)MemberwiseClone();
}
#endregion
public override bool Equals (object obj)
{
Font other = obj as Font;
if (other == null) {
return false;
}
return NativeObject.Equals (other.NativeObject);
}
public override int GetHashCode ()
{
return NativeObject.GetHashCode ();
}
#if INTPTR_SUPPORT
[MonoTODO]
public IntPtr ToHfont ()
{
throw new NotImplementedException();
}
#endif
#region public properties
public bool Bold {
get {
return _jFont.isBold();
}
}
public FontFamily FontFamily {
get {
return _fontFamily;
}
}
public byte GdiCharSet {
get {
return _charset;
}
}
public bool GdiVerticalFont {
get {
return Name.StartsWith("@");
}
}
public int Height {
get {
return FontFamily.Container.getFontMetrics(NativeObject).getHeight();
}
}
public float GetHeight () {
return GetHeight (Graphics.DefaultScreenResolution);
}
public float GetHeight (float dpi) {
return (FontFamily.GetLineSpacing (Style) / FontFamily.GetEmHeight (Style))
* (SizeInPoints / _screenResolutionConverter [(int) Unit])
* dpi;
}
public float GetHeight (Graphics graphics) {
if (graphics == null)
throw new ArgumentNullException ("graphics");
return GetHeight (graphics.DpiY);
}
public bool Italic {
get {
return _jFont.isItalic();
}
}
public string Name {
get {
return _jFont.getName();
}
}
public float Size {
get {
return SizeInPoints / Graphics.UnitConversion[ (int)_gUnit ];
}
}
public float SizeInPoints {
get {
return _jFont.getSize2D();
}
}
public bool Strikeout {
get {
try {
if((java.lang.Boolean)_jFont.getAttributes().get(TextAttribute.STRIKETHROUGH)
== TextAttribute.STRIKETHROUGH_ON )
return true;
}
catch {
}
return false;
}
}
public FontStyle Style {
get {
FontStyle style = FontStyle.Regular;
if (Bold)
style |= FontStyle.Bold;
if (Italic)
style |= FontStyle.Italic;
if (Underline)
style |= FontStyle.Underline;
if (Strikeout)
style |= FontStyle.Strikeout;
return style;
}
}
public bool Underline {
get {
try {
if((java.lang.Integer)_jFont.getAttributes().get(TextAttribute.UNDERLINE)
== TextAttribute.UNDERLINE_ON )
return true;
}
catch {
}
return false;
}
}
[TypeConverter(typeof(FontConverter.FontUnitConverter))]
public GraphicsUnit Unit {
get {
return _gUnit;
}
}
#if NET_2_0
[Browsable (false)]
public bool IsSystemFont {
get {
return !string.IsNullOrEmpty (_systemFontName);
}
}
[Browsable (false)]
public string SystemFontName {
get {
return _systemFontName;
}
}
#endif
#endregion
public override System.String ToString() {
return ("[Font: Name="+ Name +", Size="+ Size +", Style="+ Style +", Units="+ Unit +"]");
}
static internal java.util.Map DeriveStyle(java.util.Map attribs, FontStyle style, bool createNew) {
java.util.Map newAttribs;
if (createNew) {
newAttribs = new java.util.Hashtable( attribs.size() );
java.util.Iterator it = attribs.keySet().iterator();
while (it.hasNext ()) {
object key = it.next ();
object value = attribs.get (key);
if (value != null)
newAttribs.put (key, value);
}
}
else
newAttribs = attribs;
//Bold
if((style & FontStyle.Bold) == FontStyle.Bold)
newAttribs.put(TextAttribute.WEIGHT, TextAttribute.WEIGHT_BOLD);
else
newAttribs.remove(TextAttribute.WEIGHT);
//Italic
if((style & FontStyle.Italic) == FontStyle.Italic)
newAttribs.put(TextAttribute.POSTURE, TextAttribute.POSTURE_OBLIQUE);
else
newAttribs.put(TextAttribute.POSTURE, TextAttribute.POSTURE_REGULAR);
//Underline
if((style & FontStyle.Underline) == FontStyle.Underline)
newAttribs.put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
else
newAttribs.remove(TextAttribute.UNDERLINE);
//Strikeout
if((style & FontStyle.Strikeout) == FontStyle.Strikeout)
newAttribs.put(TextAttribute.STRIKETHROUGH, TextAttribute.STRIKETHROUGH_ON);
else
newAttribs.remove(TextAttribute.STRIKETHROUGH);
return newAttribs;
}
}
}

View File

@ -46,12 +46,10 @@ namespace System.Drawing
public FontConverter ()
{
}
#if !TARGET_JVM
~FontConverter ()
{
// required to match API definition
}
#endif
public override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType)
{
if (sourceType == typeof (string))

View File

@ -1,233 +0,0 @@
//
// System.Drawing.FontFamily.cs
//
// (C) 2005 Mainsoft Corporation (http://www.mainsoft.com)
// Author: Konstantin Triger (kostat@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 System.Text;
using System.Runtime.InteropServices;
using System.Globalization;
using awt = java.awt;
using geom = java.awt.geom;
using font = java.awt.font;
using TextAttribute = java.awt.font.TextAttribute;
namespace System.Drawing {
public sealed class FontFamily : MarshalByRefObject, IDisposable {
static readonly FontFamily _genericMonospace;
static readonly FontFamily _genericSansSerif;
static readonly FontFamily _genericSerif;
static readonly FontCollection _installedFonts;
internal static readonly awt.Container Container;
static FontFamily() {
Container = new awt.Container();
_installedFonts = new InstalledFontCollection();
_genericMonospace = new FontFamily(GenericFontFamilies.Monospace);
_genericSansSerif = new FontFamily(GenericFontFamilies.SansSerif);
_genericSerif = new FontFamily(GenericFontFamilies.Serif);
}
private readonly string _name;
private awt.FontMetrics _fontMetrics = null;
private FontStyle _lastStyle = FontStyle.Regular;
private readonly awt.Font _font;
// this is unavailable through Java API, usually 2048 for TT fonts
const int UnitsPerEm = 2048;
// the margin for text drawing
const int DrawMargin = 571;
#region ctors
// dummy ctors to work around convertor problems
internal FontFamily() {}
internal FontFamily(IntPtr family) {}
static string ToGenericFontName(GenericFontFamilies genericFamily) {
switch(genericFamily) {
case GenericFontFamilies.SansSerif:
return "SansSerif";
case GenericFontFamilies.Serif:
return "Serif";
default:
return "Monospaced";
}
}
public FontFamily(string familyName) : this(familyName, null) {
}
public FontFamily(string name, FontCollection fontCollection) {
if (name == null)
throw new ArgumentNullException("name");
if (fontCollection == null)
fontCollection = _installedFonts;
if (fontCollection.Contains(name))
_name = name;
else {
_name = ToGenericFontName(GenericFontFamilies.SansSerif);
fontCollection = _installedFonts;
}
_font = fontCollection.GetInitialFont( _name );
}
public FontFamily(GenericFontFamilies genericFamily) : this(ToGenericFontName(genericFamily)) {
}
#endregion
public string Name {
get {
return _name;
}
}
internal int GetDrawMargin(FontStyle style) {
return DrawMargin;
}
awt.FontMetrics GetMetrics(FontStyle style) {
if ((_lastStyle != style) || (_fontMetrics == null)) {
java.util.Map attrib = Font.DeriveStyle( FamilyFont.getAttributes(), style, true);
attrib.put(TextAttribute.SIZE, new java.lang.Float((float)(UnitsPerEm<<1)));
_fontMetrics = Container.getFontMetrics( FamilyFont.deriveFont( attrib ) );
}
return _fontMetrics;
}
public int GetCellAscent(FontStyle style) {
return GetMetrics(style).getMaxAscent()>>1;
}
public int GetCellDescent(FontStyle style) {
return GetMetrics(style).getMaxDecent()>>1;
}
public int GetEmHeight(FontStyle style) {
return UnitsPerEm;
}
public int GetLineSpacing(FontStyle style) {
return GetMetrics(style).getHeight()>>1;
}
public string GetName(int language) {
try {
CultureInfo culture = new CultureInfo(language, false);
java.util.Locale locale = vmw.@internal.EnvironmentUtils.getLocaleFromCultureInfo( culture );
return FamilyFont.getFamily( locale );
}
catch {
return Name;
}
}
public bool IsStyleAvailable(FontStyle style) {
//unable to get this infromation from java
return true;
}
#region static members
public static FontFamily[] Families {
get {
return _installedFonts.Families;
}
}
public static FontFamily GenericMonospace {
get {
return (FontFamily)_genericMonospace.MemberwiseClone();
}
}
public static FontFamily GenericSansSerif {
get {
return (FontFamily)_genericSansSerif.MemberwiseClone();
}
}
public static FontFamily GenericSerif {
get {
return (FontFamily)_genericSerif.MemberwiseClone();
}
}
public static FontFamily[] GetFamilies(Graphics graphics) {
if (graphics == null) {
throw new ArgumentNullException("graphics");
}
return _installedFonts.Families;
}
#endregion
#region Object members
public override bool Equals(object obj) {
if (this == obj)
return true;
if (!(obj is FontFamily))
return false;
return string.Compare(Name, ((FontFamily)obj).Name, true) == 0;
}
public override int GetHashCode() {
return Name.ToLower().GetHashCode();
}
public override string ToString() {
return string.Format("[{0}: Name={1}]", GetType().Name, Name);
}
#endregion
#region IDisposable Members
public void Dispose() {
}
#endregion
internal awt.Font FamilyFont {
get {
return _font;
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,198 +0,0 @@
//
// System.Drawing.Icon.cs
//
// Authors:
// Andrew Skiba (andrews@mainsoft.com)
// Dennis Hayes (dennish@Raytek.com)
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
// Sanjay Gupta (gsanjay@novell.com)
//
// Copyright (C) 2005 Mainsoft, Corp. http://mainsoft.com
// Copyright (C) 2002 Ximian, Inc. http://www.ximian.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;
using System.IO;
using System.Drawing.Imaging;
using System.Runtime.Serialization;
using System.Runtime.InteropServices;
using System.ComponentModel;
namespace System.Drawing
{
[Serializable]
[ComVisible (false)]
[TypeConverter(typeof(IconConverter))]
public sealed class Icon
: MarshalByRefObject, ISerializable, ICloneable, IDisposable
{
private System.Drawing.Bitmap _bitmap;
#region Ctors
private void SelectSize (int width, int height) {
int count = _bitmap.GetFrameCount (FrameDimension.Resolution);
bool sizeObtained = false;
for (int i=0; i<count; i++){
_bitmap.SelectActiveFrame (
System.Drawing.Imaging.FrameDimension.Resolution, i);
if (!sizeObtained)
if (_bitmap.Height==height && _bitmap.Width==width) {
sizeObtained = true;
break;
}
}
if (!sizeObtained){
uint largestSize = 0;
Bitmap tmpBmp = _bitmap;
for (int j=0; j<count; j++){
tmpBmp.SelectActiveFrame (FrameDimension.Resolution, j);
uint thisSize = (uint)_bitmap.Height * (uint)_bitmap.Width;
if (thisSize >= largestSize){
largestSize = thisSize;
_bitmap = tmpBmp;
}
}
}
}
private Icon () {
}
internal Icon (Bitmap bitmap) {
_bitmap = bitmap;
}
public Icon (Icon original, int width, int height) {
_bitmap = original._bitmap;
SelectSize (width, height);
}
public Icon (Icon original, Size size)
:this (original, size.Width, size.Height) {
}
public Icon (Stream stream)
: this (stream, 32, 32) {
}
public Icon (Stream stream, int width, int height)
{
_bitmap = new Bitmap (stream, false, ImageFormat.Icon);
SelectSize (width, height);
}
public Icon (string fileName) {
_bitmap = new Bitmap (fileName, false, ImageFormat.Icon);
}
public Icon (Type type, string resource)
{
using (Stream s = type.Assembly.GetManifestResourceStream (resource)) {
if (s == null)
throw new FileNotFoundException ("Resource name was not found: `" + resource + "'");
_bitmap = new Bitmap (s, false, ImageFormat.Icon);
}
}
[MonoTODO]
private Icon (SerializationInfo info, StreamingContext context)
{
//FIXME, need to check how MS stores Icon structure
//Will serialized form help
throw new NotImplementedException ();
}
#endregion
[MonoTODO]
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
{
throw new NotImplementedException ();
}
public void Dispose ()
{
#if INTPTR_SUPPORT
if (winHandle!=IntPtr.Zero)
winHandle = IntPtr.Zero;
#endif
}
public object Clone ()
{
Icon newIcon = new Icon ();
newIcon._bitmap = (Bitmap)_bitmap.Clone ();
return newIcon;
}
#if INTPTR_SUPPORT
[MonoTODO]
public static Icon FromHandle (IntPtr handle)
{
throw new NotImplementedException ();
}
#endif
public void Save (Stream outputStream) {
_bitmap.Save (outputStream, System.Drawing.Imaging.ImageFormat.Icon);
}
public Bitmap ToBitmap () {
return _bitmap;
}
public override string ToString ()
{
//is this correct, this is what returned by .Net
return "<Icon>";
}
#if INTPTR_SUPPORT
[Browsable (false)]
public IntPtr Handle {
get {
return winHandle;
}
}
#endif
[Browsable (false)]
public int Height {
get {
return _bitmap.Height;
}
}
public Size Size {
get {
return _bitmap.Size;
}
}
[Browsable (false)]
public int Width {
get {
return _bitmap.Width;
}
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,137 +0,0 @@
using System;
using System.Drawing.Imaging;
using System.Xml;
using Mainsoft.Drawing.Imaging;
using awt = java.awt;
using java.awt.image;
using imageio = javax.imageio;
namespace Mainsoft.Drawing.Imaging
{
/// <summary>
/// Summary description for PlainImage.
/// </summary>
public class PlainImage : ICloneable {
#region Members
awt.Image _nativeObject;
awt.Image [] _thumbnails;
FrameDimension _dimension;
XmlDocument _metadata;
imageio.metadata.IIOMetadata _nativeMetadata;
ImageFormat _imageFormat;
float _xResolution;
float _yResolution;
#endregion
#region Constructors
public PlainImage() {
}
public PlainImage(awt.Image image, awt.Image [] thumbnails, ImageFormat format, float xRes, float yRes, FrameDimension dimension) {
_nativeObject = image;
_thumbnails = thumbnails;
_imageFormat = format;
_xResolution = xRes;
_yResolution = yRes;
_dimension = dimension;
}
#endregion
private awt.Image NativeObject {
get { return _nativeObject; }
set { _nativeObject = value; }
}
#region PlainImage properties
public awt.Image NativeImage {
get { return NativeObject; }
set { NativeObject = value; }
}
internal imageio.metadata.IIOMetadata NativeMetadata {
get { return _nativeMetadata; }
set { _nativeMetadata = value; }
}
public XmlDocument Metadata {
get { return _metadata; }
set { _metadata = value; }
}
public ImageFormat ImageFormat {
get { return _imageFormat; }
}
public FrameDimension Dimension {
get { return _dimension; }
set { _dimension = value; }
}
public awt.Image [] Thumbnails {
get { return _thumbnails; }
}
public float HorizontalResolution {
get { return _xResolution; }
set { _xResolution = value; }
}
public float VerticalResolution {
get { return _yResolution; }
set { _yResolution = value; }
}
#endregion
#region ICloneable members
public object Clone() {
return Clone(true);
}
public PlainImage Clone(bool cloneImage) {
awt.Image img = NativeImage;
awt.Image [] th = _thumbnails;
if (cloneImage) {
img = new BufferedImage(
((BufferedImage)NativeObject).getColorModel(),
((BufferedImage)NativeObject).copyData(null),
((BufferedImage)NativeObject).isAlphaPremultiplied(), null);
if (Thumbnails != null) {
th = new java.awt.Image[ Thumbnails.Length ];
for (int i=0; i < Thumbnails.Length; i++) {
th[i] = new BufferedImage(
((BufferedImage)Thumbnails[i]).getColorModel(),
((BufferedImage)Thumbnails[i]).copyData(null),
((BufferedImage)Thumbnails[i]).isAlphaPremultiplied(), null);
}
}
}
return new PlainImage(
img,
th,
ImageFormat,
HorizontalResolution,
VerticalResolution,
Dimension );
}
#endregion
}
}

View File

@ -1,101 +0,0 @@
using System;
using System.Collections;
namespace Mainsoft.Drawing.Imaging
{
/// <summary>
/// Summary description for PlainImageCollection.
/// </summary>
public class PlainImageCollection : ICollection, IEnumerable
{
ArrayList collection = new ArrayList();
int _position = 0;
public PlainImageCollection()
{
//
// TODO: Add constructor logic here
//
}
#region ICollection members
public bool IsSynchronized {
get {
return collection.IsSynchronized;
}
}
public int Count {
get {
return collection.Count;
}
}
public void CopyTo(Array array, int index) {
collection.CopyTo(array, index);
}
public object SyncRoot {
get {
return collection.SyncRoot;
}
}
#endregion
#region IEnumerable members
public IEnumerator GetEnumerator() {
return collection.GetEnumerator();
}
#endregion
#region Collection members
public int Add(PlainImage plainImage) {
return collection.Add( plainImage );
}
public void Clear() {
collection.Clear();
}
public bool Contains(PlainImage plainImage) {
return collection.Contains(plainImage);
}
public int IndexOf(PlainImage plainImage) {
return collection.IndexOf( plainImage );
}
public void Insert(int index, PlainImage value) {
collection.Insert( index, value );
}
public void Remove(PlainImage value) {
collection.Remove( value );
}
public void RemoveAt(int index) {
collection.RemoveAt( index );
}
public PlainImage this[int index] {
get { return (PlainImage) collection[ index ]; }
}
public PlainImage CurrentImage {
get { return (PlainImage) collection[ _position ]; }
set { collection[ _position ] = value; }
}
public int CurrentImageIndex {
get { return _position; }
set { _position = value; }
}
#endregion
}
}

View File

@ -54,13 +54,6 @@ namespace System.Drawing
public static readonly Rectangle Empty;
#if TARGET_JVM
internal java.awt.Rectangle NativeObject {
get {
return new java.awt.Rectangle(X,Y,Width,Height);
}
}
#endif
/// <summary>
/// Ceiling Shared Method

View File

@ -47,13 +47,6 @@ namespace System.Drawing
public static readonly RectangleF Empty;
#if TARGET_JVM
internal java.awt.geom.Rectangle2D NativeObject {
get {
return new java.awt.geom.Rectangle2D.Float(X,Y,Width,Height);
}
}
#endif
/// <summary>
/// FromLTRB Shared Method
@ -255,14 +248,6 @@ namespace System.Drawing
}
#if TARGET_JVM
internal RectangleF (java.awt.geom.RectangularShape r2d) {
this.x = (float) r2d.getX ();
this.y = (float) r2d.getY ();
this.width = (float) r2d.getWidth ();
this.height = (float) r2d.getHeight ();
}
#endif
/// <summary>
/// Bottom Property

View File

@ -1,389 +0,0 @@
using System;
using System.Drawing.Drawing2D;
using System.Runtime.InteropServices;
using awt = java.awt;
using geom = java.awt.geom;
namespace System.Drawing
{
[ComVisible (false)]
public sealed class Region : BasicShape
{
#region Member Vars
internal static readonly Region InfiniteRegion = new Region(new Rectangle(-0x400000, -0x400000, 0x800000, 0x800000));
#endregion
#region Internals
internal geom.Area NativeObject
{
get
{
return (geom.Area)Shape;
}
}
#endregion
#region Ctors. and Dtor
public Region ()
: this ((geom.Area) InfiniteRegion.NativeObject.clone ())
{
}
internal Region(geom.Area native) : base(native)
{
}
public Region (GraphicsPath path) : this(new geom.Area(path.NativeObject))
{
}
public Region (Rectangle rect) : this(new geom.Area(rect.NativeObject))
{
}
public Region (RectangleF rect) : this(new geom.Area(rect.NativeObject))
{
}
[MonoTODO]
public Region (RegionData region_data) : this((geom.Area)null)
{
throw new NotImplementedException ();
}
#endregion
#region Union
public void Union (GraphicsPath path)
{
if (path == null)
throw new ArgumentNullException("path");
NativeObject.add(new geom.Area(path.NativeObject));
}
public void Union (Rectangle rect)
{
NativeObject.add(new geom.Area(rect.NativeObject));
}
public void Union (RectangleF rect)
{
NativeObject.add(new geom.Area(rect.NativeObject));
}
public void Union (Region region)
{
if (region == null)
throw new ArgumentNullException("region");
NativeObject.add(region.NativeObject);
}
#endregion
#region Intersect
//
public void Intersect (GraphicsPath path)
{
if (path == null)
throw new ArgumentNullException("path");
NativeObject.intersect(new geom.Area(path.NativeObject));
}
public void Intersect (Rectangle rect)
{
NativeObject.intersect(new geom.Area(rect.NativeObject));
}
public void Intersect (RectangleF rect)
{
NativeObject.intersect(new geom.Area(rect.NativeObject));
}
public void Intersect (Region region)
{
if (region == null)
throw new ArgumentNullException("region");
NativeObject.intersect(region.NativeObject);
}
#endregion
#region Complement
//
public void Complement (GraphicsPath path)
{
if (path == null)
throw new ArgumentNullException("path");
geom.Area a = new geom.Area(path.NativeObject);
a.subtract(NativeObject);
Shape = a;
}
public void Complement (Rectangle rect)
{
geom.Area a = new geom.Area(rect.NativeObject);
a.subtract(NativeObject);
Shape = a;
}
public void Complement (RectangleF rect)
{
geom.Area a = new geom.Area(rect.NativeObject);
a.subtract(NativeObject);
Shape = a;
}
public void Complement (Region region)
{
if (region == null)
throw new ArgumentNullException("region");
geom.Area a = (geom.Area) region.NativeObject.clone ();
a.subtract(NativeObject);
Shape = a;
}
#endregion
#region Exclude
//
public void Exclude (GraphicsPath path)
{
if (path == null)
throw new ArgumentNullException("path");
NativeObject.subtract(new geom.Area(path.NativeObject));
}
public void Exclude (Rectangle rect)
{
NativeObject.subtract(new geom.Area(rect.NativeObject));
}
public void Exclude (RectangleF rect)
{
NativeObject.subtract(new geom.Area(rect.NativeObject));
}
public void Exclude (Region region)
{
if (region == null)
throw new ArgumentNullException("region");
NativeObject.subtract(region.NativeObject);
}
#endregion
#region Xor
//
public void Xor (GraphicsPath path)
{
if (path == null)
throw new ArgumentNullException("path");
NativeObject.exclusiveOr(new geom.Area(path.NativeObject));
}
public void Xor (Rectangle rect)
{
NativeObject.exclusiveOr(new geom.Area(rect.NativeObject));
}
public void Xor (RectangleF rect)
{
NativeObject.exclusiveOr(new geom.Area(rect.NativeObject));
}
public void Xor (Region region)
{
if (region == null)
throw new ArgumentNullException("region");
NativeObject.exclusiveOr(region.NativeObject);
}
#endregion
#region GetBounds
//
public RectangleF GetBounds (Graphics graphics)
{
if (graphics == null)
throw new ArgumentNullException("graphics");
return new RectangleF(NativeObject.getBounds2D());
}
#endregion
#region Translate
//
public void Translate (int dx, int dy)
{
Translate((float)dx, (float)dy);
}
public void Translate (float dx, float dy)
{
if (NativeObject.equals(InfiniteRegion.NativeObject))
return;
NativeObject.transform(geom.AffineTransform.getTranslateInstance(
dx,
dy));
}
#endregion
#region IsVisible [TODO]
//
public bool IsVisible (int x, int y, Graphics g)
{
return IsVisible((float)x, (float)y, g);
}
public bool IsVisible (int x, int y, int width, int height)
{
return IsVisible((float)x, (float)y, (float)width, (float)height);
}
public bool IsVisible (int x, int y, int width, int height, Graphics g)
{
return IsVisible((float)x, (float)y, (float)width, (float)height, g);
}
public bool IsVisible (Point point)
{
return IsVisible(point.X, point.Y);
}
public bool IsVisible (PointF point)
{
return IsVisible(point.X, point.Y);
}
public bool IsVisible (Point point, Graphics g)
{
return IsVisible(point.X, point.Y, g);
}
public bool IsVisible (PointF point, Graphics g)
{
return IsVisible(point.X, point.Y, g);
}
public bool IsVisible (Rectangle rect)
{
return IsVisible(rect.X, rect.Y, rect.Width, rect.Height);
}
public bool IsVisible (RectangleF rect)
{
return IsVisible(rect.X, rect.Y, rect.Width, rect.Height);
}
public bool IsVisible (Rectangle rect, Graphics g)
{
return IsVisible(rect.X, rect.Y, rect.Width, rect.Height, g);
}
public bool IsVisible (RectangleF rect, Graphics g)
{
return IsVisible(rect.X, rect.Y, rect.Width, rect.Height, g);
}
public bool IsVisible (float x, float y)
{
return NativeObject.contains(x,y);
}
public bool IsVisible (float x, float y, Graphics g)
{
if (g == null)
throw new ArgumentNullException("graphics");
return NativeObject.contains(x,y);
}
public bool IsVisible (float x, float y, float width, float height)
{
return NativeObject.intersects(x,y,width,height);
}
public bool IsVisible (float x, float y, float width, float height, Graphics g)
{
if (g == null)
throw new ArgumentNullException("graphics");
return NativeObject.intersects(x,y,width,height);
}
#endregion
#region IsEmpty
public bool IsEmpty(Graphics g)
{
if (g == null)
throw new ArgumentNullException("graphics");
return NativeObject.isEmpty();
}
#endregion
#region IsInfinite
public bool IsInfinite(Graphics g)
{
if (g == null)
throw new ArgumentNullException("graphics");
//probably too naive.
return NativeObject.equals(InfiniteRegion.NativeObject);
}
#endregion
#region MakeEmpty
public void MakeEmpty()
{
NativeObject.reset();
}
#endregion
#region MakeInfinite
public void MakeInfinite()
{
Shape = (geom.Area) InfiniteRegion.NativeObject.clone ();
}
#endregion
#region Equals
public bool Equals(Region region, Graphics g)
{
if (g == null)
throw new ArgumentNullException("graphics");
return NativeObject.equals(region.NativeObject);
}
#endregion
[MonoTODO]
public RegionData GetRegionData()
{
throw new NotImplementedException();
}
[MonoTODO]
public IntPtr GetHrgn(Graphics g) {
throw new NotImplementedException();
}
public RectangleF[] GetRegionScans(Matrix matrix)
{
throw new NotImplementedException();
}
#region Transform
public void Transform(Matrix matrix)
{
if (matrix == null)
throw new ArgumentNullException("matrix");
if (NativeObject.equals(InfiniteRegion.NativeObject))
return;
NativeObject.transform(matrix.NativeObject);
}
#endregion
#region Clone
public Region Clone()
{
return new Region ((geom.Area) NativeObject.clone ());
}
#endregion
}
}

View File

@ -1,77 +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.
// (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
{
public sealed class SolidBrush : Brush
{
internal bool isModifiable = true;
Color _color;
protected override java.awt.Paint NativeObject {
get {
return _color.NativeObject;
}
}
public SolidBrush (Color color)
{
_color = color;
}
public Color Color {
get {
return _color;
}
set {
if (isModifiable)
_color = value;
else
throw new ArgumentException ("This SolidBrush object can't be modified.");
}
}
public override object Clone()
{
return new SolidBrush(_color);
}
protected override void Dispose (bool disposing)
{
if (!isModifiable && disposing)
throw new ArgumentException ("This SolidBrush object can't be modified.");
}
}
}

View File

@ -1,280 +0,0 @@
//
// System.Drawing.StringFormat.cs
//
// Authors:
// Dennis Hayes (dennish@Raytek.com)
// Miguel de Icaza (miguel@ximian.com)
// Jordi Mas i Hernandez (jordi@ximian.com)
//
// Copyright (C) 2002 Ximian, Inc (http://www.ximian.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;
using System.Drawing.Text;
namespace System.Drawing {
/// <summary>
/// Summary description for StringFormat.
/// </summary>
public sealed class StringFormat : MarshalByRefObject, IDisposable, ICloneable {
private CharacterRange [] _charRanges;
private StringAlignment _alignment;
private StringAlignment _lineAlignment;
private HotkeyPrefix _hotkeyPrefix;
private StringFormatFlags _flags;
private StringDigitSubstitute _digitSubstituteMethod;
private int _digitSubstituteLanguage;
private StringTrimming _trimming;
private float _firstTabOffset;
private float [] _tabStops;
private bool _genericTypeographic = false;
#region Constructors
public StringFormat() : this(0, 0) {
}
public StringFormat(StringFormatFlags options) : this(options,0) {
}
public StringFormat(StringFormatFlags options, int lang) {
_alignment = StringAlignment.Near;
_digitSubstituteLanguage = lang;
_digitSubstituteMethod = StringDigitSubstitute.User;
_flags = options;
_hotkeyPrefix = HotkeyPrefix.None;
_lineAlignment = StringAlignment.Near;
_trimming = StringTrimming.Character;
}
public StringFormat (StringFormat source) {
if (source == null)
throw new ArgumentNullException("format");
_alignment = source.LineAlignment;
_digitSubstituteLanguage = source.DigitSubstitutionLanguage;
_digitSubstituteMethod = source.DigitSubstitutionMethod;
_flags = source.FormatFlags;
_hotkeyPrefix = source.HotkeyPrefix;
_lineAlignment = source.LineAlignment;
_trimming = source.Trimming;
}
#endregion
#region IDisposable
public void Dispose() {
}
#endregion
#region Public properties
public StringAlignment Alignment {
get {
return _alignment;
}
set {
_alignment = value;
}
}
public StringAlignment LineAlignment {
get {
return _lineAlignment;
}
set {
_lineAlignment = value;
}
}
[MonoTODO]
public StringFormatFlags FormatFlags {
get {
return _flags;
}
set {
_flags = value;
}
}
[MonoTODO]
public HotkeyPrefix HotkeyPrefix {
get {
return _hotkeyPrefix;
}
set {
_hotkeyPrefix = value;
}
}
[MonoTODO]
public StringTrimming Trimming {
get {
return _trimming;
}
set {
_trimming = value;
}
}
public int DigitSubstitutionLanguage {
get {
return _digitSubstituteLanguage;
}
}
public StringDigitSubstitute DigitSubstitutionMethod {
get {
return _digitSubstituteMethod;
}
}
#endregion
#region static properties
public static StringFormat GenericDefault {
get {
StringFormat genericDefault = new StringFormat();
return genericDefault;
}
}
public static StringFormat GenericTypographic {
get {
StringFormat genericTypographic = new StringFormat(
StringFormatFlags.FitBlackBox |
StringFormatFlags.LineLimit |
StringFormatFlags.NoClip,
0 );
genericTypographic.Trimming = StringTrimming.None;
genericTypographic._genericTypeographic = true;
return genericTypographic;
}
}
#endregion
#region internal accessors
internal bool NoWrap {
get {
return (FormatFlags & StringFormatFlags.NoWrap) != 0;
}
}
internal bool IsVertical {
get {
return (FormatFlags & StringFormatFlags.DirectionVertical) != 0;
}
}
internal bool MeasureTrailingSpaces {
get {
return (FormatFlags & StringFormatFlags.MeasureTrailingSpaces) != 0;
}
}
internal bool LineLimit {
get {
return (FormatFlags & StringFormatFlags.LineLimit) != 0;
}
}
internal bool NoClip {
get {
return (FormatFlags & StringFormatFlags.NoClip) != 0;
}
}
internal bool IsRightToLeft {
get {
return (FormatFlags & StringFormatFlags.DirectionRightToLeft) != 0;
}
}
internal CharacterRange [] CharRanges {
get {
return _charRanges;
}
}
internal bool IsGenericTypographic
{
get {
return _genericTypeographic;
}
}
#endregion
#region public methods
public void SetMeasurableCharacterRanges (CharacterRange [] range) {
_charRanges = range != null ? (CharacterRange [])range.Clone() : null;
}
public object Clone() {
StringFormat copy = (StringFormat)MemberwiseClone();
if (_charRanges != null)
copy._charRanges = (CharacterRange [])_charRanges.Clone();
if (_tabStops != null)
copy._tabStops = (float[])_tabStops.Clone();
return copy;
}
public override string ToString() {
return "[StringFormat, FormatFlags=" + this.FormatFlags.ToString() + "]";
}
public void SetTabStops(float firstTabOffset, float[] tabStops) {
// _firstTabOffset = firstTabOffset;
// _tabStops = tabStops != null ? (float[])tabStops.Clone() : null;
throw new NotImplementedException();
}
public void SetDigitSubstitution(int language, StringDigitSubstitute substitute) {
// _digitSubstituteMethod = substitute;
// _digitSubstituteLanguage = language;
throw new NotImplementedException();
}
[MonoTODO]
public float[] GetTabStops(out float firstTabOffset) {
firstTabOffset = _firstTabOffset;
return _tabStops != null ? (float[])_tabStops.Clone() : null;
}
#endregion
}
}

Some files were not shown because too many files have changed in this diff Show More