public const int LANG_NEUTRAL = 0;
public static IntPtr Display = IntPtr.Zero;
public static bool UseX11Drawable;
- public static bool UseQuartzDrawable = (Environment.GetEnvironmentVariable ("MONO_MWF_USE_QUARTZ_BACKEND") != null);
+ public static bool UseQuartzDrawable = (Environment.GetEnvironmentVariable ("MONO_MWF_USE_CARBON_BACKEND") != null);
public static bool UseCocoaDrawable = (Environment.GetEnvironmentVariable ("MONO_GDIP_USE_COCOA_BACKEND") != null);
#region gdiplus.dll functions
}
// Copies a Ptr to an array of Points and releases the memory
- static public void FromUnManagedMemoryToPointI(IntPtr prt, Point [] pts)
+ static public void FromUnManagedMemoryToPointI (IntPtr prt, Point [] pts)
{
- int nPointSize = Marshal.SizeOf(pts[0]);
+ int nPointSize = Marshal.SizeOf (pts[0]);
IntPtr pos = prt;
for (int i=0; i<pts.Length; i++, pos = new IntPtr (pos.ToInt64 () + nPointSize))
- pts[i] = (Point) Marshal.PtrToStructure(pos, typeof(Point));
+ pts[i] = (Point) Marshal.PtrToStructure (pos, typeof (Point));
- Marshal.FreeHGlobal(prt);
+ Marshal.FreeHGlobal (prt);
}
// Copies a Ptr to an array of Points and releases the memory
static public void FromUnManagedMemoryToPoint (IntPtr prt, PointF [] pts)
{
- int nPointSize = Marshal.SizeOf(pts[0]);
+ int nPointSize = Marshal.SizeOf (pts[0]);
IntPtr pos = prt;
for (int i=0; i<pts.Length; i++, pos = new IntPtr (pos.ToInt64 () + nPointSize))
- pts[i] = (PointF) Marshal.PtrToStructure(pos, typeof(Point));
+ pts[i] = (PointF) Marshal.PtrToStructure (pos, typeof (PointF));
- Marshal.FreeHGlobal(prt);
+ Marshal.FreeHGlobal (prt);
}
// Copies an array of Points to unmanaged memory
- static public IntPtr FromPointToUnManagedMemoryI(Point [] pts)
+ static public IntPtr FromPointToUnManagedMemoryI (Point [] pts)
{
- int nPointSize = Marshal.SizeOf(pts[0]);
- IntPtr dest = Marshal.AllocHGlobal(nPointSize* pts.Length);
+ int nPointSize = Marshal.SizeOf (pts[0]);
+ IntPtr dest = Marshal.AllocHGlobal (nPointSize * pts.Length);
IntPtr pos = dest;
for (int i=0; i<pts.Length; i++, pos = new IntPtr (pos.ToInt64 () + nPointSize))
- Marshal.StructureToPtr(pts[i], pos, false);
+ Marshal.StructureToPtr (pts[i], pos, false);
return dest;
}
int nPointSize = Marshal.SizeOf (pts[0]);
IntPtr pos = prt;
for (int i = 0; i < pts.Length; i++, pos = new IntPtr (pos.ToInt64 () + nPointSize))
- pts[i] = (RectangleF) Marshal.PtrToStructure(pos, typeof(RectangleF));
+ pts[i] = (RectangleF) Marshal.PtrToStructure (pos, typeof (RectangleF));
- Marshal.FreeHGlobal(prt);
+ Marshal.FreeHGlobal (prt);
}
// Copies an array of Points to unmanaged memory
- static public IntPtr FromPointToUnManagedMemory(PointF [] pts)
+ static public IntPtr FromPointToUnManagedMemory (PointF [] pts)
{
- int nPointSize = Marshal.SizeOf(pts[0]);
- IntPtr dest = Marshal.AllocHGlobal(nPointSize* pts.Length);
+ int nPointSize = Marshal.SizeOf (pts[0]);
+ IntPtr dest = Marshal.AllocHGlobal (nPointSize * pts.Length);
IntPtr pos = dest;
for (int i=0; i<pts.Length; i++, pos = new IntPtr (pos.ToInt64 () + nPointSize))
- Marshal.StructureToPtr(pts[i], pos, false);
+ Marshal.StructureToPtr (pts[i], pos, false);
return dest;
}
internal static extern Status GdipCreateFromHWND (IntPtr hwnd, out IntPtr graphics);
[DllImport("gdiplus.dll", CharSet=CharSet.Unicode)]
- internal static extern Status GdipMeasureString(IntPtr graphics, string str, int length, IntPtr font,
- ref RectangleF layoutRect, IntPtr stringFormat, out RectangleF boundingBox, out int codepointsFitted,
- out int linesFilled);
+ internal unsafe static extern Status GdipMeasureString(IntPtr graphics, string str, int length,
+ IntPtr font, ref RectangleF layoutRect, IntPtr stringFormat, out RectangleF boundingBox,
+ int *codepointsFitted, int *linesFilled);
[DllImport("gdiplus.dll", CharSet=CharSet.Unicode)]
internal static extern Status GdipMeasureCharacterRanges (IntPtr graphics, string str, int length, IntPtr font,
internal static extern Status GdipRemovePropertyItem (IntPtr image, int propertyId);
[DllImport("gdiplus.dll")]
- internal static extern Status GdipSetPropertyItem (IntPtr image, IntPtr propertyItem);
+ internal unsafe static extern Status GdipSetPropertyItem (IntPtr image, GdipPropertyItem *propertyItem);
[DllImport("gdiplus.dll")]
internal static extern Status GdipGetImageThumbnail ( IntPtr image, uint width, uint height, out IntPtr thumbImage, IntPtr callback, IntPtr callBackData );
private byte[] managedBuf;
private const int default_bufsize = 4096;
- public GdiPlusStreamHelper (Stream s)
+ public GdiPlusStreamHelper (Stream s, bool seekToOrigin)
{
managedBuf = new byte [default_bufsize];
stream = s;
- if (stream != null && stream.CanSeek) {
+ if (stream != null && stream.CanSeek && seekToOrigin) {
stream.Seek (0, SeekOrigin.Begin);
}
}