X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=blobdiff_plain;f=basis%2Fwindows%2Fgdiplus%2Fgdiplus.factor;h=607daa704da12be6015ccfb6b04aed3a75d6aa38;hp=5398dd4706e49df2438f951c3ddbadd6ac198768;hb=HEAD;hpb=b6be8685c3b3a252544c03e9ebc7e88edd97e795 diff --git a/basis/windows/gdiplus/gdiplus.factor b/basis/windows/gdiplus/gdiplus.factor index 5398dd4706..4acee1d7a4 100644 --- a/basis/windows/gdiplus/gdiplus.factor +++ b/basis/windows/gdiplus/gdiplus.factor @@ -1,7 +1,8 @@ -! (c)2010 Joe Groff bsd license +! Copyright (C) 2010 Joe Groff. +! See https://factorcode.org/license.txt for BSD license. USING: alien.c-types alien.data alien.destructors alien.syntax -classes.struct kernel math windows.com windows.com.syntax -windows.kernel32 windows.ole32 windows.types ; +classes.struct init kernel literals math namespaces windows.com +windows.com.syntax windows.kernel32 windows.ole32 windows.types ; FROM: alien.c-types => float ; IN: windows.gdiplus @@ -247,7 +248,7 @@ ENUM: StringAlignment { StringAlignmentCenter 1 } { StringAlignmentFar 2 } ; -ENUM: StringDigitSubstitute +ENUM: StringDigitSubstitute { StringDigitSubstituteUser 0 } { StringDigitSubstituteNone 1 } { StringDigitSubstituteNational 2 } @@ -447,11 +448,11 @@ CONSTANT: PixelFormatDontCare 0 CONSTANT: PixelFormatMax 15 : PixelFormat1bppIndexed ( -- x ) - 1 1 PixelFormatIndexed PixelFormatGDI bitor pixel-format-constant ; inline + 1 1 flags{ PixelFormatIndexed PixelFormatGDI } pixel-format-constant ; inline : PixelFormat4bppIndexed ( -- x ) - 2 4 PixelFormatIndexed PixelFormatGDI bitor pixel-format-constant ; inline + 2 4 flags{ PixelFormatIndexed PixelFormatGDI } pixel-format-constant ; inline : PixelFormat8bppIndexed ( -- x ) - 3 8 PixelFormatIndexed PixelFormatGDI bitor pixel-format-constant ; inline + 3 8 flags{ PixelFormatIndexed PixelFormatGDI } pixel-format-constant ; inline : PixelFormat16bppGrayScale ( -- x ) 4 16 PixelFormatExtended pixel-format-constant ; inline : PixelFormat16bppRGB555 ( -- x ) @@ -459,21 +460,21 @@ CONSTANT: PixelFormatMax 15 : PixelFormat16bppRGB565 ( -- x ) 6 16 PixelFormatGDI pixel-format-constant ; inline : PixelFormat16bppARGB1555 ( -- x ) - 7 16 PixelFormatAlpha PixelFormatGDI bitor pixel-format-constant ; inline + 7 16 flags{ PixelFormatAlpha PixelFormatGDI } pixel-format-constant ; inline : PixelFormat24bppRGB ( -- x ) 8 24 PixelFormatGDI pixel-format-constant ; inline : PixelFormat32bppRGB ( -- x ) 9 32 PixelFormatGDI pixel-format-constant ; inline : PixelFormat32bppARGB ( -- x ) - 10 32 PixelFormatAlpha PixelFormatGDI PixelFormatCanonical bitor bitor pixel-format-constant ; inline + 10 32 flags{ PixelFormatAlpha PixelFormatGDI PixelFormatCanonical } pixel-format-constant ; inline : PixelFormat32bppPARGB ( -- x ) - 11 32 PixelFormatAlpha PixelFormatPAlpha PixelFormatGDI bitor bitor pixel-format-constant ; inline + 11 32 flags{ PixelFormatAlpha PixelFormatPAlpha PixelFormatGDI } pixel-format-constant ; inline : PixelFormat48bppRGB ( -- x ) 12 48 PixelFormatExtended pixel-format-constant ; inline : PixelFormat64bppARGB ( -- x ) - 13 64 PixelFormatAlpha PixelFormatCanonical PixelFormatExtended bitor bitor pixel-format-constant ; inline + 13 64 flags{ PixelFormatAlpha PixelFormatCanonical PixelFormatExtended } pixel-format-constant ; inline : PixelFormat64bppPARGB ( -- x ) - 14 64 PixelFormatAlpha PixelFormatPAlpha PixelFormatExtended bitor bitor pixel-format-constant ; inline + 14 64 flags{ PixelFormatAlpha PixelFormatPAlpha PixelFormatExtended } pixel-format-constant ; inline STRUCT: ColorPalette { Flags UINT } @@ -1628,7 +1629,7 @@ FUNCTION: GpStatus GdipTestControl ( GpTestControlEnum x, void* x ) ERROR: gdi+-error status ; : check-gdi+-status ( GpStatus -- ) - dup Ok = [ drop ] [ throw-gdi+-error ] if ; + dup Ok = [ drop ] [ gdi+-error ] if ; CONSTANT: standard-gdi+-startup-input S{ GdiplusStartupInput @@ -1647,3 +1648,9 @@ CONSTANT: standard-gdi+-startup-input GdiplusShutdown ; DESTRUCTOR: stop-gdi+ + +SYMBOL: gdi-token + +STARTUP-HOOK: [ start-gdi+ gdi-token set-global ] + +SHUTDOWN-HOOK: [ gdi-token get-global [ stop-gdi+ ] when* ]