2003-02-28 Miguel de Icaza <miguel@ximian.com>
* gdk/Color.custom: Added constructors from System.Drawing.Color and from rgb byte tuples. * gdk/Colormap.custom: Add new .custom file for the AllocColor call. svn path=/trunk/gtk-sharp/; revision=12054
This commit is contained in:
parent
8e53154449
commit
ae21ffa9f2
3 changed files with 43 additions and 10 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2003-02-28 Miguel de Icaza <miguel@ximian.com>
|
||||
|
||||
* gdk/Color.custom: Added constructors from System.Drawing.Color
|
||||
and from rgb byte tuples.
|
||||
|
||||
* gdk/Colormap.custom: Add new .custom file for the AllocColor
|
||||
call.
|
||||
|
||||
* sources/Gdk.metadata: Make Colormap.AllocColor GdkColor
|
||||
parameter be a `ref' parameter.
|
||||
|
||||
2003-02-27 Miguel de Icaza <miguel@ximian.com>
|
||||
|
||||
* gdk/Drawable.custom: Added nice overload for DrawRectangle.
|
||||
|
|
|
@ -1,22 +1,35 @@
|
|||
// Gdk.Color.custom - Gdk Color class customizations
|
||||
//
|
||||
// Author: Jasper van Putten <Jaspervp@gmx.net>
|
||||
// Author: Jasper van Putten <Jaspervp@gmx.net>, Miguel de Icaza.
|
||||
//
|
||||
// (c) 2002 Jasper van Putten
|
||||
// (c) 2003 Miguel de Icaza.
|
||||
//
|
||||
// This code is inserted after the automatically generated code.
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// ToString method
|
||||
/// </summary>
|
||||
///
|
||||
/// <remarks>
|
||||
/// returns a string representation of this color
|
||||
///
|
||||
/// </remarks>
|
||||
|
||||
public override string ToString ()
|
||||
{
|
||||
return String.Format ("rgb:{0:x}/{1:x}/{2:x}", red, green, blue);
|
||||
}
|
||||
|
||||
public Color (byte r, byte g, byte b)
|
||||
{
|
||||
red = (ushort) (r << 8 | r);
|
||||
green = (ushort) (g << 8 | g);
|
||||
blue = (ushort) (b << 8 | b);
|
||||
pixel = 0;
|
||||
}
|
||||
|
||||
public Color (System.Drawing.Color color)
|
||||
{
|
||||
byte r, g, b;
|
||||
r = color.R;
|
||||
g = color.G;
|
||||
b = color.B;
|
||||
|
||||
red = (ushort) (r << 8 | r);
|
||||
green = (ushort) (g << 8 | g);
|
||||
blue = (ushort) (b << 8 | b);
|
||||
pixel = 0;
|
||||
}
|
9
gdk/Colormap.custom
Normal file
9
gdk/Colormap.custom
Normal file
|
@ -0,0 +1,9 @@
|
|||
[DllImport("libgdk-win32-2.0-0.dll", EntryPoint="gdk_colormap_alloc_color")]
|
||||
static extern bool _gdk_colormap_alloc_color(IntPtr raw, ref Gdk.Color color, bool writeable, bool best_match);
|
||||
|
||||
public bool AllocColor(ref Gdk.Color color, bool writeable, bool best_match)
|
||||
{
|
||||
bool raw_ret = _gdk_colormap_alloc_color(Handle, ref color, writeable, best_match);
|
||||
bool ret = raw_ret;
|
||||
return ret;
|
||||
}
|
Loading…
Reference in a new issue