+
+ERROR: gdi+-error status ;
+
+: check-gdi+-status ( GpStatus -- )
+ dup Ok = [ drop ] [ gdi+-error ] if ;
+
+CONSTANT: standard-gdi+-startup-input
+ S{ GdiplusStartupInput
+ { GdiplusVersion 1 }
+ { DebugEventCallback f }
+ { SuppressBackgroundThread 0 }
+ { SuppressExternalCodecs 0 }
+ }
+
+: (start-gdi+) ( startup-input -- token startup-output )
+ { ULONG_PTR GdiplusStartupOutput }
+ [ swapd GdiplusStartup check-gdi+-status ] [ ] with-out-parameters ;
+: start-gdi+ ( -- token )
+ standard-gdi+-startup-input (start-gdi+) drop ; inline
+: stop-gdi+ ( token -- )
+ GdiplusShutdown ;
+
+DESTRUCTOR: stop-gdi+