//
// Copyright (C) 2002 Ximian, Inc. http://www.ximian.com
// Copyright (C) 2004, 2007 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2013 Kristof Ralovich, changes are available under the terms of the MIT X11 license
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
public void SetPropertyItem(PropertyItem propitem)
{
- throw new NotImplementedException ();
-/*
- GdipPropertyItem pi = new GdipPropertyItem ();
- GdipPropertyItem.MarshalTo (pi, propitem);
- unsafe {
- Status status = GDIPlus.GdipSetPropertyItem (nativeObject, &pi);
+ if (propitem == null)
+ throw new ArgumentNullException ("propitem");
+
+ int nItemSize = Marshal.SizeOf (propitem.Value[0]);
+ int size = nItemSize * propitem.Value.Length;
+ IntPtr dest = Marshal.AllocHGlobal (size);
+ try {
+ GdipPropertyItem pi = new GdipPropertyItem ();
+ pi.id = propitem.Id;
+ pi.len = propitem.Len;
+ pi.type = propitem.Type;
+
+ Marshal.Copy (propitem.Value, 0, dest, size);
+ pi.value = dest;
+
+ unsafe {
+ Status status = GDIPlus.GdipSetPropertyItem (nativeObject, &pi);
- GDIPlus.CheckStatus (status);
+ GDIPlus.CheckStatus (status);
+ }
+ }
+ finally {
+ Marshal.FreeHGlobal (dest);
}
-*/
}
// properties