[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetlib/System.Drawing/Toolkit IToolkit.cs,N
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetlib/System.Drawing/Toolkit IToolkit.cs,NONE,1.1 IToolkitBrush.cs,NONE,1.1 IToolkitFont.cs,NONE,1.1 IToolkitGraphics.cs,NONE,1.1 IToolkitPen.cs,NONE,1.1 IToolkitPrintSession.cs,NONE,1.1 IToolkitPrinter.cs,NONE,1.1 IToolkitPrintingSystem.cs,NONE,1.1 IToolkitSelectObject.cs,NONE,1.1 IToolkitWindow.cs,NONE,1.1 Makefile,NONE,1.1 NullPrintingSystem.cs,NONE,1.1 ToolkitDecorations.cs,NONE,1.1 ToolkitEventHandlers.cs,NONE,1.1 ToolkitFunctions.cs,NONE,1.1 ToolkitGraphicsBase.cs,NONE,1.1 ToolkitManager.cs,NONE,1.1 UnixPrinter.cs,NONE,1.1 UnixPrintingSystem.cs,NONE,1.1 |
Date: |
Sat, 07 Jun 2003 18:41:00 -0400 |
Update of /cvsroot/dotgnu-pnet/pnetlib/System.Drawing/Toolkit
In directory subversions:/tmp/cvs-serv12618/System.Drawing/Toolkit
Added Files:
IToolkit.cs IToolkitBrush.cs IToolkitFont.cs
IToolkitGraphics.cs IToolkitPen.cs IToolkitPrintSession.cs
IToolkitPrinter.cs IToolkitPrintingSystem.cs
IToolkitSelectObject.cs IToolkitWindow.cs Makefile
NullPrintingSystem.cs ToolkitDecorations.cs
ToolkitEventHandlers.cs ToolkitFunctions.cs
ToolkitGraphicsBase.cs ToolkitManager.cs UnixPrinter.cs
UnixPrintingSystem.cs
Log Message:
Add the "System.Drawing" and "System.Drawing.Xsharp" assemblies.
--- NEW FILE ---
/*
* IToolkit.cs - Implementation of the "System.Drawing.Toolkit.IToolkit" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.Drawing.Toolkit
{
using System.Drawing.Drawing2D;
public interface IToolkit
{
// Run the main event processing loop for the toolkit.
void Run();
// Send a quit message to the toolkit, which should cause
// it to exit from the "Run" method.
void Quit();
// Resolve a system color to an RGB value. Returns -1 if the
// system does not support the color and a default should be used.
int ResolveSystemColor(KnownColor color);
// Create an IToolkitGraphics object from a HDC.
IToolkitGraphics CreateFromHdc(IntPtr hdc, IntPtr hdevice);
// Create an IToolkitGraphics object from a HWND.
IToolkitGraphics CreateFromHwnd(IntPtr hwnd);
// Create a solid toolkit brush.
IToolkitBrush CreateSolidBrush(Color color);
// Create a hatched toolkit brush.
IToolkitBrush CreateHatchBrush(HatchStyle style, Color foreColor,
Color
backColor);
// Create a linear gradient brush. Returns null if the
// toolkit does not support linear gradient brushes.
IToolkitBrush CreateLinearGradientBrush
(RectangleF rect, Color color1, Color color2,
LinearGradientMode mode);
IToolkitBrush CreateLinearGradientBrush
(RectangleF rect, Color color1, Color color2,
float angle, bool isAngleScaleable);
// Create a toolkit pen from the properties in the specified object.
// If the toolkit does not support the precise combination of pen
// properties, it will return the closest matching pen.
IToolkitPen CreatePen(Pen pen);
// Create a toolkit font from the properties in the specified object.
IToolkitFont CreateFont(Font font);
// Get the handle for the halftone palette. IntPtr.Zero if not
supported.
IntPtr GetHalftonePalette();
// Create a top-level application window.
IToolkitWindow CreateTopLevelWindow(int width, int height);
// Create a top-level dialog shell.
IToolkitWindow CreateTopLevelDialog
(int width, int height, bool modal, bool resizable,
IToolkitWindow dialogParent);
// Create a top-level menu shell.
IToolkitWindow CreateTopLevelMenu(int x, int y, int width, int height);
// Create a child window. If "parent" is null, then the child
// does not yet have a "real" parent - it will be reparented later.
IToolkitWindow CreateChildWindow(IToolkitWindow parent,
int x,
int y, int width, int height);
}; // interface IToolkit
}; // namespace System.Drawing.Toolkit
--- NEW FILE ---
/*
* IToolkitBrush.cs - Implementation of the
* "System.Drawing.Toolkit.IToolkitBrush" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.Drawing.Toolkit
{
public interface IToolkitBrush : IToolkitSelectObject
{
}; // interface IToolkitBrush
}; // namespace System.Drawing.Toolkit
--- NEW FILE ---
/*
* IToolkitFont.cs - Implementation of the
* "System.Drawing.Toolkit.IToolkitFont" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.Drawing.Toolkit
{
public interface IToolkitFont : IToolkitSelectObject
{
}; // interface IToolkitFont
}; // namespace System.Drawing.Toolkit
--- NEW FILE ---
/*
* IToolkitGraphics.cs - Implementation of the
* "System.Drawing.Toolkit.IToolkitGraphics" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.Drawing.Toolkit
{
using System.Drawing.Text;
using System.Drawing.Drawing2D;
public interface IToolkitGraphics : IDisposable
{
// Get or set the graphics object's properties.
IToolkit Toolkit { get; }
CompositingMode CompositingMode { get; set; }
CompositingQuality CompositingQuality { get; set; }
float DpiX { get; }
float DpiY { get; }
InterpolationMode InterpolationMode { get; set; }
PixelOffsetMode PixelOffsetMode { get; set; }
Point RenderingOrigin { get; set; }
SmoothingMode SmoothingMode { get; set; }
int TextContrast { get; set; }
TextRenderingHint TextRenderingHint { get; set; }
RectangleF VisibleClipBounds { get; }
// Clear the entire drawing surface.
void Clear();
// Draw a line between two points using the current pen.
void DrawLine(int x1, int y1, int x2, int y2);
// Draw a set of connected line seguments using the current pen.
void DrawLines(Point[] points);
// Draw a polygon using the current pen.
void DrawPolygon(Point[] points);
// Fill a polygon using the current brush.
void FillPolygon(Point[] points, FillMode fillMode);
// Draw a bezier curve using the current pen.
void DrawBezier(int x1, int y1, int x2, int y2,
int x3, int y3, int x4, int y4);
// Draw an arc within a rectangle defined by four points.
void DrawArc(Point[] rect, float startAngle, float sweepAngle);
// Draw a pie slice within a rectangle defined by four points.
void DrawPie(Point[] rect, float startAngle, float sweepAngle);
// Fill a pie slice within a rectangle defined by four points.
void FillPie(Point[] rect, float startAngle, float sweepAngle);
// Draw a closed cardinal curve using the current pen.
void DrawClosedCurve(Point[] points, float tension);
// Fill a closed cardinal curve using the current brush.
void FillClosedCurve(Point[] points, float tension, FillMode fillMode);
// Draw a cardinal curve using the current pen.
void DrawCurve(Point[] points, int offset,
int numberOfSegments, float tension);
// Flush the graphics subsystem
void Flush(FlushIntention intention);
// Get the nearest color to a specified one.
Color GetNearestColor(Color color);
// Add a metafile comment.
void AddMetafileComment(byte[] data);
// Get the HDC associated with this graphics object.
IntPtr GetHdc();
// Release a HDC that was obtained using "GetHdc()".
void ReleaseHdc(IntPtr hdc);
// Set the clipping region to empty.
void SetClipEmpty();
// Set the clipping region to infinite (i.e. disable clipping).
void SetClipInfinite();
// Set the clipping region to a single rectangle.
void SetClipRect(int x, int y, int width, int height);
// Set the clipping region to a list of rectangles.
void SetClipRects(Rectangle[] rects);
// Set the clipping region to a complex mask. TODO
void SetClipMask(Object mask, int topx, int topy);
}; // interface IToolkitGraphics
}; // namespace System.Drawing.Toolkit
--- NEW FILE ---
/*
* IToolkitPen.cs - Implementation of the
* "System.Drawing.Toolkit.IToolkitPen" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.Drawing.Toolkit
{
public interface IToolkitPen : IToolkitSelectObject
{
}; // interface IToolkitPen
}; // namespace System.Drawing.Toolkit
--- NEW FILE ---
/*
* IToolkitPrintSession.cs - Implementation of the
* "System.Drawing.Toolkit.IToolkitPrintSession" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.Drawing.Toolkit
{
using System.Drawing.Printing;
public interface IToolkitPrintSession : IDisposable
{
// TODO
}; // interface IToolkitPrintSession
}; // namespace System.Drawing.Toolkit
--- NEW FILE ---
/*
* IToolkitPrinter.cs - Implementation of the
* "System.Drawing.Toolkit.IToolkitPrinter" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.Drawing.Toolkit
{
using System.Drawing.Printing;
public interface IToolkitPrinter
{
// Determine if this printer supports duplex operation.
bool CanDuplex { get; }
// Determine if this printer is a plotter.
bool IsPlotter { get; }
// Get the output port for the printer. String.Empty if none.
String OutputPort { get; }
// Get the paper sizes supported by this printer.
PaperSize[] PaperSizes { get; }
// Get the paper sources supported by this printer.
PaperSource[] PaperSources { get; }
// Get the resolutions supported by this printer.
PrinterResolution[] PrinterResolutions { get; }
// Determine if this printer supports color.
bool SupportsColor { get; }
// Load the default page settings from the printer.
void LoadDefaults(PageSettings defaults);
// Create an "IToolkitGraphics" object that can be used
// to perform text measurement for this printer.
IToolkitGraphics CreateMeasurementGraphics();
// Get a session handler for this printer to print a document.
IToolkitPrintSession GetSession(PrintDocument document);
}; // interface IToolkitPrinter
}; // namespace System.Drawing.Toolkit
--- NEW FILE ---
/*
* IToolkitPrintingSystem.cs - Implementation of the
* "System.Drawing.Toolkit.IToolkitPrintingSystem" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.Drawing.Toolkit
{
public interface IToolkitPrintingSystem
{
// Get the default printer name on this system.
String DefaultPrinterName { get; }
// Get a list of all installed printers on this system.
String[] InstalledPrinters { get; }
// Get the printer control object for a specific printer.
// Returns null if the printer name is not recognised.
IToolkitPrinter GetPrinter(String name);
}; // interface IToolkitPrintingSystem
}; // namespace System.Drawing.Toolkit
--- NEW FILE ---
/*
* IToolkitSelectObject.cs - Implementation of the
* "System.Drawing.Toolkit.IToolkitSelectObject" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.Drawing.Toolkit
{
public interface IToolkitSelectObject : IDisposable
{
// Select this object into a graphics object.
void Select(IToolkitGraphics graphics);
}; // interface IToolkitSelectObject
}; // namespace System.Drawing.Toolkit
--- NEW FILE ---
/*
* IToolkitWindow.cs - Implementation of the
* "System.Drawing.Toolkit.IToolkitWindow" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.Drawing.Toolkit
{
// This interface provides a primitive windowing facility for
// managing rectangular regions in a stack. It can be used to
// create owner-draw widgets and the like.
public interface IToolkitWindow
{
// Get the toolkit that owns this window.
IToolkit Toolkit { get; }
// Get the current dimensions of this window.
Rectangle Dimensions { get; }
// Get or set the mapped state of the window.
bool IsMapped { get; set; }
// Destroy this window and all of its children.
void Destroy();
// Move or resize this window.
void MoveResize(int x, int y, int width, int height);
// Raise this window respective to its siblings.
void Raise();
// Lower this window respective to its siblings.
void Lower();
// Iconify the window (top-level windows only).
void Iconify();
// Reparent this window to underneath a new parent.
void Reparent(IToolkitWindow parent, int x, int y);
// Get a toolkit graphics object for this window.
IToolkitGraphics GetGraphics();
// Set the window title (top-level windows only).
void SetTitle(String title);
// Set the background of the window to a solid color.
void SetBackground(Color color);
// Change the set of supported decorations and functions.
void SetFunctions(ToolkitDecorations decorations,
ToolkitFunctions functions);
// Event that is emitted for an expose on this window.
event ToolkitExposeHandler Expose;
}; // interface IToolkitWindow
}; // namespace System.Drawing.Toolkit
--- NEW FILE ---
all:
(cd ..; make)
--- NEW FILE ---
/*
* NullPrintingSystem.cs - Implementation of the
* "System.Drawing.Toolkit.NullPrintingSystem" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.Drawing.Toolkit
{
// Stub class that is used when we are unable to determine
// what printing system to use on a particular platform.
internal sealed class NullPrintingSystem : IToolkitPrintingSystem
{
// Get the default printer name on this system.
public String DefaultPrinterName
{
get
{
return "lp";
}
}
// Get a list of all installed printers on this system.
public String[] InstalledPrinters
{
get
{
return new String [0];
}
}
// Get the printer control object for a specific printer.
// Returns null if the printer name is not recognised.
public IToolkitPrinter GetPrinter(String name)
{
return null;
}
}; // class NullPrintingSystem
}; // namespace System.Drawing.Toolkit
--- NEW FILE ---
/*
* ToolkitDecorations.cs - Implementation of the
* "System.Drawing.Toolkit.ToolkitDecorations" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.Drawing.Toolkit
{
// Supported window decorations for IToolkitWindow.SetFunctions.
public enum ToolkitDecorations
{
All = 1 << 0, // All except those
listed below.
Border = 1 << 1,
ResizeHandles = 1 << 2,
Title = 1 << 3,
Menu = 1 << 4,
Minimize = 1 << 5,
Maximize = 1 << 6
}; // enum Decorations
}; // namespace System.Drawing.Toolkit
--- NEW FILE ---
/*
* ToolkitEventHandlers.cs - Declarations for event handling delegates.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.Drawing.Toolkit
{
// Handle an expose event, using a particular graphics object to paint.
public delegate void ToolkitExposeHandler(Graphics graphics);
}; // namespace System.Drawing.Toolkit
--- NEW FILE ---
/*
* ToolkitFunctions.cs - Implementation of the
* "System.Drawing.Toolkit.ToolkitFunctions" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.Drawing.Toolkit
{
// Supported window functions for "IToolkitManager.SetFunctions".
public enum ToolkitFunctions
{
All = 1 << 0, // All except those
listed below.
Resize = 1 << 1,
Move = 1 << 2,
Minimize = 1 << 3,
Maximize = 1 << 4,
Close = 1 << 5
}; // enum ToolkitFunctions
}; // namespace System.Drawing.Toolkit
--- NEW FILE ---
/*
* ToolkitGraphicsBase.cs - Implementation of the
* "System.Drawing.Toolkit.ToolkitGraphicsBase" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.Drawing.Toolkit
{
using System.Drawing.Text;
using System.Drawing.Drawing2D;
// This base class provides some common functionality which should
// help to make it easier to write "IToolkitGraphics" handlers.
public abstract class ToolkitGraphicsBase : IToolkitGraphics
{
// Dirty bit flags for changed values.
[Flags]
public enum DirtyFlags
{
CompositingMode = (1 << 1),
CompositingQuality = (1 << 2),
InterpolationMode = (1 << 3),
PixelOffsetMode = (1 << 4),
RenderingOrigin = (1 << 5),
SmoothingMode = (1 << 6),
TextContrast = (1 << 7),
TextRenderingHint = (1 << 8),
All = -1
}; // enum DirtyFlags
// Internal state.
protected IToolkit toolkit;
protected Region clip;
protected CompositingMode compositingMode;
protected CompositingQuality compositingQuality;
protected InterpolationMode interpolationMode;
protected PixelOffsetMode pixelOffsetMode;
protected Point renderingOrigin;
protected SmoothingMode smoothingMode;
protected int textContrast;
protected TextRenderingHint textRenderingHint;
protected DirtyFlags dirtyFlags;
// Constructor.
protected ToolkitGraphicsBase(IToolkit toolkit)
{
this.toolkit = toolkit;
clip = null;
compositingMode = CompositingMode.SourceOver;
compositingQuality = CompositingQuality.Default;
interpolationMode = InterpolationMode.Default;
pixelOffsetMode = PixelOffsetMode.Default;
renderingOrigin = new Point(0, 0);
smoothingMode = SmoothingMode.Default;
textContrast = 4;
textRenderingHint =
TextRenderingHint.SystemDefault;
dirtyFlags = DirtyFlags.All;
}
// Get or set the graphics object's properties.
public IToolkit Toolkit
{
get
{
return toolkit;
}
}
public virtual CompositingMode CompositingMode
{
get
{
return compositingMode;
}
set
{
if(compositingMode != value)
{
compositingMode = value;
dirtyFlags |=
DirtyFlags.CompositingMode;
}
}
}
public virtual CompositingQuality CompositingQuality
{
get
{
return compositingQuality;
}
set
{
if(compositingQuality != value)
{
compositingQuality = value;
dirtyFlags |=
DirtyFlags.CompositingQuality;
}
}
}
public virtual float DpiX
{
get
{
// Assume a display with a default DPI
of 75.
return 75.0f;
}
}
public virtual float DpiY
{
get
{
// Assume a display with a default DPI
of 75.
return 75.0f;
}
}
public virtual InterpolationMode InterpolationMode
{
get
{
return interpolationMode;
}
set
{
if(interpolationMode != value)
{
interpolationMode = value;
dirtyFlags |=
DirtyFlags.InterpolationMode;
}
}
}
public virtual PixelOffsetMode PixelOffsetMode
{
get
{
return pixelOffsetMode;
}
set
{
if(pixelOffsetMode != value)
{
pixelOffsetMode = value;
dirtyFlags |=
DirtyFlags.PixelOffsetMode;
}
}
}
public virtual Point RenderingOrigin
{
get
{
return renderingOrigin;
}
set
{
if(renderingOrigin != value)
{
renderingOrigin = value;
dirtyFlags |=
DirtyFlags.RenderingOrigin;
}
}
}
public virtual SmoothingMode SmoothingMode
{
get
{
return smoothingMode;
}
set
{
if(smoothingMode != value)
{
smoothingMode = value;
dirtyFlags |=
DirtyFlags.SmoothingMode;
}
}
}
public virtual int TextContrast
{
get
{
return textContrast;
}
set
{
if(textContrast != value)
{
textContrast = value;
dirtyFlags |=
DirtyFlags.TextContrast;
}
}
}
public virtual TextRenderingHint TextRenderingHint
{
get
{
return textRenderingHint;
}
set
{
if(textRenderingHint != value)
{
textRenderingHint = value;
dirtyFlags |=
DirtyFlags.TextRenderingHint;
}
}
}
public virtual RectangleF VisibleClipBounds
{
get
{
// This should be overridden in
subclasses.
return RectangleF.Empty;
}
}
// Determine if a particular section of the dirty flags are set.
protected bool IsDirty(DirtyFlags flags)
{
return ((dirtyFlags & flags) != 0);
}
// Check if dirty flags are set and also clear them.
protected bool CheckDirty(DirtyFlags flags)
{
bool result = ((dirtyFlags & flags) != 0);
dirtyFlags &= ~flags;
return result;
}
// Clear specific dirty flags.
protected void ClearDirty(DirtyFlags flags)
{
dirtyFlags &= ~flags;
}
// Dispose of this object.
public virtual void Dispose()
{
// Nothing to do in this base class.
}
// Clear the entire drawing surface.
public abstract void Clear();
// Draw a line between two points using the current pen.
public abstract void DrawLine(int x1, int y1, int x2, int y2);
// Draw a set of connected line seguments using the current pen.
public abstract void DrawLines(Point[] points);
// Draw a polygon using the current pen.
public abstract void DrawPolygon(Point[] points);
// Fill a polygon using the current brush.
public abstract void FillPolygon(Point[] points, FillMode fillMode);
// Draw a bezier curve using the current pen.
[TODO]
public virtual void DrawBezier(int x1, int y1, int x2, int y2,
int x3, int
y3, int x4, int y4)
{
// TODO: implement a default bezier drawing
algorithm
// for systems that don't have their own.
}
// Draw an arc within a rectangle defined by four points.
public abstract void DrawArc
(Point[] rect, float startAngle, float sweepAngle);
// Draw a pie slice within a rectangle defined by four points.
public abstract void DrawPie
(Point[] rect, float startAngle, float sweepAngle);
// Fill a pie slice within a rectangle defined by four points.
public abstract void FillPie
(Point[] rect, float startAngle, float sweepAngle);
// Draw a closed cardinal curve using the current pen.
[TODO]
public virtual void DrawClosedCurve(Point[] points, float tension)
{
// TODO: implement a default curve drawing
algorithm
// for systems that don't have their own.
}
// Fill a closed cardinal curve using the current brush.
[TODO]
public virtual void FillClosedCurve
(Point[] points, float tension, FillMode
fillMode)
{
// TODO: implement a default curve drawing
algorithm
// for systems that don't have their own.
}
// Draw a cardinal curve using the current pen.
[TODO]
public virtual void DrawCurve(Point[] points, int offset,
int
numberOfSegments, float tension)
{
// TODO: implement a default curve drawing
algorithm
// for systems that don't have their own.
}
// Flush the graphics subsystem
public virtual void Flush(FlushIntention intention)
{
// Nothing to do in the base class.
}
// Get the nearest color to a specified one.
public virtual Color GetNearestColor(Color color)
{
// By default, we assume that the display is
true color.
return color;
}
// Add a metafile comment.
public virtual void AddMetafileComment(byte[] data)
{
// Nothing to do in the base class.
}
// Get the HDC associated with this graphics object.
public virtual IntPtr GetHdc()
{
// Nothing to do in the base class.
return IntPtr.Zero;
}
// Release a HDC that was obtained using "GetHdc()".
public virtual void ReleaseHdc(IntPtr hdc)
{
// Nothing to do in the base class.
}
// Set the clipping region to empty.
public abstract void SetClipEmpty();
// Set the clipping region to infinite (i.e. disable clipping).
public abstract void SetClipInfinite();
// Set the clipping region to a single rectangle.
public abstract void SetClipRect(int x, int y, int width, int height);
// Set the clipping region to a list of rectangles.
public abstract void SetClipRects(Rectangle[] rects);
// Set the clipping region to a complex mask.
public abstract void SetClipMask(Object mask, int topx, int topy);
}; // class ToolkitGraphicsBase
}; // namespace System.Drawing.Toolkit
--- NEW FILE ---
/*
* ToolkitManager.cs - Implementation of the
* "System.Drawing.Toolkit.ToolkitManager" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.Drawing.Toolkit
{
using System.Drawing.Printing;
using System.Reflection;
public sealed class ToolkitManager
{
// Global state.
private static IToolkit toolkit;
private static IToolkitPrintingSystem printingSystem;
// Get or set the active graphical display toolkit.
public static IToolkit Toolkit
{
get
{
lock(typeof(ToolkitManager))
{
if(toolkit == null)
{
toolkit =
CreateDefaultToolkit();
}
return toolkit;
}
}
set
{
lock(typeof(ToolkitManager))
{
toolkit = value;
}
}
}
// Determine if we currently have a graphical toolkit.
public static bool HasToolkit
{
get
{
lock(typeof(ToolkitManager))
{
return (toolkit != null);
}
}
}
// Get or set the active printing system.
[TODO]
public static IToolkitPrintingSystem PrintingSystem
{
get
{
lock(typeof(ToolkitManager))
{
if(printingSystem == null)
{
// TODO: create a
system-specific printing system.
printingSystem = new
NullPrintingSystem();
}
return printingSystem;
}
}
set
{
lock(typeof(ToolkitManager))
{
printingSystem = value;
}
}
}
// Get a standard paper size object.
public static PaperSize GetStandardPaperSize(PaperKind kind)
{
return new PaperSize(kind);
}
// Get a standard paper source object.
public static PaperSource GetStandardPaperSource(PaperSourceKind kind)
{
return new PaperSource(kind, null);
}
// Get a standard printer resolution object.
public static PrinterResolution GetStandardPrinterResolution
(PrinterResolutionKind kind, int x, int y)
{
return new PrinterResolution(kind, x, y);
}
// Create a "Graphics" object from an "IToolkitGraphics" handler.
public static Graphics CreateGraphics(IToolkitGraphics graphics)
{
if(graphics == null)
{
throw new
ArgumentNullException("graphics");
}
return new Graphics(graphics);
}
// Create the default toolkit.
private static IToolkit CreateDefaultToolkit()
{
// TODO: handle other graphical toolkits.
// Determine the name of the toolkit we wish to
use.
String name = "System.Drawing.Xsharp";
// Load the toolkit's assembly.
Assembly assembly = Assembly.Load(name);
// Find the
"System.Drawing.Toolkit.DrawingToolkit" class.
Type type = assembly.GetType
("System.Drawing.Toolkit.DrawingToolkit");
if(type == null)
{
throw new NotSupportedException();
}
// Instantiate "DrawingToolkit" and return it.
return
(IToolkit)(Activator.CreateInstance(type));
}
}; // class ToolkitManager
}; // namespace System.Drawing.Toolkit
--- NEW FILE ---
/*
* UnixPrinter.cs - Implementation of the
* "System.Drawing.Toolkit.UnixPrinter" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.Drawing.Toolkit
{
using System.Drawing.Printing;
internal sealed class UnixPrinter : IToolkitPrinter
{
// Internal state.
private String name;
// Constructor.
public UnixPrinter(String name)
{
this.name = name;
}
// Determine if this printer supports duplex operation.
public bool CanDuplex
{
get
{
return false;
}
}
// Determine if this printer is a plotter.
public bool IsPlotter
{
get
{
return false;
}
}
// Get the output port for the printer. String.Empty if none.
public String OutputPort
{
get
{
return String.Empty;
}
}
// Get the paper sizes supported by this printer.
public PaperSize[] PaperSizes
{
get
{
return new PaperSize[] {
ToolkitManager.GetStandardPaperSize
(PaperKind.Letter),
ToolkitManager.GetStandardPaperSize
(PaperKind.A4),
ToolkitManager.GetStandardPaperSize
(PaperKind.Executive),
ToolkitManager.GetStandardPaperSize
(PaperKind.Legal),
};
}
}
// Get the paper sources supported by this printer.
public PaperSource[] PaperSources
{
get
{
return new PaperSource[] {
ToolkitManager.GetStandardPaperSource
(PaperSourceKind.Upper)
};
}
}
// Get the resolutions supported by this printer.
public PrinterResolution[] PrinterResolutions
{
get
{
return new PrinterResolution[] {
ToolkitManager.GetStandardPrinterResolution
(PrinterResolutionKind.Medium, 300, 300)
};
}
}
// Determine if this printer supports color.
public bool SupportsColor
{
get
{
return false;
}
}
// Load the default page settings from the printer.
public void LoadDefaults(PageSettings defaults)
{
// Nothing to do here: the standard defaults
are good enough.
}
// Create an "IToolkitGraphics" object that can be used
// to perform text measurement for this printer.
[TODO]
public IToolkitGraphics CreateMeasurementGraphics()
{
// TODO
return null;
}
// Get a session handler for this printer to print a document.
[TODO]
public IToolkitPrintSession GetSession(PrintDocument document)
{
// TODO
return null;
}
}; // class UnixPrinter
}; // namespace System.Drawing.Toolkit
--- NEW FILE ---
/*
* UnixPrintingSystem.cs - Implementation of the
* "System.Drawing.Toolkit.UnixPrintingSystem" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace System.Drawing.Toolkit
{
// Printing system object that pipes Postscript data through lpr/lp.
// Currently we only support one printer, defined by the "PRINTER"
// environment variable, and defaulting to the name "lp".
internal sealed class UnixPrintingSystem : IToolkitPrintingSystem
{
// Get the default printer name on this system.
public String DefaultPrinterName
{
get
{
String printer;
printer =
Environment.GetEnvironmentVariable("PRINTER");
if(printer != null && printer !=
String.Empty)
{
return printer;
}
else
{
return "lp";
}
}
}
// Get a list of all installed printers on this system.
public String[] InstalledPrinters
{
get
{
return new String []
{DefaultPrinterName};
}
}
// Get the printer control object for a specific printer.
// Returns null if the printer name is not recognised.
public IToolkitPrinter GetPrinter(String name)
{
if(name == DefaultPrinterName)
{
return new UnixPrinter(name);
}
else
{
return null;
}
}
}; // class UnixPrintingSystem
}; // namespace System.Drawing.Toolkit
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetlib/System.Drawing/Toolkit IToolkit.cs,NONE,1.1 IToolkitBrush.cs,NONE,1.1 IToolkitFont.cs,NONE,1.1 IToolkitGraphics.cs,NONE,1.1 IToolkitPen.cs,NONE,1.1 IToolkitPrintSession.cs,NONE,1.1 IToolkitPrinter.cs,NONE,1.1 IToolkitPrintingSystem.cs,NONE,1.1 IToolkitSelectObject.cs,NONE,1.1 IToolkitWindow.cs,NONE,1.1 Makefile,NONE,1.1 NullPrintingSystem.cs,NONE,1.1 ToolkitDecorations.cs,NONE,1.1 ToolkitEventHandlers.cs,NONE,1.1 ToolkitFunctions.cs,NONE,1.1 ToolkitGraphicsBase.cs,NONE,1.1 ToolkitManager.cs,NONE,1.1 UnixPrinter.cs,NONE,1.1 UnixPrintingSystem.cs,NONE,1.1,
Rhys Weatherley <address@hidden> <=
- Prev by Date:
[Dotgnu-pnet-commits] CVS: pnetlib/System.Drawing.Xsharp .cvsignore,NONE,1.1 DrawingFont.cs,NONE,1.1 DrawingGraphics.cs,NONE,1.1 DrawingHatchBrush.cs,NONE,1.1 DrawingPen.cs,NONE,1.1 DrawingSolidBrush.cs,NONE,1.1 DrawingToolkit.cs,NONE,1.1 DrawingTopLevelWindow.cs,NONE,1.1 DrawingWindow.cs,NONE,1.1 Makefile.am,NONE,1.1 System.Drawing.Xsharp.build,NONE,1.1
- Next by Date:
[Dotgnu-pnet-commits] CVS: pnetlib/System.Drawing/Text FontCollection.cs,NONE,1.1 GenericFontFamilies.cs,NONE,1.1 HotkeyPrefix.cs,NONE,1.1 InstalledFontCollection.cs,NONE,1.1 PrivateFontCollection.cs,NONE,1.1 TextRenderingHint.cs,NONE,1.1
- Previous by thread:
[Dotgnu-pnet-commits] CVS: pnetlib/System.Drawing.Xsharp .cvsignore,NONE,1.1 DrawingFont.cs,NONE,1.1 DrawingGraphics.cs,NONE,1.1 DrawingHatchBrush.cs,NONE,1.1 DrawingPen.cs,NONE,1.1 DrawingSolidBrush.cs,NONE,1.1 DrawingToolkit.cs,NONE,1.1 DrawingTopLevelWindow.cs,NONE,1.1 DrawingWindow.cs,NONE,1.1 Makefile.am,NONE,1.1 System.Drawing.Xsharp.build,NONE,1.1
- Next by thread:
[Dotgnu-pnet-commits] CVS: pnetlib/System.Drawing/Text FontCollection.cs,NONE,1.1 GenericFontFamilies.cs,NONE,1.1 HotkeyPrefix.cs,NONE,1.1 InstalledFontCollection.cs,NONE,1.1 PrivateFontCollection.cs,NONE,1.1 TextRenderingHint.cs,NONE,1.1
- Index(es):