nullschritt Posted March 7, 2015 Share Posted March 7, 2015 Okay, first of, I need to apologize because I have no example code because I have NO IDEA how to go about what I'm asking, but any pointers would be really helpful. Basically I'm needing to convert pictures(jpegs) to an 8 or 16 bit version of themselves, so that they take up much less space. Is there maybe a way to do this with gdi? Thanks ahead of time. Link to comment Share on other sites More sharing options...
UEZ Posted March 7, 2015 Share Posted March 7, 2015 (edited) It is possible with GDI+ but you need gdiplus.dll version 1.1 which is available on Vista or higher os. But the results might be not so optimal compared to external tools. Have a look to_GDIPlus_PaletteInitializein the help file to get a start. Edited March 7, 2015 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
nullschritt Posted March 7, 2015 Author Share Posted March 7, 2015 (edited) I'm trying to get the image to a lower quality, and I need to be able to get it directly as binary without being able to save it to a file. I have a function I found that does this, but it only works with some older versions of the gdi functions I had laying around (written at the same time as the _gdiplus_saveimage2binary() function. (I'm aware the use of _gdiplus_saveimage2binary() in this script is redundant, but it's just an example script to test the functionality.) Anyways, no matter what I change the paramaters to, the image comes out in the same format as it was in originally. (full color) even when I set it to black and white. I dont get any errors, it just doesn't seem to have any effect on the image. My code is below: expandcollapse popup#include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Global Const $tagpoint = "struct;long X;long Y;endstruct" Global Const $tagrect = "struct;long Left;long Top;long Right;long Bottom;endstruct" Global Const $tagsize = "struct;long X;long Y;endstruct" Global Const $tagmargins = "int cxLeftWidth;int cxRightWidth;int cyTopHeight;int cyBottomHeight" Global Const $tagfiletime = "struct;dword Lo;dword Hi;endstruct" Global Const $tagsystemtime = "struct;word Year;word Month;word Dow;word Day;word Hour;word Minute;word Second;word MSeconds;endstruct" Global Const $tagtime_zone_information = "struct;long Bias;wchar StdName[32];word StdDate[8];long StdBias;wchar DayName[32];word DayDate[8];long DayBias;endstruct" Global Const $tagnmhdr = "struct;hwnd hWndFrom;uint_ptr IDFrom;INT Code;endstruct" Global Const $tagcomboboxexitem = "uint Mask;int_ptr Item;ptr Text;int TextMax;int Image;int SelectedImage;int OverlayImage;" & "int Indent;lparam Param" Global Const $tagnmcbedragbegin = $tagnmhdr & ";int ItemID;wchar szText[260]" Global Const $tagnmcbeendedit = $tagnmhdr & ";bool fChanged;int NewSelection;wchar szText[260];int Why" Global Const $tagnmcomboboxex = $tagnmhdr & ";uint Mask;int_ptr Item;ptr Text;int TextMax;int Image;" & "int SelectedImage;int OverlayImage;int Indent;lparam Param" Global Const $tagdtprange = "word MinYear;word MinMonth;word MinDOW;word MinDay;word MinHour;word MinMinute;" & "word MinSecond;word MinMSecond;word MaxYear;word MaxMonth;word MaxDOW;word MaxDay;word MaxHour;" & "word MaxMinute;word MaxSecond;word MaxMSecond;bool MinValid;bool MaxValid" Global Const $tagnmdatetimechange = $tagnmhdr & ";dword Flag;" & $tagsystemtime Global Const $tagnmdatetimeformat = $tagnmhdr & ";ptr Format;" & $tagsystemtime & ";ptr pDisplay;wchar Display[64]" Global Const $tagnmdatetimeformatquery = $tagnmhdr & ";ptr Format;struct;long SizeX;long SizeY;endstruct" Global Const $tagnmdatetimekeydown = $tagnmhdr & ";int VirtKey;ptr Format;" & $tagsystemtime Global Const $tagnmdatetimestring = $tagnmhdr & ";ptr UserString;" & $tagsystemtime & ";dword Flags" Global Const $tageventlogrecord = "dword Length;dword Reserved;dword RecordNumber;dword TimeGenerated;dword TimeWritten;dword EventID;" & "word EventType;word NumStrings;word EventCategory;word ReservedFlags;dword ClosingRecordNumber;dword StringOffset;" & "dword UserSidLength;dword UserSidOffset;dword DataLength;dword DataOffset" Global Const $taggdip_effectparams_blur = "float Radius; bool ExpandEdge" Global Const $taggdip_effectparams_brightnesscontrast = "int BrightnessLevel; int ContrastLevel" Global Const $taggdip_effectparams_colorbalance = "int CyanRed; int MagentaGreen; int YellowBlue" Global Const $taggdip_effectparams_colorcurve = "int Adjustment; int Channel; int AdjustValue" Global Const $taggdip_effectparams_colorlut = "byte LutB[256]; byte LutG[256]; byte LutR[256]; byte LutA[256]" Global Const $taggdip_effectparams_huesaturationlightness = "int HueLevel; int SaturationLevel; int LightnessLevel" Global Const $taggdip_effectparams_levels = "int Highlight; int Midtone; int Shadow" Global Const $taggdip_effectparams_redeyecorrection = "uint NumberOfAreas; ptr Areas" Global Const $taggdip_effectparams_sharpen = "float Radius; float Amount" Global Const $taggdip_effectparams_tint = "int Hue; int Amount" Global Const $taggdipbitmapdata = "uint Width;uint Height;int Stride;int Format;ptr Scan0;uint_ptr Reserved" Global Const $taggdipcolormatrix = "float m[25]" Global Const $taggdipencoderparam = "struct;byte GUID[16];ulong NumberOfValues;ulong Type;ptr Values;endstruct" Global Const $taggdipencoderparams = "uint Count;" & $taggdipencoderparam Global Const $taggdiprectf = "struct;float X;float Y;float Width;float Height;endstruct" Global Const $taggdipstartupinput = "uint Version;ptr Callback;bool NoThread;bool NoCodecs" Global Const $taggdipstartupoutput = "ptr HookProc;ptr UnhookProc" Global Const $taggdipimagecodecinfo = "byte CLSID[16];byte FormatID[16];ptr CodecName;ptr DllName;ptr FormatDesc;ptr FileExt;" & "ptr MimeType;dword Flags;dword Version;dword SigCount;dword SigSize;ptr SigPattern;ptr SigMask" Global Const $taggdippencoderparams = "uint Count;byte Params[1]" Global Const $taghditem = "uint Mask;int XY;ptr Text;handle hBMP;int TextMax;int Fmt;lparam Param;int Image;int Order;uint Type;ptr pFilter;uint State" Global Const $tagnmhddispinfo = $tagnmhdr & ";int Item;uint Mask;ptr Text;int TextMax;int Image;lparam lParam" Global Const $tagnmhdfilterbtnclick = $tagnmhdr & ";int Item;" & $tagrect Global Const $tagnmheader = $tagnmhdr & ";int Item;int Button;ptr pItem" Global Const $taggetipaddress = "byte Field4;byte Field3;byte Field2;byte Field1" Global Const $tagnmipaddress = $tagnmhdr & ";int Field;int Value" Global Const $taglvfindinfo = "struct;uint Flags;ptr Text;lparam Param;" & $tagpoint & ";uint Direction;endstruct" Global Const $taglvhittestinfo = $tagpoint & ";uint Flags;int Item;int SubItem;int iGroup" Global Const $taglvitem = "struct;uint Mask;int Item;int SubItem;uint State;uint StateMask;ptr Text;int TextMax;int Image;lparam Param;" & "int Indent;int GroupID;uint Columns;ptr pColumns;ptr piColFmt;int iGroup;endstruct" Global Const $tagnmlistview = $tagnmhdr & ";int Item;int SubItem;uint NewState;uint OldState;uint Changed;" & "struct;long ActionX;long ActionY;endstruct;lparam Param" Global Const $tagnmlvcustomdraw = "struct;" & $tagnmhdr & ";dword dwDrawStage;handle hdc;" & $tagrect & ";dword_ptr dwItemSpec;uint uItemState;lparam lItemlParam;endstruct" & ";dword clrText;dword clrTextBk;int iSubItem;dword dwItemType;dword clrFace;int iIconEffect;" & "int iIconPhase;int iPartId;int iStateId;struct;long TextLeft;long TextTop;long TextRight;long TextBottom;endstruct;uint uAlign" Global Const $tagnmlvdispinfo = $tagnmhdr & ";" & $taglvitem Global Const $tagnmlvfinditem = $tagnmhdr & ";int Start;" & $taglvfindinfo Global Const $tagnmlvgetinfotip = $tagnmhdr & ";dword Flags;ptr Text;int TextMax;int Item;int SubItem;lparam lParam" Global Const $tagnmitemactivate = $tagnmhdr & ";int Index;int SubItem;uint NewState;uint OldState;uint Changed;" & $tagpoint & ";lparam lParam;uint KeyFlags" Global Const $tagnmlvkeydown = "align 1;" & $tagnmhdr & ";word VKey;uint Flags" Global Const $tagnmlvscroll = $tagnmhdr & ";int DX;int DY" Global Const $tagmchittestinfo = "uint Size;" & $tagpoint & ";uint Hit;" & $tagsystemtime & ";" & $tagrect & ";int iOffset;int iRow;int iCol" Global Const $tagmcmonthrange = "word MinYear;word MinMonth;word MinDOW;word MinDay;word MinHour;word MinMinute;word MinSecond;" & "word MinMSeconds;word MaxYear;word MaxMonth;word MaxDOW;word MaxDay;word MaxHour;word MaxMinute;word MaxSecond;" & "word MaxMSeconds;short Span" Global Const $tagmcrange = "word MinYear;word MinMonth;word MinDOW;word MinDay;word MinHour;word MinMinute;word MinSecond;" & "word MinMSeconds;word MaxYear;word MaxMonth;word MaxDOW;word MaxDay;word MaxHour;word MaxMinute;word MaxSecond;" & "word MaxMSeconds;short MinSet;short MaxSet" Global Const $tagmcselrange = "word MinYear;word MinMonth;word MinDOW;word MinDay;word MinHour;word MinMinute;word MinSecond;" & "word MinMSeconds;word MaxYear;word MaxMonth;word MaxDOW;word MaxDay;word MaxHour;word MaxMinute;word MaxSecond;" & "word MaxMSeconds" Global Const $tagnmdaystate = $tagnmhdr & ";" & $tagsystemtime & ";int DayState;ptr pDayState" Global Const $tagnmselchange = $tagnmhdr & ";struct;word BegYear;word BegMonth;word BegDOW;word BegDay;word BegHour;word BegMinute;word BegSecond;word BegMSeconds;endstruct;" & "struct;word EndYear;word EndMonth;word EndDOW;word EndDay;word EndHour;word EndMinute;word EndSecond;word EndMSeconds;endstruct" Global Const $tagnmobjectnotify = $tagnmhdr & ";int Item;ptr piid;ptr pObject;long Result;dword dwFlags" Global Const $tagnmtckeydown = "align 1;" & $tagnmhdr & ";word VKey;uint Flags" Global Const $tagtvitem = "struct;uint Mask;handle hItem;uint State;uint StateMask;ptr Text;int TextMax;int Image;int SelectedImage;" & "int Children;lparam Param;endstruct" Global Const $tagtvitemex = "struct;" & $tagtvitem & ";int Integral;uint uStateEx;hwnd hwnd;int iExpandedImage;int iReserved;endstruct" Global Const $tagnmtreeview = $tagnmhdr & ";uint Action;" & "struct;uint OldMask;handle OldhItem;uint OldState;uint OldStateMask;" & "ptr OldText;int OldTextMax;int OldImage;int OldSelectedImage;int OldChildren;lparam OldParam;endstruct;" & "struct;uint NewMask;handle NewhItem;uint NewState;uint NewStateMask;" & "ptr NewText;int NewTextMax;int NewImage;int NewSelectedImage;int NewChildren;lparam NewParam;endstruct;" & "struct;long PointX;long PointY;endstruct" Global Const $tagnmtvcustomdraw = "struct;" & $tagnmhdr & ";dword DrawStage;handle HDC;" & $tagrect & ";dword_ptr ItemSpec;uint ItemState;lparam ItemParam;endstruct" & ";dword ClrText;dword ClrTextBk;int Level" Global Const $tagnmtvdispinfo = $tagnmhdr & ";" & $tagtvitem Global Const $tagnmtvgetinfotip = $tagnmhdr & ";ptr Text;int TextMax;handle hItem;lparam lParam" Global Const $tagtvhittestinfo = $tagpoint & ";uint Flags;handle Item" Global Const $tagnmtvkeydown = "align 1;" & $tagnmhdr & ";word VKey;uint Flags" Global Const $tagnmmouse = $tagnmhdr & ";dword_ptr ItemSpec;dword_ptr ItemData;" & $tagpoint & ";lparam HitInfo" Global Const $tagtoken_privileges = "dword Count;align 4;int64 LUID;dword Attributes" Global Const $tagimageinfo = "handle hBitmap;handle hMask;int Unused1;int Unused2;" & $tagrect Global Const $tagmenuinfo = "dword Size;INT Mask;dword Style;uint YMax;handle hBack;dword ContextHelpID;ulong_ptr MenuData" Global Const $tagmenuiteminfo = "uint Size;uint Mask;uint Type;uint State;uint ID;handle SubMenu;handle BmpChecked;handle BmpUnchecked;" & "ulong_ptr ItemData;ptr TypeData;uint CCH;handle BmpItem" Global Const $tagrebarbandinfo = "uint cbSize;uint fMask;uint fStyle;dword clrFore;dword clrBack;ptr lpText;uint cch;" & "int iImage;hwnd hwndChild;uint cxMinChild;uint cyMinChild;uint cx;handle hbmBack;uint wID;uint cyChild;uint cyMaxChild;" & "uint cyIntegral;uint cxIdeal;lparam lParam;uint cxHeader" & ((@OSVersion = "WIN_XP") ? "" : ";" & $tagrect & ";uint uChevronState") Global Const $tagnmrebarautobreak = $tagnmhdr & ";uint uBand;uint wID;lparam lParam;uint uMsg;uint fStyleCurrent;bool fAutoBreak" Global Const $tagnmrbautosize = $tagnmhdr & ";bool fChanged;" & "struct;long TargetLeft;long TargetTop;long TargetRight;long TargetBottom;endstruct;" & "struct;long ActualLeft;long ActualTop;long ActualRight;long ActualBottom;endstruct" Global Const $tagnmrebar = $tagnmhdr & ";dword dwMask;uint uBand;uint fStyle;uint wID;lparam lParam" Global Const $tagnmrebarchevron = $tagnmhdr & ";uint uBand;uint wID;lparam lParam;" & $tagrect & ";lparam lParamNM" Global Const $tagnmrebarchildsize = $tagnmhdr & ";uint uBand;uint wID;" & "struct;long CLeft;long CTop;long CRight;long CBottom;endstruct;" & "struct;long BLeft;long BTop;long BRight;long BBottom;endstruct" Global Const $tagcolorscheme = "dword Size;dword BtnHighlight;dword BtnShadow" Global Const $tagnmtoolbar = $tagnmhdr & ";int iItem;" & "struct;int iBitmap;int idCommand;byte fsState;byte fsStyle;dword_ptr dwData;int_ptr iString;endstruct" & ";int cchText;ptr pszText;" & $tagrect Global Const $tagnmtbhotitem = $tagnmhdr & ";int idOld;int idNew;dword dwFlags" Global Const $tagtbbutton = "int Bitmap;int Command;byte State;byte Style;dword_ptr Param;int_ptr String" Global Const $tagtbbuttoninfo = "uint Size;dword Mask;int Command;int Image;byte State;byte Style;word CX;dword_ptr Param;ptr Text;int TextMax" Global Const $tagnetresource = "dword Scope;dword Type;dword DisplayType;dword Usage;ptr LocalName;ptr RemoteName;ptr Comment;ptr Provider" Global Const $tagoverlapped = "ulong_ptr Internal;ulong_ptr InternalHigh;struct;dword Offset;dword OffsetHigh;endstruct;handle hEvent" Global Const $tagopenfilename = "dword StructSize;hwnd hwndOwner;handle hInstance;ptr lpstrFilter;ptr lpstrCustomFilter;" & "dword nMaxCustFilter;dword nFilterIndex;ptr lpstrFile;dword nMaxFile;ptr lpstrFileTitle;dword nMaxFileTitle;" & "ptr lpstrInitialDir;ptr lpstrTitle;dword Flags;word nFileOffset;word nFileExtension;ptr lpstrDefExt;lparam lCustData;" & "ptr lpfnHook;ptr lpTemplateName;ptr pvReserved;dword dwReserved;dword FlagsEx" Global Const $tagbitmapinfoheader = "struct;dword biSize;long biWidth;long biHeight;word biPlanes;word biBitCount;" & "dword biCompression;dword biSizeImage;long biXPelsPerMeter;long biYPelsPerMeter;dword biClrUsed;dword biClrImportant;endstruct" Global Const $tagbitmapinfo = $tagbitmapinfoheader & ";dword biRGBQuad[1]" Global Const $tagblendfunction = "byte Op;byte Flags;byte Alpha;byte Format" Global Const $tagguid = "struct;ulong Data1;ushort Data2;ushort Data3;byte Data4[8];endstruct" Global Const $tagwindowplacement = "uint length;uint flags;uint showCmd;long ptMinPosition[2];long ptMaxPosition[2];long rcNormalPosition[4]" Global Const $tagwindowpos = "hwnd hWnd;hwnd InsertAfter;int X;int Y;int CX;int CY;uint Flags" Global Const $tagscrollinfo = "uint cbSize;uint fMask;int nMin;int nMax;uint nPage;int nPos;int nTrackPos" Global Const $tagscrollbarinfo = "dword cbSize;" & $tagrect & ";int dxyLineButton;int xyThumbTop;" & "int xyThumbBottom;int reserved;dword rgstate[6]" Global Const $taglogfont = "struct;long Height;long Width;long Escapement;long Orientation;long Weight;byte Italic;byte Underline;" & "byte Strikeout;byte CharSet;byte OutPrecisionPrecision;byte ClipPrecision;byte Quality;byte PitchAndFamily;wchar FaceName[32];endstruct" Global Const $tagkbdllhookstruct = "dword vkCode;dword scanCode;dword flags;dword time;ulong_ptr dwExtraInfo" Global Const $tagprocess_information = "handle hProcess;handle hThread;dword ProcessID;dword ThreadID" Global Const $tagstartupinfo = "dword Size;ptr Reserved1;ptr Desktop;ptr Title;dword X;dword Y;dword XSize;dword YSize;dword XCountChars;" & "dword YCountChars;dword FillAttribute;dword Flags;word ShowWindow;word Reserved2;ptr Reserved3;handle StdInput;" & "handle StdOutput;handle StdError" Global Const $tagsecurity_attributes = "dword Length;ptr Descriptor;bool InheritHandle" Global Const $tagwin32_find_data = "dword dwFileAttributes;dword ftCreationTime[2];dword ftLastAccessTime[2];dword ftLastWriteTime[2];dword nFileSizeHigh;dword nFileSizeLow;dword dwReserved0;dword dwReserved1;wchar cFileName[260];wchar cAlternateFileName[14]" Global Const $tagtextmetric = "long tmHeight;long tmAscent;long tmDescent;long tmInternalLeading;long tmExternalLeading;" & "long tmAveCharWidth;long tmMaxCharWidth;long tmWeight;long tmOverhang;long tmDigitizedAspectX;long tmDigitizedAspectY;" & "wchar tmFirstChar;wchar tmLastChar;wchar tmDefaultChar;wchar tmBreakChar;byte tmItalic;byte tmUnderlined;byte tmStruckOut;" & "byte tmPitchAndFamily;byte tmCharSet" Global $ghgdipbrush = 0 Global $ghgdipdll = 0 Global $ghgdippen = 0 Global $gigdipref = 0 Global $gigdiptoken = 0 Global $gbgdip_v1_0 = True Global Const $gmem_fixed = 0 Global Const $gmem_moveable = 2 Global Const $gmem_nocompact = 16 Global Const $gmem_nodiscard = 32 Global Const $gmem_zeroinit = 64 Global Const $gmem_modify = 128 Global Const $gmem_discardable = 256 Global Const $gmem_not_banked = 4096 Global Const $gmem_share = 8192 Global Const $gmem_ddeshare = 8192 Global Const $gmem_notify = 16384 Global Const $gmem_lower = 4096 Global Const $gmem_valid_flags = 32626 Global Const $gmem_invalid_handle = 32768 Global Const $gptr = BitOR($gmem_fixed, $gmem_zeroinit) Global Const $ghnd = BitOR($gmem_moveable, $gmem_zeroinit) Global Const $mem_commit = 4096 Global Const $mem_reserve = 8192 Global Const $mem_top_down = 1048576 Global Const $mem_shared = 134217728 Global Const $page_noaccess = 1 Global Const $page_readonly = 2 Global Const $page_readwrite = 4 Global Const $page_execute = 16 Global Const $page_execute_read = 32 Global Const $page_execute_readwrite = 64 Global Const $page_execute_writecopy = 128 Global Const $page_guard = 256 Global Const $page_nocache = 512 Global Const $page_writecombine = 1024 Global Const $page_writecopy = 8 Global Const $mem_decommit = 16384 Global Const $mem_release = 32768 Global Const $process_terminate = 1 Global Const $process_create_thread = 2 Global Const $process_set_sessionid = 4 Global Const $process_vm_operation = 8 Global Const $process_vm_read = 16 Global Const $process_vm_write = 32 Global Const $process_dup_handle = 64 Global Const $process_create_process = 128 Global Const $process_set_quota = 256 Global Const $process_set_information = 512 Global Const $process_query_information = 1024 Global Const $process_query_limited_information = 4096 Global Const $process_suspend_resume = 2048 Global Const $process_all_access = 2035711 Global Const $tagmemmap = "handle hProc;ulong_ptr Size;ptr Mem" ; Pen Dash Cap Types Global Const $GDIP_DASHCAPFLAT = 0 ; A square cap that squares off both ends of each dash Global Const $GDIP_DASHCAPROUND = 2 ; A circular cap that rounds off both ends of each dash Global Const $GDIP_DASHCAPTRIANGLE = 3 ; A triangular cap that points both ends of each dash ; Pen Dash Style Types Global Const $GDIP_DASHSTYLESOLID = 0 ; A solid line Global Const $GDIP_DASHSTYLEDASH = 1 ; A dashed line Global Const $GDIP_DASHSTYLEDOT = 2 ; A dotted line Global Const $GDIP_DASHSTYLEDASHDOT = 3 ; An alternating dash-dot line Global Const $GDIP_DASHSTYLEDASHDOTDOT = 4 ; An alternating dash-dot-dot line Global Const $GDIP_DASHSTYLECUSTOM = 5 ; A a user-defined, custom dashed line ; Encoder Parameter GUIDs Global Const $GDIP_EPGCHROMINANCETABLE = '{F2E455DC-09B3-4316-8260-676ADA32481C}' Global Const $GDIP_EPGCOLORDEPTH = '{66087055-AD66-4C7C-9A18-38A2310B8337}' Global Const $GDIP_EPGCOMPRESSION = '{E09D739D-CCD4-44EE-8EBA-3FBF8BE4FC58}' Global Const $GDIP_EPGLUMINANCETABLE = '{EDB33BCE-0266-4A77-B904-27216099E717}' Global Const $GDIP_EPGQUALITY = '{1D5BE4B5-FA4A-452D-9CDD-5DB35105E7EB}' Global Const $GDIP_EPGRENDERMETHOD = '{6D42C53A-229A-4825-8BB7-5C99E2B9A8B8}' Global Const $GDIP_EPGSAVEFLAG = '{292266FC-AC40-47BF-8CFC-A85B89A655DE}' Global Const $GDIP_EPGSCANMETHOD = '{3A4E2661-3109-4E56-8536-42C156E7DCFA}' Global Const $GDIP_EPGTRANSFORMATION = '{8D0EB2D1-A58E-4EA8-AA14-108074B7B6F9}' Global Const $GDIP_EPGVERSION = '{24D18C76-814A-41A4-BF53-1C219CCCF797}' ; Encoder Parameter Types Global Const $GDIP_EPTBYTE = 1 ; 8 bit unsigned integer Global Const $GDIP_EPTASCII = 2 ; Null terminated character string Global Const $GDIP_EPTSHORT = 3 ; 16 bit unsigned integer Global Const $GDIP_EPTLONG = 4 ; 32 bit unsigned integer Global Const $GDIP_EPTRATIONAL = 5 ; Two longs (numerator, denomintor) Global Const $GDIP_EPTLONGRANGE = 6 ; Two longs (low, high) Global Const $GDIP_EPTUNDEFINED = 7 ; Array of bytes of any type Global Const $GDIP_EPTRATIONALRANGE = 8 ; Two ratationals (low, high) ; GDI Error Codes Global Const $GDIP_ERROK = 0 ; Method call was successful Global Const $GDIP_ERRGENERICERROR = 1 ; Generic method call error Global Const $GDIP_ERRINVALIDPARAMETER = 2 ; One of the arguments passed to the method was not valid Global Const $GDIP_ERROUTOFMEMORY = 3 ; The operating system is out of memory Global Const $GDIP_ERROBJECTBUSY = 4 ; One of the arguments in the call is already in use Global Const $GDIP_ERRINSUFFICIENTBUFFER = 5 ; A buffer is not large enough Global Const $GDIP_ERRNOTIMPLEMENTED = 6 ; The method is not implemented Global Const $GDIP_ERRWIN32ERROR = 7 ; The method generated a Microsoft Win32 error Global Const $GDIP_ERRWRONGSTATE = 8 ; The object is in an invalid state to satisfy the API call Global Const $GDIP_ERRABORTED = 9 ; The method was aborted Global Const $GDIP_ERRFILENOTFOUND = 10 ; The specified image file or metafile cannot be found Global Const $GDIP_ERRVALUEOVERFLOW = 11 ; The method produced a numeric overflow Global Const $GDIP_ERRACCESSDENIED = 12 ; A write operation is not allowed on the specified file Global Const $GDIP_ERRUNKNOWNIMAGEFORMAT = 13 ; The specified image file format is not known Global Const $GDIP_ERRFONTFAMILYNOTFOUND = 14 ; The specified font family cannot be found Global Const $GDIP_ERRFONTSTYLENOTFOUND = 15 ; The specified style is not available for the specified font Global Const $GDIP_ERRNOTTRUETYPEFONT = 16 ; The font retrieved is not a TrueType font Global Const $GDIP_ERRUNSUPPORTEDGDIVERSION = 17 ; The installed GDI+ version is incompatible Global Const $GDIP_ERRGDIPLUSNOTINITIALIZED = 18 ; The GDI+ API is not in an initialized state Global Const $GDIP_ERRPROPERTYNOTFOUND = 19 ; The specified property does not exist in the image Global Const $GDIP_ERRPROPERTYNOTSUPPORTED = 20 ; The specified property is not supported ; Encoder Value Types Global Const $GDIP_EVTCOMPRESSIONLZW = 2 ; TIFF: LZW compression Global Const $GDIP_EVTCOMPRESSIONCCITT3 = 3 ; TIFF: CCITT3 compression Global Const $GDIP_EVTCOMPRESSIONCCITT4 = 4 ; TIFF: CCITT4 compression Global Const $GDIP_EVTCOMPRESSIONRLE = 5 ; TIFF: RLE compression Global Const $GDIP_EVTCOMPRESSIONNONE = 6 ; TIFF: No compression Global Const $GDIP_EVTTRANSFORMROTATE90 = 13 ; JPEG: Lossless 90 degree clockwise rotation Global Const $GDIP_EVTTRANSFORMROTATE180 = 14 ; JPEG: Lossless 180 degree clockwise rotation Global Const $GDIP_EVTTRANSFORMROTATE270 = 15 ; JPEG: Lossless 270 degree clockwise rotation Global Const $GDIP_EVTTRANSFORMFLIPHORIZONTAL = 16 ; JPEG: Lossless horizontal flip Global Const $GDIP_EVTTRANSFORMFLIPVERTICAL = 17 ; JPEG: Lossless vertical flip Global Const $GDIP_EVTMULTIFRAME = 18 ; Multiple frame encoding Global Const $GDIP_EVTLASTFRAME = 19 ; Last frame of a multiple frame image Global Const $GDIP_EVTFLUSH = 20 ; The encoder object is to be closed Global Const $GDIP_EVTFRAMEDIMENSIONPAGE = 23 ; TIFF: Page frame dimension ; Image Codec Flags constants Global Const $GDIP_ICFENCODER = 0x00000001 ; The codec supports encoding (saving) Global Const $GDIP_ICFDECODER = 0x00000002 ; The codec supports decoding (reading) Global Const $GDIP_ICFSUPPORTBITMAP = 0x00000004 ; The codec supports raster images (bitmaps) Global Const $GDIP_ICFSUPPORTVECTOR = 0x00000008 ; The codec supports vector images (metafiles) Global Const $GDIP_ICFSEEKABLEENCODE = 0x00000010 ; The encoder requires a seekable output stream Global Const $GDIP_ICFBLOCKINGDECODE = 0x00000020 ; The decoder has blocking behavior during the decoding process Global Const $GDIP_ICFBUILTIN = 0x00010000 ; The codec is built in to GDI+ Global Const $GDIP_ICFSYSTEM = 0x00020000 ; Not used in GDI+ version 1.0 Global Const $GDIP_ICFUSER = 0x00040000 ; Not used in GDI+ version 1.0 ; Image Lock Mode constants Global Const $GDIP_ILMREAD = 0x0001 ; A portion of the image is locked for reading Global Const $GDIP_ILMWRITE = 0x0002 ; A portion of the image is locked for writing Global Const $GDIP_ILMUSERINPUTBUF = 0x0004 ; The buffer is allocated by the user ; LineCap constants Global Const $GDIP_LINECAPFLAT = 0x00 ; Specifies a flat cap Global Const $GDIP_LINECAPSQUARE = 0x01 ; Specifies a square cap Global Const $GDIP_LINECAPROUND = 0x02 ; Specifies a circular cap Global Const $GDIP_LINECAPTRIANGLE = 0x03 ; Specifies a triangular cap Global Const $GDIP_LINECAPNOANCHOR = 0x10 ; Specifies that the line ends are not anchored Global Const $GDIP_LINECAPSQUAREANCHOR = 0x11 ; Specifies that the line ends are anchored with a square Global Const $GDIP_LINECAPROUNDANCHOR = 0x12 ; Specifies that the line ends are anchored with a circle Global Const $GDIP_LINECAPDIAMONDANCHOR = 0x13 ; Specifies that the line ends are anchored with a diamond Global Const $GDIP_LINECAPARROWANCHOR = 0x14 ; Specifies that the line ends are anchored with arrowheads Global Const $GDIP_LINECAPCUSTOM = 0xFF ; Specifies that the line ends are made from a CustomLineCap ; Pixel Format constants Global Const $GDIP_PXF01INDEXED = 0x00030101 ; 1 bpp, indexed Global Const $GDIP_PXF04INDEXED = 0x00030402 ; 4 bpp, indexed Global Const $GDIP_PXF08INDEXED = 0x00030803 ; 8 bpp, indexed Global Const $GDIP_PXF16GRAYSCALE = 0x00101004 ; 16 bpp, grayscale Global Const $GDIP_PXF16RGB555 = 0x00021005 ; 16 bpp; 5 bits for each RGB Global Const $GDIP_PXF16RGB565 = 0x00021006 ; 16 bpp; 5 bits red, 6 bits green, and 5 bits blue Global Const $GDIP_PXF16ARGB1555 = 0x00061007 ; 16 bpp; 1 bit for alpha and 5 bits for each RGB component Global Const $GDIP_PXF24RGB = 0x00021808 ; 24 bpp; 8 bits for each RGB Global Const $GDIP_PXF32RGB = 0x00022009 ; 32 bpp; 8 bits for each RGB. No alpha. Global Const $GDIP_PXF32ARGB = 0x0026200A ; 32 bpp; 8 bits for each RGB and alpha Global Const $GDIP_PXF32PARGB = 0x000E200B ; 32 bpp; 8 bits for each RGB and alpha, pre-mulitiplied Global Const $GDIP_PXF48RGB = 0x0010300C ; 48 bpp; 16 bits for each RGB Global Const $GDIP_PXF64ARGB = 0x0034400D ; 64 bpp; 16 bits for each RGB and alpha Global Const $GDIP_PXF64PARGB = 0x001A400E ; 64 bpp; 16 bits for each RGB and alpha, pre-multiplied ; ImageFormat constants (Globally Unique Identifier (GUID)) Global Const $GDIP_IMAGEFORMAT_UNDEFINED = "{B96B3CA9-0728-11D3-9D7B-0000F81EF32E}" ; Windows GDI+ is unable to determine the format. Global Const $GDIP_IMAGEFORMAT_MEMORYBMP = "{B96B3CAA-0728-11D3-9D7B-0000F81EF32E}" ; Image was constructed from a memory bitmap. Global Const $GDIP_IMAGEFORMAT_BMP = "{B96B3CAB-0728-11D3-9D7B-0000F81EF32E}" ; Microsoft Windows Bitmap (BMP) format. Global Const $GDIP_IMAGEFORMAT_EMF = "{B96B3CAC-0728-11D3-9D7B-0000F81EF32E}" ; Enhanced Metafile (EMF) format. Global Const $GDIP_IMAGEFORMAT_WMF = "{B96B3CAD-0728-11D3-9D7B-0000F81EF32E}" ; Windows Metafile Format (WMF) format. Global Const $GDIP_IMAGEFORMAT_JPEG = "{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}" ; Joint Photographic Experts Group (JPEG) format. Global Const $GDIP_IMAGEFORMAT_PNG = "{B96B3CAF-0728-11D3-9D7B-0000F81EF32E}" ; Portable Network Graphics (PNG) format. Global Const $GDIP_IMAGEFORMAT_GIF = "{B96B3CB0-0728-11D3-9D7B-0000F81EF32E}" ; Graphics Interchange Format (GIF) format. Global Const $GDIP_IMAGEFORMAT_TIFF = "{B96B3CB1-0728-11D3-9D7B-0000F81EF32E}" ; Tagged Image File Format (TIFF) format. Global Const $GDIP_IMAGEFORMAT_EXIF = "{B96B3CB2-0728-11D3-9D7B-0000F81EF32E}" ; Exchangeable Image File (EXIF) format. Global Const $GDIP_IMAGEFORMAT_ICON = "{B96B3CB5-0728-11D3-9D7B-0000F81EF32E}" ; Microsoft Windows Icon Image (ICO)format. ; ImageType constants Global Const $GDIP_IMAGETYPE_UNKNOWN = 0 Global Const $GDIP_IMAGETYPE_BITMAP = 1 Global Const $GDIP_IMAGETYPE_METAFILE = 2 ; ImageFlags flags constants Global Const $GDIP_IMAGEFLAGS_NONE = 0x0 ; no format information. Global Const $GDIP_IMAGEFLAGS_SCALABLE = 0x0001 ; image can be scaled. Global Const $GDIP_IMAGEFLAGS_HASALPHA = 0x0002 ; pixel data contains alpha values. Global Const $GDIP_IMAGEFLAGS_HASTRANSLUCENT = 0x0004 ; pixel data has alpha values other than 0 (transparent) and 255 (opaque). Global Const $GDIP_IMAGEFLAGS_PARTIALLYSCALABLE = 0x0008 ; pixel data is partially scalable with some limitations. Global Const $GDIP_IMAGEFLAGS_COLORSPACE_RGB = 0x0010 ; image is stored using an RGB color space. Global Const $GDIP_IMAGEFLAGS_COLORSPACE_CMYK = 0x0020 ; image is stored using a CMYK color space. Global Const $GDIP_IMAGEFLAGS_COLORSPACE_GRAY = 0x0040 ; image is a grayscale image. Global Const $GDIP_IMAGEFLAGS_COLORSPACE_YCBCR = 0x0080 ; image is stored using a YCBCR color space. Global Const $GDIP_IMAGEFLAGS_COLORSPACE_YCCK = 0x0100 ; image is stored using a YCCK color space. Global Const $GDIP_IMAGEFLAGS_HASREALDPI = 0x1000 ; dots per inch information is stored in the image. Global Const $GDIP_IMAGEFLAGS_HASREALPIXELSIZE = 0x2000 ; pixel size is stored in the image. Global Const $GDIP_IMAGEFLAGS_READONLY = 0x00010000 ; pixel data is read-only. Global Const $GDIP_IMAGEFLAGS_CACHING = 0x00020000 ; pixel data can be cached for faster access. ; Graphic SmoothingMode constants Global Const $GDIP_SMOOTHINGMODE_INVALID = -1 ; Reserved. Global Const $GDIP_SMOOTHINGMODE_DEFAULT = 0 ; Specifies that smoothing is not applied. Global Const $GDIP_SMOOTHINGMODE_HIGHSPEED = 1 ; Specifies that smoothing is not applied. Global Const $GDIP_SMOOTHINGMODE_HIGHQUALITY = 2 ; Specifies that smoothing is applied using an 8 X 4 box filter. Global Const $GDIP_SMOOTHINGMODE_NONE = 3 ; Specifies that smoothing is not applied. Global Const $GDIP_SMOOTHINGMODE_ANTIALIAS8X4 = 4 ; Specifies that smoothing is applied using an 8 X 4 box filter. Global Const $GDIP_SMOOTHINGMODE_ANTIALIAS = $GDIP_SMOOTHINGMODE_ANTIALIAS8X4 ; Specifies that smoothing is applied using an 8 X 4 box filter. Global Const $GDIP_SMOOTHINGMODE_ANTIALIAS8X8 = 5 ; Specifies that smoothing is applied using an 8 X 8 box filter. ; Colors luminance Global Const $GDIP_RLUM = 0.3086 Global Const $GDIP_GLUM = 0.6094 Global Const $GDIP_BLUM = 0.0820 ; Interpolation Mode constants Global Const $GDIP_INTERPOLATIONMODE_INVALID = -1 ; Reserved (used internally) Global Const $GDIP_INTERPOLATIONMODE_DEFAULT = 0 ; Specifies the default interpolation mode Global Const $GDIP_INTERPOLATIONMODE_LOWQUALITY = 1 ; Specifies a low-quality mode Global Const $GDIP_INTERPOLATIONMODE_HIGHQUALITY = 2 ; Specifies a high-quality mode Global Const $GDIP_INTERPOLATIONMODE_BILINEAR = 3 ; Specifies bilinear interpolation. No prefiltering is done. This mode is not suitable for shrinking an image below 50 percent of its original size. Global Const $GDIP_INTERPOLATIONMODE_BICUBIC = 4 ; Specifies bicubic interpolation. No prefiltering is done. This mode is not suitable for shrinking an image below 25 percent of its original size Global Const $GDIP_INTERPOLATIONMODE_NEARESTNEIGHBOR = 5 ; Specifies nearest-neighbor interpolation Global Const $GDIP_INTERPOLATIONMODE_HIGHQUALITYBILINEAR = 6 ; Specifies high-quality, bilinear interpolation. Prefiltering is performed to ensure high-quality shrinking. Global Const $GDIP_INTERPOLATIONMODE_HIGHQUALITYBICUBIC = 7 ; Specifies high-quality, bicubic interpolation. Prefiltering is performed to ensure high-quality shrinking. This mode produces the highest quality transformed images. ; TextRenderingHint constants Global Const $GDIP_TEXTRENDERINGHINT_SYSTEMDEFAULT = 0 ; Specifies that a character is drawn using the currently selected system font smoothing mode (also called a rendering hint). Global Const $GDIP_TEXTRENDERINGHINT_SINGLEBITPERPIXELGRIDFIT = 1 ; Specifies that a character is drawn using its glyph bitmap and hinting to improve character appearance on stems and curvature. Global Const $GDIP_TEXTRENDERINGHINT_SINGLEBITPERPIXEL = 2 ; Specifies that a character is drawn using its glyph bitmap and no hinting. This results in better performance at the expense of quality. Global Const $GDIP_TEXTRENDERINGHINT_ANTIALIASGRIDFIT = 3 ; Specifies that a character is drawn using its antialiased glyph bitmap and hinting. This results in much better quality due to antialiasing at a higher performance cost. Global Const $GDIP_TEXTRENDERINGHINT_ANTIALIAS = 4 ; Specifies that a character is drawn using its antialiased glyph bitmap and no hinting. Stem width differences may be noticeable because hinting is turned off. Global Const $GDIP_TEXTRENDERINGHINT_CLEARTYPEGRIDFIT = 5 ; Specifies that a character is drawn using its glyph ClearType bitmap and hinting. This type of text rendering cannot be used along with CompositingModeSourceCopy. ; PixelOffsetMode constants Global Const $GDIP_PIXELOFFSETMODE_INVALID = -1 ; Used internally. Global Const $GDIP_PIXELOFFSETMODE_DEFAULT = 0 ; Equivalent to $GDIP_PIXELOFFSETMODE_NONE Global Const $GDIP_PIXELOFFSETMODE_HIGHSPEED = 1 ; Equivalent to $GDIP_PIXELOFFSETMODE_NONE Global Const $GDIP_PIXELOFFSETMODE_HIGHQUALITY = 2 ; Equivalent to $GDIP_PIXELOFFSETMODE_HALF Global Const $GDIP_PIXELOFFSETMODE_NONE = 3 ; Indicates that pixel centers have integer coordinates. Global Const $GDIP_PIXELOFFSETMODE_HALF = 4 ; Indicates that pixel centers have coordinates that are half way between integer values. ; LineJoin constants Global Const $GDIP_PENSETLINEJOIN_MITER = 0 ; Specifies a mitered join. This produces a sharp corner or a clipped corner, depending on whether the length of the miter exceeds the miter limit. Global Const $GDIP_PENSETLINEJOIN_BEVEL = 1 ; Specifies a beveled join. This produces a diagonal corner. Global Const $GDIP_PENSETLINEJOIN_ROUND = 2 ; Specifies a circular join. This produces a smooth, circular arc between the lines. Global Const $GDIP_PENSETLINEJOIN_MITERCLIPPED = 3 ; Specifies a mitered join. This produces a sharp corner or a beveled corner, depending on whether the length of the miter exceeds the miter limit. ; Fill mode constants Global Const $GDIP_FillModeAlternate = 0 ;Specifies that areas are filled according to the even-odd parity rule. According to this rule, you can determine ;whether a test point is inside or outside a closed curve as follows: Draw a line from the test point to a point ;that is distant from the curve. If that line crosses the curve an odd number of times, the test point is inside ;the curve; otherwise, the test point is outside the curve. Global Const $GDIP_FillModeWinding = 1 ;Specifies that areas are filled according to the nonzero winding rule. According to this rule, you can determine ;whether a test point is inside or outside a closed curve as follows: Draw a line from a test point to a point that ;is distant from the curve. Count the number of times the curve crosses the test line from left to right, and count ;the number of times the curve crosses the test line from right to left. If those two numbers are the same, the test ;point is outside the curve; otherwise, the test point is inside the curve. ; Quality constants Global Const $GDIP_QUALITYMODEINVALID = -1 Global Const $GDIP_QUALITYMODEDEFAULT = 0 Global Const $GDIP_QUALITYMODELOW = 1 Global Const $GDIP_QUALITYMODEHIGH = 2 ; Alpha Compositing mode constants Global Const $GDIP_COMPOSITINGMODESOURCEOVER = 0 ; Specifies that when a color is rendered, it is blended with the background color. The blend is determined by the alpha component of the color being rendered Global Const $GDIP_COMPOSITINGMODESOURCECOPY = 1 ; Specifies that when a color is rendered, it overwrites the background color. This mode cannot be used along with $TextRenderingHintClearTypeGridFit ; Alpha Compositing quality constants Global Const $GDIP_COMPOSITINGQUALITYINVALID = $GDIP_QUALITYMODEINVALID ; Invalid quality Global Const $GDIP_COMPOSITINGQUALITYDEFAULT = $GDIP_QUALITYMODEDEFAULT ; Gamma correction is not applied Global Const $GDIP_COMPOSITINGQUALITYHIGHSPEED = $GDIP_QUALITYMODELOW ; Gamma correction is not applied. High speed, low quality Global Const $GDIP_COMPOSITINGQUALITYHIGHQUALITY = $GDIP_QUALITYMODEHIGH ; Gamma correction is applied. Composition of high quality and speed. Global Const $GDIP_COMPOSITINGQUALITYGAMMACORRECTED = 3 ; Gamma correction is applied Global Const $GDIP_COMPOSITINGQUALITYASSUMELINEAR = 4 ; Gamma correction is not applied. Linear values are used ; Various hatch styles Global Const $GDIP_HATCHSTYLE_HORIZONTAL = 0 Global Const $GDIP_HATCHSTYLE_VERTICAL = 1 Global Const $GDIP_HATCHSTYLE_FORWARDDIAGONAL = 2 Global Const $GDIP_HATCHSTYLE_BACKWARDDIAGONAL = 3 Global Const $GDIP_HATCHSTYLE_CROSS = 4 Global Const $GDIP_HATCHSTYLE_DIAGONALCROSS = 5 Global Const $GDIP_HATCHSTYLE_05PERCENT = 6 Global Const $GDIP_HATCHSTYLE_10PERCENT = 7 Global Const $GDIP_HATCHSTYLE_20PERCENT = 8 Global Const $GDIP_HATCHSTYLE_25PERCENT = 9 Global Const $GDIP_HATCHSTYLE_30PERCENT = 10 Global Const $GDIP_HATCHSTYLE_40PERCENT = 11 Global Const $GDIP_HATCHSTYLE_50PERCENT = 12 Global Const $GDIP_HATCHSTYLE_60PERCENT = 13 Global Const $GDIP_HATCHSTYLE_70PERCENT = 14 Global Const $GDIP_HATCHSTYLE_75PERCENT = 15 Global Const $GDIP_HATCHSTYLE_80PERCENT = 16 Global Const $GDIP_HATCHSTYLE_90PERCENT = 17 Global Const $GDIP_HATCHSTYLE_LIGHTDOWNWARDDIAGONAL = 18 Global Const $GDIP_HATCHSTYLE_LIGHTUPWARDDIAGONAL = 19 Global Const $GDIP_HATCHSTYLE_DARKDOWNWARDDIAGONAL = 20 Global Const $GDIP_HATCHSTYLE_DARKUPWARDDIAGONAL = 21 Global Const $GDIP_HATCHSTYLE_WIDEDOWNWARDDIAGONAL = 22 Global Const $GDIP_HATCHSTYLE_WIDEUPWARDDIAGONAL = 23 Global Const $GDIP_HATCHSTYLE_LIGHTVERTICAL = 24 Global Const $GDIP_HATCHSTYLE_LIGHTHORIZONTAL = 25 Global Const $GDIP_HATCHSTYLE_NARROWVERTICAL = 26 Global Const $GDIP_HATCHSTYLE_NARROWHORIZONTAL = 27 Global Const $GDIP_HATCHSTYLE_DARKVERTICAL = 28 Global Const $GDIP_HATCHSTYLE_DARKHORIZONTAL = 29 Global Const $GDIP_HATCHSTYLE_DASHEDDOWNWARDDIAGONAL = 30 Global Const $GDIP_HATCHSTYLE_DASHEDUPWARDDIAGONAL = 31 Global Const $GDIP_HATCHSTYLE_DASHEDHORIZONTAL = 32 Global Const $GDIP_HATCHSTYLE_DASHEDVERTICAL = 33 Global Const $GDIP_HATCHSTYLE_SMALLCONFETTI = 34 Global Const $GDIP_HATCHSTYLE_LARGECONFETTI = 35 Global Const $GDIP_HATCHSTYLE_ZIGZAG = 36 Global Const $GDIP_HATCHSTYLE_WAVE = 37 Global Const $GDIP_HATCHSTYLE_DIAGONALBRICK = 38 Global Const $GDIP_HATCHSTYLE_HORIZONTALBRICK = 39 Global Const $GDIP_HATCHSTYLE_WEAVE = 40 Global Const $GDIP_HATCHSTYLE_PLAID = 41 Global Const $GDIP_HATCHSTYLE_DIVOT = 42 Global Const $GDIP_HATCHSTYLE_DOTTEDGRID = 43 Global Const $GDIP_HATCHSTYLE_DOTTEDDIAMOND = 44 Global Const $GDIP_HATCHSTYLE_SHINGLE = 45 Global Const $GDIP_HATCHSTYLE_TRELLIS = 46 Global Const $GDIP_HATCHSTYLE_SPHERE = 47 Global Const $GDIP_HATCHSTYLE_SMALLGRID = 48 Global Const $GDIP_HATCHSTYLE_SMALLCHECKERBOARD = 49 Global Const $GDIP_HATCHSTYLE_LARGECHECKERBOARD = 50 Global Const $GDIP_HATCHSTYLE_OUTLINEDDIAMOND = 51 Global Const $GDIP_HATCHSTYLE_SOLIDDIAMOND = 52 Global Const $GDIP_HATCHSTYLE_TOTAL = 53 Global Const $GDIP_HATCHSTYLE_LARGEGRID = $GDIP_HATCHSTYLE_CROSS Global Const $GDIP_HATCHSTYLE_MIN = $GDIP_HATCHSTYLE_HORIZONTAL Global Const $GDIP_HATCHSTYLE_MAX = $GDIP_HATCHSTYLE_TOTAL - 1 ; GDIPlus V1.1 constants ;GDI+ effect GUIDs Global Const $GDIP_BlurEffectGuid = '{633C80A4-1843-482b-9EF2-BE2834C5FDD4}' Global Const $GDIP_SharpenEffectGuid = '{63CBF3EE-C526-402c-8F71-62C540BF5142}' Global Const $GDIP_ColorMatrixEffectGuid = '{718F2615-7933-40e3-A511-5F68FE14DD74}' Global Const $GDIP_ColorLUTEffectGuid = '{A7CE72A9-0F7F-40d7-B3CC-D0C02D5C3212}' Global Const $GDIP_BrightnessContrastEffectGuid = '{D3A1DBE1-8EC4-4c17-9F4C-EA97AD1C343D}' Global Const $GDIP_HueSaturationLightnessEffectGuid = '{8B2DD6C3-EB07-4d87-A5F0-7108E26A9C5F}' Global Const $GDIP_LevelsEffectGuid = '{99C354EC-2A31-4f3a-8C34-17A803B33A25}' Global Const $GDIP_TintEffectGuid = '{1077AF00-2848-4441-9489-44AD4C2D7A2C}' Global Const $GDIP_ColorBalanceEffectGuid = '{537E597D-251E-48da-9664-29CA496B70F8}' Global Const $GDIP_RedEyeCorrectionEffectGuid = '{74D29D05-69A4-4266-9549-3CC52836B632}' Global Const $GDIP_ColorCurveEffectGuid = '{DD6A0022-58E4-4a67-9D9B-D48EB881A53D}' Global Const $GDIP_AdjustExposure = 0 ;[-255..255] Global Const $GDIP_AdjustDensity = 1 ;[-255..255] Global Const $GDIP_AdjustContrast = 2 ;[-100..100] Global Const $GDIP_AdjustHighlight = 3;[-100..100] Global Const $GDIP_AdjustShadow = 4;[-100..100] Global Const $GDIP_AdjustMidtone = 5;[-100..100] Global Const $GDIP_AdjustWhiteSaturation = 6;[0..255] Global Const $GDIP_AdjustBlackSaturation = 7;[0..255] Global Const $GDIP_CurveChannelAll = 0 Global Const $GDIP_CurveChannelRed = 1 Global Const $GDIP_CurveChannelGreen = 2 Global Const $GDIP_CurveChannelBlue = 3 ;Color format conversion parameters Global Const $GDIP_PaletteTypeCustom = 0 ;Arbitrary custom palette provided by caller. Global Const $GDIP_PaletteTypeOptimal = 1 ;Optimal palette generated using a median-cut algorithm. Global Const $GDIP_PaletteTypeFixedBW = 2 ;Black and white palette. ;Symmetric halftone palettes. Each of these halftone palettes will be a superset of the system palette. E.g. Halftone8 will have it's 8-color on-off primaries and the 16 system colors added. With duplicates removed, that leaves 16 colors. Global Const $GDIP_PaletteTypeFixedHalftone8 = 3 ;8-color, on-off primaries Global Const $GDIP_PaletteTypeFixedHalftone27 = 4 ;3 intensity levels of each color Global Const $GDIP_PaletteTypeFixedHalftone64 = 5 ;4 intensity levels of each color Global Const $GDIP_PaletteTypeFixedHalftone125 = 6 ;5 intensity levels of each color Global Const $GDIP_PaletteTypeFixedHalftone216 = 7 ;6 intensity levels of each color ;Assymetric halftone palettes. These are somewhat less useful than the symmetric ones, but are included for completeness. These do not include all of the system colors. Global Const $GDIP_PaletteTypeFixedHalftone252 = 8 ;6-red, 7-green, 6-blue intensities Global Const $GDIP_PaletteTypeFixedHalftone256 = 9 ;8-red, 8-green, 4-blue intensities ;PaletteFlags enumeration Global Const $GDIP_PaletteFlagsHasAlpha = 0x0001 Global Const $GDIP_PaletteFlagsGrayScale = 0x0002 Global Const $GDIP_PaletteFlagsHalftone = 0x0004 ;DitherType Global Const $GDIP_DitherTypeNone = 0 Global Const $GDIP_DitherTypeSolid = 1 ;Solid color - picks the nearest matching color with no attempt to halftone or dither. May be used on an arbitrary palette. ;Ordered dithers and spiral dithers must be used with a fixed palette. NOTE: DitherOrdered4x4 is unique in that it may apply to 16bpp conversions also. Global Const $GDIP_DitherTypeOrdered4x4 = 2 Global Const $GDIP_DitherTypeOrdered8x8 = 3 Global Const $GDIP_DitherTypeOrdered16x16 = 4 Global Const $GDIP_DitherTypeOrdered91x91 = 5 Global Const $GDIP_DitherTypeSpiral4x4 = 6 Global Const $GDIP_DitherTypeSpiral8x8 = 7 Global Const $GDIP_DitherTypeDualSpiral4x4 = 8 Global Const $GDIP_DitherTypeDualSpiral8x8 = 9 ;Error diffusion. May be used with any palette. Global Const $GDIP_DitherTypeErrorDiffusion = 10 Global Const $GDIP_DitherTypeMax = 10 ;HistogramFormat Global Const $GDIP_HistogramFormatARGB = 0 Global Const $GDIP_HistogramFormatPARGB = 1 Global Const $GDIP_HistogramFormatRGB = 2 Global Const $GDIP_HistogramFormatGray = 3 Global Const $GDIP_HistogramFormatB = 4 Global Const $GDIP_HistogramFormatG = 5 Global Const $GDIP_HistogramFormatR = 6 Global Const $GDIP_HistogramFormatA = 7 ;TextRenderingHint constants Global Const $GDIP_TextRenderingHintSystemDefault = 0 Global Const $GDIP_TextRenderingHintSingleBitPerPixelGridFit = 1 Global Const $GDIP_TextRenderingHintSingleBitPerPixel = 2 Global Const $GDIP_TextRenderingHintAntialiasGridFit = 3 Global Const $GDIP_TextRenderingHintAntialias = 4 Global Const $GDIP_TextRenderingHintClearTypeGridFit = 5 ;RotateFlipType constants Global Const $GDIP_RotateNoneFlipNone = 0 Global Const $GDIP_Rotate90FlipNone = 1 Global Const $GDIP_Rotate180FlipNone = 2 Global Const $GDIP_Rotate270FlipNone = 3 Global Const $GDIP_RotateNoneFlipX = 4 Global Const $GDIP_Rotate90FlipX = 5 Global Const $GDIP_Rotate180FlipX = 6 Global Const $GDIP_Rotate270FlipX = 7 Global Const $GDIP_RotateNoneFlipY = $GDIP_Rotate180FlipX Global Const $GDIP_Rotate90FlipY = $GDIP_Rotate270FlipX Global Const $GDIP_Rotate180FlipY = $GDIP_RotateNoneFlipX Global Const $GDIP_Rotate270FlipY = $GDIP_Rotate90FlipX Global Const $GDIP_RotateNoneFlipXY = $GDIP_Rotate180FlipNone Global Const $GDIP_Rotate90FlipXY = $GDIP_Rotate270FlipNone Global Const $GDIP_Rotate270FlipXY = $GDIP_Rotate90FlipNone ;=============================================================================================================================== ;=============================================================================================================================== ;=============================================================================================================================== ;CODE STARTS HERE ;=============================================================================================================================== ;=============================================================================================================================== ;=============================================================================================================================== _Example() Func _Example() If Not _GDIPlus_Startup() Then MsgBox($MB_SYSTEMMODAL, "ERROR", "GDIPlus.dll v1.1 not available") Return EndIf Local $sFile = FileOpenDialog("Select an image", "", "Images (*.bmp;*.png;*.jpg;*.gif;*.tif)") If @error Or Not FileExists($sFile) Then Return Local $hImage = _GDIPlus_ImageLoadFromFile($sFile) Local $iWidth = 600 Local $iHeight = _GDIPlus_ImageGetHeight($hImage) * 600 / _GDIPlus_ImageGetWidth($hImage) Local $hGui = GUICreate("GDI+ v1.1", $iWidth, $iHeight) Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui) GUISetState(@SW_SHOW) ;Convert to a 16-color bitmap (4 bits per pixel) using diffusion dithering Local $tPalette = _GDIPlus_PaletteInitialize(16, $GDIP_PaletteTypefixedBW, 0, False, $hImage) _GDIPlus_BitmapConvertFormat($hImage, $GDIP_PXF04INDEXED, $GDIP_DitherTypeErrorDiffusion, $GDIP_PaletteTypefixedBW, $tPalette) _GDIPlus_GraphicsDrawImageRect($hGraphics, $hImage, 0, 0, $iWidth, $iHeight) $file = FileOpen(@scriptdir&"\test.jpg", 18) FileWrite($file, _gdiplus_saveimage2binary($hImage)) FileClose($file) ;~ ConsoleWrite(_gdiplus_saveimage2binary($hImage)) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE _GDIPlus_ImageDispose($hImage) _GDIPlus_Shutdown() EndFunc ;==>_Example ;=============================================================================================================================== ;=============================================================================================================================== ;=============================================================================================================================== ;CODE ENDS HERE ;=============================================================================================================================== ;=============================================================================================================================== ;=============================================================================================================================== Func _gdiplus_saveimage2binary($hbitmap, $iquality = 60) Local $simgclsid = _gdiplus_encodersgetclsid("jpg") Local $tguid = _winapi_guidfromstring($simgclsid) Local $pencoder = DllStructGetPtr($tguid) Local $tparams = _gdiplus_paraminit(1) Local $tdata = DllStructCreate("int Quality") DllStructSetData($tdata, "Quality", $iquality) Local $pdata = DllStructGetPtr($tdata) _gdiplus_paramadd($tparams, $gdip_epgquality, 1, $gdip_eptlong, $pdata) Local $pparams = DllStructGetPtr($tparams) Local $hstream = DllCall("ole32.dll", "uint", "CreateStreamOnHGlobal", "ptr", 0, "bool", True, "ptr*", 0) $hstream = $hstream[3] DllCall($ghgdipdll, "uint", "GdipSaveImageToStream", "ptr", $hbitmap, "ptr", $hstream, "ptr", $pencoder, "ptr", $pparams) Local $hmemory = DllCall("ole32.dll", "uint", "GetHGlobalFromStream", "ptr", $hstream, "ptr*", 0) $hmemory = $hmemory[2] Local $imemsize = _memglobalsize($hmemory) Local $pmem = _memgloballock($hmemory) $tdata = DllStructCreate("byte[" & $imemsize & "]", $pmem) Local $bdata = DllStructGetData($tdata, 1) Local $tvariant = DllStructCreate("word vt;word r1;word r2;word r3;ptr data;ptr") DllCall("oleaut32.dll", "long", "DispCallFunc", "ptr", $hstream, "dword", 8 + 8 * @AutoItX64, "dword", 4, "dword", 23, "dword", 0, "ptr", 0, "ptr", 0, "ptr", DllStructGetPtr($tvariant)) _memglobalfree($hmemory) Return $bdata EndFunc Func _gdiplus_createbitmapfromstream($pstream) Local $ret = DllCall($ghgdipdll, "uint", "GdipCreateBitmapFromStream", "ptr", $pstream, "ptr*", 0) If (@error) OR ($ret[0]) Then Return SetError(@error, @extended, 0) EndIf Return $ret[2] EndFunc func _memglobalsize($hmem) Local $aresult = DllCall("kernel32.dll", "ulong_ptr", "GlobalSize", "handle", $hmem) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _memglobalunlock($hmem) Local $aresult = DllCall("kernel32.dll", "bool", "GlobalUnlock", "handle", $hmem) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _meminit($hwnd, $isize, ByRef $tmemmap) Local $aresult = DllCall("User32.dll", "dword", "GetWindowThreadProcessId", "hwnd", $hwnd, "dword*", 0) If @error Then Return SetError(@error + 10, @extended, 0) Local $iprocessid = $aresult[2] If $iprocessid = 0 Then Return SetError(1, 0, 0) Local $iaccess = BitOR($process_vm_operation, $process_vm_read, $process_vm_write) Local $hprocess = __mem_openprocess($iaccess, False, $iprocessid, True) Local $ialloc = BitOR($mem_reserve, $mem_commit) Local $pmemory = _memvirtualallocex($hprocess, 0, $isize, $ialloc, $page_readwrite) If $pmemory = 0 Then Return SetError(2, 0, 0) $tmemmap = DllStructCreate($tagmemmap) DllStructSetData($tmemmap, "hProc", $hprocess) DllStructSetData($tmemmap, "Size", $isize) DllStructSetData($tmemmap, "Mem", $pmemory) Return $pmemory EndFunc Func _memmovememory($psource, $pdest, $ilength) DllCall("kernel32.dll", "none", "RtlMoveMemory", "struct*", $pdest, "struct*", $psource, "ulong_ptr", $ilength) If @error Then Return SetError(@error, @extended) EndFunc Func _memread(ByRef $tmemmap, $psrce, $pdest, $isize) Local $aresult = DllCall("kernel32.dll", "bool", "ReadProcessMemory", "handle", DllStructGetData($tmemmap, "hProc"), "ptr", $psrce, "struct*", $pdest, "ulong_ptr", $isize, "ulong_ptr*", 0) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _memwrite(ByRef $tmemmap, $psrce, $pdest = 0, $isize = 0, $ssrce = "struct*") If $pdest = 0 Then $pdest = DllStructGetData($tmemmap, "Mem") If $isize = 0 Then $isize = DllStructGetData($tmemmap, "Size") Local $aresult = DllCall("kernel32.dll", "bool", "WriteProcessMemory", "handle", DllStructGetData($tmemmap, "hProc"), "ptr", $pdest, $ssrce, $psrce, "ulong_ptr", $isize, "ulong_ptr*", 0) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _memvirtualalloc($paddress, $isize, $iallocation, $iprotect) Local $aresult = DllCall("kernel32.dll", "ptr", "VirtualAlloc", "ptr", $paddress, "ulong_ptr", $isize, "dword", $iallocation, "dword", $iprotect) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _memvirtualallocex($hprocess, $paddress, $isize, $iallocation, $iprotect) Local $aresult = DllCall("kernel32.dll", "ptr", "VirtualAllocEx", "handle", $hprocess, "ptr", $paddress, "ulong_ptr", $isize, "dword", $iallocation, "dword", $iprotect) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _memvirtualfree($paddress, $isize, $ifreetype) Local $aresult = DllCall("kernel32.dll", "bool", "VirtualFree", "ptr", $paddress, "ulong_ptr", $isize, "dword", $ifreetype) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _memvirtualfreeex($hprocess, $paddress, $isize, $ifreetype) Local $aresult = DllCall("kernel32.dll", "bool", "VirtualFreeEx", "handle", $hprocess, "ptr", $paddress, "ulong_ptr", $isize, "dword", $ifreetype) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func __mem_openprocess($iaccess, $finherit, $iprocessid, $fdebugpriv = False) Local $aresult = DllCall("kernel32.dll", "handle", "OpenProcess", "dword", $iaccess, "bool", $finherit, "dword", $iprocessid) If @error Then Return SetError(@error + 10, @extended, 0) If $aresult[0] Then Return $aresult[0] If NOT $fdebugpriv Then Return 0 Local $htoken = _security__openthreadtokenex(BitOR($token_adjust_privileges, $token_query)) If @error Then Return SetError(@error + 20, @extended, 0) _security__setprivilege($htoken, "SeDebugPrivilege", True) Local $ierror = @error Local $ilasterror = @extended Local $iret = 0 If NOT @error Then $aresult = DllCall("kernel32.dll", "handle", "OpenProcess", "dword", $iaccess, "bool", $finherit, "dword", $iprocessid) $ierror = @error $ilasterror = @extended If $aresult[0] Then $iret = $aresult[0] _security__setprivilege($htoken, "SeDebugPrivilege", False) If @error Then $ierror = @error + 30 $ilasterror = @extended EndIf Else $ierror = @error + 40 EndIf DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $htoken) Return SetError($ierror, $ilasterror, $iret) EndFunc Func _memfree(ByRef $tmemmap) Local $pmemory = DllStructGetData($tmemmap, "Mem") Local $hprocess = DllStructGetData($tmemmap, "hProc") Local $bresult = _memvirtualfreeex($hprocess, $pmemory, 0, $mem_release) DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $hprocess) If @error Then Return SetError(@error, @extended, False) Return $bresult EndFunc Func _memglobalalloc($ibytes, $iflags = 0) Local $aresult = DllCall("kernel32.dll", "handle", "GlobalAlloc", "uint", $iflags, "ulong_ptr", $ibytes) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _memglobalfree($hmem) Local $aresult = DllCall("kernel32.dll", "ptr", "GlobalFree", "handle", $hmem) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _memgloballock($hmem) Local $aresult = DllCall("kernel32.dll", "ptr", "GlobalLock", "handle", $hmem) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _gdiplus_imagegetheight($himage) Local $aresult = DllCall($ghgdipdll, "int", "GdipGetImageHeight", "handle", $himage, "uint*", 0) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Return $aresult[2] EndFunc Func _gdiplus_imagegethorizontalresolution($himage) If ($himage = -1) OR (NOT $himage) Then Return SetError(11, 0, 0) Local $aresult = DllCall($ghgdipdll, "int", "GdipGetImageHorizontalResolution", "handle", $himage, "float*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return Round($aresult[2]) EndFunc Func _gdiplus_imagegetpixelformat($himage) Local $aformat[2] = [0, ""] If ($himage = -1) OR (NOT $himage) Then Return SetError(11, 0, $aformat) Local $apixelformat[14][2] = [["1 Bpp Indexed", $gdip_pxf01indexed], ["4 Bpp Indexed", $gdip_pxf04indexed], ["8 Bpp Indexed", $gdip_pxf08indexed], ["16 Bpp Grayscale", $gdip_pxf16grayscale], ["16 Bpp RGB 555", $gdip_pxf16rgb555], ["16 Bpp RGB 565", $gdip_pxf16rgb565], ["16 Bpp ARGB 1555", $gdip_pxf16argb1555], ["24 Bpp RGB", $gdip_pxf24rgb], ["32 Bpp RGB", $gdip_pxf32rgb], ["32 Bpp ARGB", $gdip_pxf32argb], ["32 Bpp PARGB", $gdip_pxf32pargb], ["48 Bpp RGB", $gdip_pxf48rgb], ["64 Bpp ARGB", $gdip_pxf64argb], ["64 Bpp PARGB", $gdip_pxf64pargb]] Local $aresult = DllCall($ghgdipdll, "int", "GdipGetImagePixelFormat", "handle", $himage, "int*", 0) If @error Then Return SetError(@error, @extended, $aformat) If $aresult[0] Then Return SetError(10, $aresult[0], $aformat) For $i = 0 To 13 If $apixelformat[$i][1] = $aresult[2] Then $aformat[0] = $apixelformat[$i][1] $aformat[1] = $apixelformat[$i][0] Return $aformat EndIf Next Return SetError(12, 0, $aformat) EndFunc Func _gdiplus_imagegetrawformat($himage) Local $aguid[2] If ($himage = -1) OR (NOT $himage) Then Return SetError(11, 0, $aguid) Local $aimagetype[11][2] = [["UNDEFINED", $gdip_imageformat_undefined], ["MEMORYBMP", $gdip_imageformat_memorybmp], ["BMP", $gdip_imageformat_bmp], ["EMF", $gdip_imageformat_emf], ["WMF", $gdip_imageformat_wmf], ["JPEG", $gdip_imageformat_jpeg], ["PNG", $gdip_imageformat_png], ["GIF", $gdip_imageformat_gif], ["TIFF", $gdip_imageformat_tiff], ["EXIF", $gdip_imageformat_exif], ["ICON", $gdip_imageformat_icon]] Local $tstruct = DllStructCreate("byte[16]") Local $aresult1 = DllCall($ghgdipdll, "int", "GdipGetImageRawFormat", "handle", $himage, "struct*", $tstruct) If @error Then Return SetError(@error, @extended, $aguid) If $aresult1[0] Then Return SetError(10, $aresult1[0], $aguid) Local $sresult2 = _winapi_stringfromguid($aresult1[2]) If @error Then Return SetError(@error + 20, @extended, $aguid) If $sresult2 = "" Then Return SetError(12, 0, $aguid) For $i = 0 To 10 If $aimagetype[$i][1] == $sresult2 Then $aguid[0] = $aimagetype[$i][1] $aguid[1] = $aimagetype[$i][0] Return $aguid EndIf Next Return SetError(13, 0, $aguid) EndFunc Func _gdiplus_imagegettype($himage) If ($himage = -1) OR (NOT $himage) Then Return SetError(11, 0, -1) Local $aresult = DllCall($ghgdipdll, "int", "GdipGetImageType", "handle", $himage, "int*", 0) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Return $aresult[2] EndFunc Func _gdiplus_imagegetverticalresolution($himage) If ($himage = -1) OR (NOT $himage) Then Return SetError(11, 0, 0) Local $aresult = DllCall($ghgdipdll, "int", "GdipGetImageVerticalResolution", "handle", $himage, "float*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return Round($aresult[2]) EndFunc Func _gdiplus_imagegetwidth($himage) Local $aresult = DllCall($ghgdipdll, "int", "GdipGetImageWidth", "handle", $himage, "uint*", -1) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Return $aresult[2] EndFunc Func _gdiplus_imageloadfromfile($sfilename) Local $aresult = DllCall($ghgdipdll, "int", "GdipLoadImageFromFile", "wstr", $sfilename, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[2] EndFunc Func _gdiplus_imageloadfromstream($pstream) Local $aresult = DllCall($ghgdipdll, "int", "GdipLoadImageFromStream", "ptr", $pstream, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[2] EndFunc Func _gdiplus_imagerotateflip($himage, $irotatefliptype) Local $aresult = DllCall($ghgdipdll, "int", "GdipImageRotateFlip", "handle", $himage, "int", $irotatefliptype) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_imagesavetofile($himage, $sfilename) Local $sext = __gdiplus_extractfileext($sfilename) Local $sclsid = _gdiplus_encodersgetclsid($sext) If $sclsid = "" Then Return SetError(-1, 0, False) Return SetError(_gdiplus_imagesavetofileex($himage, $sfilename, $sclsid, 0), @error, @extended) EndFunc Func _gdiplus_imagesavetofileex($himage, $sfilename, $sencoder, $pparams = 0) Local $tguid = _winapi_guidfromstring($sencoder) Local $aresult = DllCall($ghgdipdll, "int", "GdipSaveImageToFile", "handle", $himage, "wstr", $sfilename, "struct*", $tguid, "struct*", $pparams) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_imagesavetostream($himage, $pstream, $pencoder, $pparams = 0) Local $aresult = DllCall($ghgdipdll, "int", "GdipSaveImageToStream", "handle", $himage, "ptr", $pstream, "ptr", $pencoder, "ptr", $pparams) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_imagescale($himage, $iscalew, $iscaleh, $iinterpolationmode = $gdip_interpolationmode_highqualitybicubic) Local $iwidth = _gdiplus_imagegetwidth($himage) * $iscalew If @error Then Return SetError(1, 0, 0) Local $iheight = _gdiplus_imagegetheight($himage) * $iscaleh If @error Then Return SetError(2, 0, 0) Local $hbitmap = _gdiplus_bitmapcreatefromscan0($iwidth, $iheight) If @error Then Return SetError(3, 0, 0) Local $hbmpctxt = _gdiplus_imagegetgraphicscontext($hbitmap) If @error Then _gdiplus_bitmapdispose($hbitmap) Return SetError(4, 0, 0) EndIf _gdiplus_graphicssetinterpolationmode($hbmpctxt, $iinterpolationmode) If @error Then _gdiplus_graphicsdispose($hbmpctxt) _gdiplus_bitmapdispose($hbitmap) Return SetError(5, 0, 0) EndIf _gdiplus_graphicsdrawimagerect($hbmpctxt, $himage, 0, 0, $iwidth, $iheight) If @error Then _gdiplus_graphicsdispose($hbmpctxt) _gdiplus_bitmapdispose($hbitmap) Return SetError(6, 0, 0) EndIf _gdiplus_graphicsdispose($hbmpctxt) Return $hbitmap EndFunc Func _gdiplus_regiontransform($hregion, $hmatrix) Local $aresult = DllCall($ghgdipdll, "int", "GdipTransformRegion", "handle", $hregion, "handle", $hmatrix) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_regiontranslate($hregion, $ndx, $ndy) Local $aresult = DllCall($ghgdipdll, "int", "GdipTranslateRegion", "handle", $hregion, "float", $ndx, "float", $ndy) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_shutdown() If $ghgdipdll = 0 Then Return SetError(-1, -1, False) $gigdipref -= 1 If $gigdipref = 0 Then DllCall($ghgdipdll, "none", "GdiplusShutdown", "ulong_ptr", $gigdiptoken) DllClose($ghgdipdll) $ghgdipdll = 0 EndIf Return True EndFunc Func _gdiplus_startup($sgdipdll = Default) $gigdipref += 1 If $gigdipref > 1 Then Return True If $sgdipdll = Default Then If @OSBuild > 4999 AND @OSBuild < 7600 Then $sgdipdll = @WindowsDir & "\winsxs\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.6000.16386_none_8df21b8362744ace\gdiplus.dll" Else $sgdipdll = "gdiplus.dll" EndIf EndIf $ghgdipdll = DllOpen($sgdipdll) If $ghgdipdll = -1 Then $gigdipref = 0 Return SetError(1, 2, False) EndIf Local $sver = FileGetVersion($sgdipdll) $sver = StringSplit($sver, ".") If $sver[1] > 5 Then $gbgdip_v1_0 = False Local $tinput = DllStructCreate($taggdipstartupinput) Local $ttoken = DllStructCreate("ulong_ptr Data") DllStructSetData($tinput, "Version", 1) Local $aresult = DllCall($ghgdipdll, "int", "GdiplusStartup", "struct*", $ttoken, "struct*", $tinput, "ptr", 0) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) $gigdiptoken = DllStructGetData($ttoken, "Data") Return True EndFunc Func _gdiplus_stringformatcreate($iformat = 0, $ilangid = 0) Local $aresult = DllCall($ghgdipdll, "int", "GdipCreateStringFormat", "int", $iformat, "word", $ilangid, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[3] EndFunc Func _gdiplus_stringformatdispose($hformat) Local $aresult = DllCall($ghgdipdll, "int", "GdipDeleteStringFormat", "handle", $hformat) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_stringformatgetmeasurablecharacterrangecount($hstringformat) Local $aresult = DllCall($ghgdipdll, "int", "GdipGetStringFormatMeasurableCharacterRangeCount", "handle", $hstringformat, "int*", 0) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Return $aresult[2] EndFunc Func _gdiplus_stringformatsetalign($hstringformat, $iflag) Local $aresult = DllCall($ghgdipdll, "int", "GdipSetStringFormatAlign", "handle", $hstringformat, "int", $iflag) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_stringformatsetlinealign($hstringformat, $istringalign) Local $aresult = DllCall($ghgdipdll, "int", "GdipSetStringFormatLineAlign", "handle", $hstringformat, "int", $istringalign) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_stringformatsetmeasurablecharacterranges($hstringformat, $aranges) Local $icount = $aranges[0][0] Local $tcharacterranges = DllStructCreate("int[" & $icount * 2 & "]") For $ii = 1 To $icount DllStructSetData($tcharacterranges, 1, $aranges[$ii][0], (($ii - 1) * 2) + 1) DllStructSetData($tcharacterranges, 1, $aranges[$ii][1], (($ii - 1) * 2) + 2) Next Local $aresult = DllCall($ghgdipdll, "int", "GdipSetStringFormatMeasurableCharacterRanges", "handle", $hstringformat, "int", $icount, "struct*", $tcharacterranges) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_texturecreate($himage, $iwrapmode = 0) Local $aresult = DllCall($ghgdipdll, "int", "GdipCreateTexture", "handle", $himage, "int", $iwrapmode, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[3] EndFunc Func _gdiplus_texturecreate2($himage, $nx, $ny, $nwidth, $nheight, $iwrapmode = 0) Local $aresult = DllCall($ghgdipdll, "int", "GdipCreateTexture2", "handle", $himage, "int", $iwrapmode, "float", $nx, "float", $ny, "float", $nwidth, "float", $nheight, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[7] EndFunc Func _gdiplus_texturecreateia($himage, $nx, $ny, $nwidth, $nheight, $pimageattributes = 0) Local $aresult = DllCall($ghgdipdll, "int", "GdipCreateTextureIA", "handle", $himage, "handle", $pimageattributes, "float", $nx, "float", $ny, "float", $nwidth, "float", $nheight, "ptr*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[7] EndFunc Func __gdiplus_brushdefcreate(ByRef $hbrush) If $hbrush = 0 Then $ghgdipbrush = _gdiplus_brushcreatesolid() $hbrush = $ghgdipbrush EndIf EndFunc Func __gdiplus_brushdefdispose($icurerror = @error, $icurextended = @extended) If $ghgdipbrush <> 0 Then _gdiplus_brushdispose($ghgdipbrush) $ghgdipbrush = 0 EndIf Return SetError($icurerror, $icurextended) EndFunc Func __gdiplus_extractfileext($sfilename, $fnodot = True) Local $iindex = __gdiplus_lastdelimiter(".\:", $sfilename) If ($iindex > 0) AND (StringMid($sfilename, $iindex, 1) = ".") Then If $fnodot Then Return StringMid($sfilename, $iindex + 1) Else Return StringMid($sfilename, $iindex) EndIf Else Return "" EndIf EndFunc Func __gdiplus_lastdelimiter($sdelimiters, $sstring) Local $sdelimiter, $in For $ii = 1 To StringLen($sdelimiters) $sdelimiter = StringMid($sdelimiters, $ii, 1) $in = StringInStr($sstring, $sdelimiter, 0, -1) If $in > 0 Then Return $in Next EndFunc Func __gdiplus_pendefcreate(ByRef $hpen) If $hpen = 0 Then $ghgdippen = _gdiplus_pencreate() $hpen = $ghgdippen EndIf EndFunc Func __gdiplus_pendefdispose($icurerror = @error, $icurextended = @extended) If $ghgdippen <> 0 Then _gdiplus_pendispose($ghgdippen) $ghgdippen = 0 EndIf Return SetError($icurerror, $icurextended) EndFunc Func __gdiplus_bitmapcreatedibfrombitmap($hbitmap) Local $tbihdr, $aret, $tdata, $pbits, $hhbitmapv5 = 0 $aret = DllCall($ghgdipdll, "uint", "GdipGetImageDimension", "handle", $hbitmap, "float*", 0, "float*", 0) If @error OR $aret[0] Then Return 0 $tdata = _gdiplus_bitmaplockbits($hbitmap, 0, 0, $aret[2], $aret[3], $gdip_ilmread, $gdip_pxf32argb) $pbits = DllStructGetData($tdata, "Scan0") If NOT $pbits Then Return 0 $tbihdr = DllStructCreate($tagbitmapv5header) DllStructSetData($tbihdr, "bV5Size", DllStructGetSize($tbihdr)) DllStructSetData($tbihdr, "bV5Width", $aret[2]) DllStructSetData($tbihdr, "bV5Height", $aret[3]) DllStructSetData($tbihdr, "bV5Planes", 1) DllStructSetData($tbihdr, "bV5BitCount", 32) DllStructSetData($tbihdr, "bV5Compression", 0) DllStructSetData($tbihdr, "bV5SizeImage", $aret[3] * DllStructGetData($tdata, "Stride")) DllStructSetData($tbihdr, "bV5AlphaMask", -16777216) DllStructSetData($tbihdr, "bV5RedMask", 16711680) DllStructSetData($tbihdr, "bV5GreenMask", 65280) DllStructSetData($tbihdr, "bV5BlueMask", 255) DllStructSetData($tbihdr, "bV5CSType", 2) DllStructSetData($tbihdr, "bV5Intent", 4) $hhbitmapv5 = DllCall("gdi32.dll", "ptr", "CreateDIBSection", "hwnd", 0, "struct*", $tbihdr, "uint", 0, "ptr*", 0, "ptr", 0, "dword", 0) If NOT @error AND $hhbitmapv5[0] Then DllCall("gdi32.dll", "dword", "SetBitmapBits", "ptr", $hhbitmapv5[0], "dword", $aret[2] * $aret[3] * 4, "ptr", DllStructGetData($tdata, "Scan0")) $hhbitmapv5 = $hhbitmapv5[0] Else $hhbitmapv5 = 0 EndIf _gdiplus_bitmapunlockbits($hbitmap, $tdata) $tdata = 0 $tbihdr = 0 Return $hhbitmapv5 EndFunc Func _gdiplus_bitmapapplyeffect($hbitmap, $heffect, $trect = NULL ) If $gbgdip_v1_0 Then Return SetError(-1, 0, False) Local $aresult = DllCall($ghgdipdll, "int", "GdipBitmapApplyEffect", "handle", $hbitmap, "handle", $heffect, "struct*", $trect, "int", 0, "ptr*", 0, "int*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_bitmapapplyeffectex($hbitmap, $heffect, $ix = 0, $iy = 0, $iw = 0, $ih = 0) If $gbgdip_v1_0 Then Return SetError(-1, 0, False) Local $trect = 0 If BitOR($ix, $iy, $iw, $ih) Then $trect = DllStructCreate("int Left; int Top; int Right; int Bottom;") DllStructSetData($trect, "Right", $iw + DllStructSetData($trect, "Left", $ix)) DllStructSetData($trect, "Bottom", $ih + DllStructSetData($trect, "Top", $iy)) EndIf Local $istatus = _gdiplus_bitmapapplyeffect($hbitmap, $heffect, $trect) If NOT $istatus Then Return SetError(@error, @extended, False) Return True EndFunc Func _gdiplus_bitmapconvertformat($hbitmap, $ipixelformat, $idithertype, $ipalettetype, $tpalette, $falphathresholdpercent = 0) If $gbgdip_v1_0 Then Return SetError(-1, 0, False) Local $aresult = DllCall($ghgdipdll, "int", "GdipBitmapConvertFormat", "handle", $hbitmap, "uint", $ipixelformat, "uint", $idithertype, "uint", $ipalettetype, "struct*", $tpalette, "float", $falphathresholdpercent) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_bitmapcreateapplyeffect($hbitmap, $heffect, $trect = NULL , $toutrect = NULL ) If $gbgdip_v1_0 Then Return SetError(-1, 0, 0) Local $aresult = DllCall($ghgdipdll, "int", "GdipBitmapCreateApplyEffect", "handle*", $hbitmap, "int", 1, "handle", $heffect, "struct*", $trect, "struct*", $toutrect, "handle*", 0, "int", 0, "ptr*", 0, "int*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[6] EndFunc Func _gdiplus_bitmapcreateapplyeffectex($hbitmap, $heffect, $ix = 0, $iy = 0, $iw = 0, $ih = 0) If $gbgdip_v1_0 Then Return SetError(-1, 0, 0) Local $trect = 0 If BitOR($ix, $iy, $iw, $ih) Then $trect = DllStructCreate("int Left; int Top; int Right; int Bottom;") DllStructSetData($trect, "Right", $iw + DllStructSetData($trect, "Left", $ix)) DllStructSetData($trect, "Bottom", $ih + DllStructSetData($trect, "Top", $iy)) EndIf Local $hbitmap_fx = _gdiplus_bitmapcreateapplyeffect($hbitmap, $heffect, $trect, NULL ) Return SetError(@error, @extended, $hbitmap_fx) EndFunc Func _gdiplus_bitmapgethistogram($hbitmap, $ihistogramformat, $ihistogramsize, $tchannel_0, $tchannel_1 = 0, $tchannel_2 = 0, $tchannel_3 = 0) If $gbgdip_v1_0 Then Return SetError(-1, 0, False) Local $aresult = DllCall($ghgdipdll, "int", "GdipBitmapGetHistogram", "handle", $hbitmap, "uint", $ihistogramformat, "uint", $ihistogramsize, "struct*", $tchannel_0, "struct*", $tchannel_1, "struct*", $tchannel_2, "struct*", $tchannel_3) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_bitmapgethistogramex($hbitmap) If $gbgdip_v1_0 Then Return SetError(-1, 0, 0) Local $isize = _gdiplus_bitmapgethistogramsize($gdip_histogramformatargb) Local $thistogram = DllStructCreate("int Size; uint Red[" & $isize & "]; uint MaxRed; uint Green[" & $isize & "]; uint MaxGreen; uint Blue[" & $isize & "]; uint MaxBlue; uint Alpha[" & $isize & "]; uint MaxAlpha; uint Grey[" & $isize & "]; uint MaxGrey;") DllStructSetData($thistogram, "Size", $isize) Local $istatus = _gdiplus_bitmapgethistogram($hbitmap, $gdip_histogramformatargb, $isize, DllStructGetPtr($thistogram, "Alpha"), DllStructGetPtr($thistogram, "Red"), DllStructGetPtr($thistogram, "Green"), DllStructGetPtr($thistogram, "Blue")) If NOT $istatus Then Return SetError(@error, @extended, 0) $istatus = _gdiplus_bitmapgethistogram($hbitmap, $gdip_histogramformatgray, $isize, DllStructGetPtr($thistogram, "Grey")) If NOT $istatus Then Return SetError(@error + 10, @extended, 0) Local $imaxred = 0, $imaxgreen = 0, $imaxblue = 0, $imaxalpha = 0, $imaxgrey = 0 For $i = 1 To $isize If DllStructGetData($thistogram, "Red", $i) > $imaxred Then $imaxred = DllStructGetData($thistogram, "Red", $i) If DllStructGetData($thistogram, "Green", $i) > $imaxgreen Then $imaxgreen = DllStructGetData($thistogram, "Green", $i) If DllStructGetData($thistogram, "Blue", $i) > $imaxblue Then $imaxblue = DllStructGetData($thistogram, "Blue", $i) If DllStructGetData($thistogram, "Alpha", $i) > $imaxalpha Then $imaxalpha = DllStructGetData($thistogram, "Alpha", $i) If DllStructGetData($thistogram, "Grey", $i) > $imaxgrey Then $imaxgrey = DllStructGetData($thistogram, "Grey", $i) Next DllStructSetData($thistogram, "MaxRed", $imaxred) DllStructSetData($thistogram, "MaxGreen", $imaxgreen) DllStructSetData($thistogram, "MaxBlue", $imaxblue) DllStructSetData($thistogram, "MaxAlpha", $imaxalpha) DllStructSetData($thistogram, "MaxGrey", $imaxgrey) Return $thistogram EndFunc Func _gdiplus_bitmapgethistogramsize($iformat) If $gbgdip_v1_0 Then Return SetError(-1, 0, 0) Local $aresult = DllCall($ghgdipdll, "int", "GdipBitmapGetHistogramSize", "uint", $iformat, "uint*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[2] EndFunc Func _gdiplus_drawimagefx($hgraphics, $himage, $heffect, $trectf = 0, $hmatrix = 0, $himgattributes = 0, $iunit = 2) If $gbgdip_v1_0 Then Return SetError(-1, 0, False) Local $aresult = DllCall($ghgdipdll, "int", "GdipDrawImageFX", "handle", $hgraphics, "handle", $himage, "struct*", $trectf, "handle", $hmatrix, "handle", $heffect, "handle", $himgattributes, "uint", $iunit) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_drawimagefxex($hgraphics, $himage, $heffect, $fx = 0, $fy = 0, $fw = 0, $fh = 0, $hmatrix = 0, $himgattributes = 0, $iunit = 2) If $gbgdip_v1_0 Then Return SetError(-1, 0, False) Local $trectf = 0 If BitOR($fx, $fy, $fw, $fh) Then $trectf = _gdiplus_rectfcreate($fx, $fy, $fw, $fh) Local $istatus = _gdiplus_drawimagefx($hgraphics, $himage, $heffect, $trectf, $hmatrix, $himgattributes, $iunit) Return SetError(@error, @extended, $istatus) EndFunc Func _gdiplus_effectcreate($seffectguid) If $gbgdip_v1_0 Then Return SetError(-1, 0, 0) Local $tguid = _winapi_guidfromstring($seffectguid) Local $telem = DllStructCreate("uint64[2];", DllStructGetPtr($tguid)) Local $aresult = DllCall($ghgdipdll, "int", "GdipCreateEffect", "uint64", DllStructGetData($telem, 1, 1), "uint64", DllStructGetData($telem, 1, 2), "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[3] EndFunc Func _gdiplus_effectcreateblur($fradius = 10, $bexpandedge = False) If $gbgdip_v1_0 Then Return SetError(-1, 0, 0) Local $teffectparameters = DllStructCreate($taggdip_effectparams_blur) DllStructSetData($teffectparameters, "Radius", $fradius) DllStructSetData($teffectparameters, "ExpandEdge", $bexpandedge) Local $heffect = _gdiplus_effectcreate($gdip_blureffectguid) If @error Then Return SetError(@error, @extended, 0) _gdiplus_effectsetparameters($heffect, $teffectparameters) If @error Then Return SetError(@error + 10, @extended, 0) Return $heffect EndFunc Func _gdiplus_effectcreatebrightnesscontrast($ibrightnesslevel = 0, $icontrastlevel = 0) If $gbgdip_v1_0 Then Return SetError(-1, 0, 0) Local $teffectparameters = DllStructCreate($taggdip_effectparams_brightnesscontrast) DllStructSetData($teffectparameters, "BrightnessLevel", $ibrightnesslevel) DllStructSetData($teffectparameters, "ContrastLevel", $icontrastlevel) Local $heffect = _gdiplus_effectcreate($gdip_brightnesscontrasteffectguid) If @error Then Return SetError(@error, @extended, 0) _gdiplus_effectsetparameters($heffect, $teffectparameters) If @error Then Return SetError(@error + 10, @extended, 0) Return $heffect EndFunc Func _gdiplus_effectcreatecolorbalance($icyanred = 0, $imagentagreen = 0, $iyellowblue = 0) If $gbgdip_v1_0 Then Return SetError(-1, 0, 0) Local $teffectparameters = DllStructCreate($taggdip_effectparams_colorbalance) DllStructSetData($teffectparameters, "CyanRed", $icyanred) DllStructSetData($teffectparameters, "MagentaGreen", $imagentagreen) DllStructSetData($teffectparameters, "YellowBlue", $iyellowblue) Local $heffect = _gdiplus_effectcreate($gdip_colorbalanceeffectguid) If @error Then Return SetError(@error, @extended, 0) _gdiplus_effectsetparameters($heffect, $teffectparameters) If @error Then Return SetError(@error + 10, @extended, 0) Return $heffect EndFunc Func _gdiplus_effectcreatecolorcurve($iadjustment, $ichannel, $iadjustvalue) If $gbgdip_v1_0 Then Return SetError(-1, 0, 0) Local $teffectparameters = DllStructCreate($taggdip_effectparams_colorcurve) DllStructSetData($teffectparameters, "Adjustment", $iadjustment) DllStructSetData($teffectparameters, "Channel", $ichannel) DllStructSetData($teffectparameters, "AdjustValue", $iadjustvalue) Local $heffect = _gdiplus_effectcreate($gdip_colorcurveeffectguid) If @error Then Return SetError(@error, @extended, 0) _gdiplus_effectsetparameters($heffect, $teffectparameters) If @error Then Return SetError(@error + 10, @extended, 0) Return $heffect EndFunc Func _gdiplus_effectcreatecolorlut($acolorlut) If $gbgdip_v1_0 Then Return SetError(-1, 0, 0) Local $teffectparameters = DllStructCreate($taggdip_effectparams_colorlut) For $ii = 0 To 255 DllStructSetData($teffectparameters, "LutA", $acolorlut[$ii][0], $ii + 1) DllStructSetData($teffectparameters, "LutR", $acolorlut[$ii][1], $ii + 1) DllStructSetData($teffectparameters, "LutG", $acolorlut[$ii][2], $ii + 1) DllStructSetData($teffectparameters, "LutB", $acolorlut[$ii][3], $ii + 1) Next Local $heffect = _gdiplus_effectcreate($gdip_colorluteffectguid) If @error Then Return SetError(@error, @extended, 0) _gdiplus_effectsetparameters($heffect, $teffectparameters) If @error Then Return SetError(@error + 10, @extended, 0) Return $heffect EndFunc Func _gdiplus_effectcreatecolormatrix($tcolormatrix) If $gbgdip_v1_0 Then Return SetError(-1, 0, 0) Local $heffect = _gdiplus_effectcreate($gdip_colormatrixeffectguid) If @error Then Return SetError(@error, @extended, 0) _gdiplus_effectsetparameters($heffect, $tcolormatrix) If @error Then Return SetError(@error + 10, @extended, 0) Return $heffect EndFunc Func _gdiplus_encoders() Local $icount = _gdiplus_encodersgetcount() Local $isize = _gdiplus_encodersgetsize() Local $tbuffer = DllStructCreate("byte[" & $isize & "]") Local $aresult = DllCall($ghgdipdll, "int", "GdipGetImageEncoders", "uint", $icount, "uint", $isize, "struct*", $tbuffer) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Local $pbuffer = DllStructGetPtr($tbuffer) Local $tcodec, $ainfo[$icount + 1][14] $ainfo[0][0] = $icount For $ii = 1 To $icount $tcodec = DllStructCreate($taggdipimagecodecinfo, $pbuffer) $ainfo[$ii][1] = _winapi_stringfromguid(DllStructGetPtr($tcodec, "CLSID")) $ainfo[$ii][2] = _winapi_stringfromguid(DllStructGetPtr($tcodec, "FormatID")) $ainfo[$ii][3] = _winapi_widechartomultibyte(DllStructGetData($tcodec, "CodecName")) $ainfo[$ii][4] = _winapi_widechartomultibyte(DllStructGetData($tcodec, "DllName")) $ainfo[$ii][5] = _winapi_widechartomultibyte(DllStructGetData($tcodec, "FormatDesc")) $ainfo[$ii][6] = _winapi_widechartomultibyte(DllStructGetData($tcodec, "FileExt")) $ainfo[$ii][7] = _winapi_widechartomultibyte(DllStructGetData($tcodec, "MimeType")) $ainfo[$ii][8] = DllStructGetData($tcodec, "Flags") $ainfo[$ii][9] = DllStructGetData($tcodec, "Version") $ainfo[$ii][10] = DllStructGetData($tcodec, "SigCount") $ainfo[$ii][11] = DllStructGetData($tcodec, "SigSize") $ainfo[$ii][12] = DllStructGetData($tcodec, "SigPattern") $ainfo[$ii][13] = DllStructGetData($tcodec, "SigMask") $pbuffer += DllStructGetSize($tcodec) Next Return $ainfo EndFunc Func _gdiplus_encodersgetclsid($sfileext) Local $aencoders = _gdiplus_encoders() If @error Then Return SetError(@error, 0, "") For $ii = 1 To $aencoders[0][0] If StringInStr($aencoders[$ii][6], "*." & $sfileext) > 0 Then Return $aencoders[$ii][1] Next Return SetError(-1, -1, "") EndFunc Func _gdiplus_encodersgetcount() Local $aresult = DllCall($ghgdipdll, "int", "GdipGetImageEncodersSize", "uint*", 0, "uint*", 0) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Return $aresult[1] EndFunc Func _gdiplus_encodersgetparamlist($himage, $sencoder) Local $isize = _gdiplus_encodersgetparamlistsize($himage, $sencoder) If @error Then Return SetError(@error + 10, @extended, 0) Local $tguid = _winapi_guidfromstring($sencoder) Local $tbuffer = DllStructCreate("dword Count;byte Params[" & $isize - 4 & "]") Local $aresult = DllCall($ghgdipdll, "int", "GdipGetEncoderParameterList", "handle", $himage, "struct*", $tguid, "uint", $isize, "struct*", $tbuffer) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return DllStructCreate($taggdippencoderparams, $tbuffer) EndFunc Func _gdiplus_encodersgetparamlistsize($himage, $sencoder) Local $tguid = _winapi_guidfromstring($sencoder) Local $aresult = DllCall($ghgdipdll, "int", "GdipGetEncoderParameterListSize", "handle", $himage, "struct*", $tguid, "uint*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[3] EndFunc Func _gdiplus_encodersgetsize() Local $aresult = DllCall($ghgdipdll, "int", "GdipGetImageEncodersSize", "uint*", 0, "uint*", 0) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Return $aresult[2] EndFunc Func _gdiplus_fontcreate($hfamily, $fsize, $istyle = 0, $iunit = 3) Local $aresult = DllCall($ghgdipdll, "int", "GdipCreateFont", "handle", $hfamily, "float", $fsize, "int", $istyle, "int", $iunit, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[5] EndFunc Func _winapi_stringfromguid($pguid) Local $aresult = DllCall("ole32.dll", "int", "StringFromGUID2", "struct*", $pguid, "wstr", "", "int", 40) If @error OR NOT $aresult[0] Then Return SetError(@error, @extended, "") Return SetExtended($aresult[0], $aresult[2]) EndFunc Func _winapi_widechartomultibyte($punicode, $icodepage = 0, $bretstring = True) Local $sunicodetype = "wstr" If NOT IsString($punicode) Then $sunicodetype = "struct*" Local $aresult = DllCall("kernel32.dll", "int", "WideCharToMultiByte", "uint", $icodepage, "dword", 0, $sunicodetype, $punicode, "int", -1, "ptr", 0, "int", 0, "ptr", 0, "ptr", 0) If @error OR NOT $aresult[0] Then Return SetError(@error + 20, @extended, "") Local $tmultibyte = DllStructCreate("char[" & $aresult[0] & "]") $aresult = DllCall("kernel32.dll", "int", "WideCharToMultiByte", "uint", $icodepage, "dword", 0, $sunicodetype, $punicode, "int", -1, "struct*", $tmultibyte, "int", $aresult[0], "ptr", 0, "ptr", 0) If @error OR NOT $aresult[0] Then Return SetError(@error + 10, @extended, "") If $bretstring Then Return DllStructGetData($tmultibyte, 1) Return $tmultibyte EndFunc Func _winapi_windowfrompoint(ByRef $tpoint) Local $aresult = DllCall("user32.dll", "hwnd", "WindowFromPoint", "struct", $tpoint) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_writeconsole($hconsole, $stext) Local $aresult = DllCall("kernel32.dll", "bool", "WriteConsoleW", "handle", $hconsole, "wstr", $stext, "dword", StringLen($stext), "dword*", 0, "ptr", 0) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_writefile($hfile, $pbuffer, $itowrite, ByRef $iwritten, $poverlapped = 0) Local $aresult = DllCall("kernel32.dll", "bool", "WriteFile", "handle", $hfile, "ptr", $pbuffer, "dword", $itowrite, "dword*", 0, "ptr", $poverlapped) If @error Then Return SetError(@error, @extended, False) $iwritten = $aresult[4] Return $aresult[0] EndFunc Func _winapi_getwindowwidth($hwnd) Local $trect = _winapi_getwindowrect($hwnd) If @error Then Return SetError(@error, @extended, 0) Return DllStructGetData($trect, "Right") - DllStructGetData($trect, "Left") EndFunc Func _winapi_getxyfrompoint(ByRef $tpoint, ByRef $ix, ByRef $iy) $ix = DllStructGetData($tpoint, "X") $iy = DllStructGetData($tpoint, "Y") EndFunc Func _winapi_globalmemorystatus() Local $tmem = DllStructCreate($tagmemorystatusex) DllStructSetData($tmem, 1, DllStructGetSize($tmem)) Local $aret = DllCall("kernel32.dll", "bool", "GlobalMemoryStatusEx", "struct*", $tmem) If @error OR NOT $aret[0] Then Return SetError(@error + 10, @extended, 0) Local $amem[7] $amem[0] = DllStructGetData($tmem, 2) $amem[1] = DllStructGetData($tmem, 3) $amem[2] = DllStructGetData($tmem, 4) $amem[3] = DllStructGetData($tmem, 5) $amem[4] = DllStructGetData($tmem, 6) $amem[5] = DllStructGetData($tmem, 7) $amem[6] = DllStructGetData($tmem, 8) Return $amem EndFunc Func _winapi_guidfromstring($sguid) Local $tguid = DllStructCreate($tagguid) _winapi_guidfromstringex($sguid, $tguid) If @error Then Return SetError(@error + 10, @extended, 0) Return $tguid EndFunc Func _winapi_guidfromstringex($sguid, $pguid) Local $aresult = DllCall("ole32.dll", "long", "CLSIDFromString", "wstr", $sguid, "struct*", $pguid) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _winapi_hiword($ilong) Return BitShift($ilong, 16) EndFunc Func _winapi_inprocess($hwnd, ByRef $hlastwnd) If $hwnd = $hlastwnd Then Return True For $ii = $__gainprocess_winapi[0][0] To 1 Step -1 If $hwnd = $__gainprocess_winapi[$ii][0] Then If $__gainprocess_winapi[$ii][1] Then $hlastwnd = $hwnd Return True Else Return False EndIf EndIf Next Local $iprocessid _winapi_getwindowthreadprocessid($hwnd, $iprocessid) Local $icount = $__gainprocess_winapi[0][0] + 1 If $icount >= 64 Then $icount = 1 $__gainprocess_winapi[0][0] = $icount $__gainprocess_winapi[$icount][0] = $hwnd $__gainprocess_winapi[$icount][1] = ($iprocessid = @AutoItPID) Return $__gainprocess_winapi[$icount][1] EndFunc Func _winapi_inttofloat($iint) Local $tint = DllStructCreate("int") Local $tfloat = DllStructCreate("float", DllStructGetPtr($tint)) DllStructSetData($tint, 1, $iint) Return DllStructGetData($tfloat, 1) EndFunc Func _winapi_isclassname($hwnd, $sclassname) Local $sseparator = Opt("GUIDataSeparatorChar") Local $aclassname = StringSplit($sclassname, $sseparator) If NOT IsHWnd($hwnd) Then $hwnd = GUICtrlGetHandle($hwnd) Local $sclasscheck = _winapi_getclassname($hwnd) For $x = 1 To UBound($aclassname) - 1 If StringUpper(StringMid($sclasscheck, 1, StringLen($aclassname[$x]))) = StringUpper($aclassname[$x]) Then Return True Next Return False EndFunc Func _winapi_iswindow($hwnd) Local $aresult = DllCall("user32.dll", "bool", "IsWindow", "hwnd", $hwnd) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_iswindowvisible($hwnd) Local $aresult = DllCall("user32.dll", "bool", "IsWindowVisible", "hwnd", $hwnd) If @error Then Return SetError(@error, @extended, 0) Return $aresult[0] EndFunc Func _winapi_invalidaterect($hwnd, $trect = 0, $ferase = True) Local $aresult = DllCall("user32.dll", "bool", "InvalidateRect", "hwnd", $hwnd, "struct*", $trect, "bool", $ferase) If @error Then Return SetError(@error, @extended, False) Return $aresult[0] EndFunc Func _gdiplus_matrixtranslate($hmatrix, $foffsetx, $foffsety, $bappend = False) Local $aresult = DllCall($ghgdipdll, "int", "GdipTranslateMatrix", "handle", $hmatrix, "float", $foffsetx, "float", $foffsety, "int", $bappend) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_paramadd(ByRef $tparams, $sguid, $inbofvalues, $itype, $pvalues) Local $icount = DllStructGetData($tparams, "Count") Local $pguid = DllStructGetPtr($tparams, "GUID") + ($icount * _gdiplus_paramsize()) Local $tparam = DllStructCreate($taggdipencoderparam, $pguid) _winapi_guidfromstringex($sguid, $pguid) DllStructSetData($tparam, "Type", $itype) DllStructSetData($tparam, "NumberOfValues", $inbofvalues) DllStructSetData($tparam, "Values", $pvalues) DllStructSetData($tparams, "Count", $icount + 1) EndFunc Func _gdiplus_paraminit($icount) Local $sstruct = $taggdipencoderparams For $i = 2 To $icount $sstruct &= ";struct;byte[16];ulong;ulong;ptr;endstruct" Next Return DllStructCreate($sstruct) EndFunc Func _gdiplus_paramsize() Local $tparam = DllStructCreate($taggdipencoderparam) Return DllStructGetSize($tparam) EndFunc Func _gdiplus_pathaddarc($hpath, $nx, $ny, $nwidth, $nheight, $fstartangle, $fsweepangle) Local $aresult = DllCall($ghgdipdll, "int", "GdipAddPathArc", "handle", $hpath, "float", $nx, "float", $ny, "float", $nwidth, "float", $nheight, "float", $fstartangle, "float", $fsweepangle) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathaddbezier($hpath, $nx1, $ny1, $nx2, $ny2, $nx3, $ny3, $nx4, $ny4) Local $aresult = DllCall($ghgdipdll, "int", "GdipAddPathBezier", "handle", $hpath, "float", $nx1, "float", $ny1, "float", $nx2, "float", $ny2, "float", $nx3, "float", $ny3, "float", $nx4, "float", $ny4) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathaddclosedcurve($hpath, $apoints) Local $icount = $apoints[0][0] Local $tpoints = DllStructCreate("float[" & $icount * 2 & "]") For $ii = 1 To $icount DllStructSetData($tpoints, 1, $apoints[$ii][0], (($ii - 1) * 2) + 1) DllStructSetData($tpoints, 1, $apoints[$ii][1], (($ii - 1) * 2) + 2) Next Local $aresult = DllCall($ghgdipdll, "int", "GdipAddPathClosedCurve", "handle", $hpath, "struct*", $tpoints, "int", $icount) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_pathaddclosedcurve2($hpath, $apoints, $ftension = 0.5) Local $icount = $apoints[0][0] Local $tpoints = DllStructCreate("float[" & $icount * 2 & "]") For $ii = 1 To $icount DllStructSetData($tpoints, 1, $apoints[$ii][0], (($ii - 1) * 2) + 1) DllStructSetData($tpoints, 1, $apoints[$ii][1], (($ii - 1) * 2) + 2) Next Local $aresult = DllCall($ghgdipdll, "int", "GdipAddPathClosedCurve2", "handle", $hpath, "struct*", $tpoints, "int", $icount, "float", $ftension) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_effectdispose($heffect) If $gbgdip_v1_0 Then Return SetError(-1, 0, False) Local $aresult = DllCall($ghgdipdll, "int", "GdipDeleteEffect", "handle", $heffect) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_effectgetparameters($heffect, $teffectparameters) If $gbgdip_v1_0 Then Return SetError(-1, 0, False) If DllStructGetSize($teffectparameters) < __gdiplus_effectgetparametersize($heffect) Then Return SetError(2, 5, False) Local $aresult = DllCall($ghgdipdll, "int", "GdipGetEffectParameters", "handle", $heffect, "uint*", DllStructGetSize($teffectparameters), "struct*", $teffectparameters) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func __gdiplus_effectgetparametersize($heffect) If $gbgdip_v1_0 Then Return SetError(-1, 0, -1) Local $aresult = DllCall($ghgdipdll, "int", "GdipGetEffectParameterSize", "handle", $heffect, "uint*", 0) If @error Then Return SetError(@error, @extended, -1) If $aresult[0] Then Return SetError(10, $aresult[0], -1) Return $aresult[2] EndFunc Func _gdiplus_effectsetparameters($heffect, $teffectparameters, $isizeadjust = 1) If $gbgdip_v1_0 Then Return SetError(-1, 0, False) Local $isize = __gdiplus_effectgetparametersize($heffect) If @error Then Return SetError(@error, @extended, False) Local $aresult = DllCall($ghgdipdll, "int", "GdipSetEffectParameters", "handle", $heffect, "struct*", $teffectparameters, "uint", $isize * $isizeadjust) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_paletteinitialize($ientries, $ipalettetype = $gdip_palettetypeoptimal, $ioptimalcolors = 0, $busetransparentcolor = True, $hbitmap = NULL ) If $gbgdip_v1_0 Then Return SetError(-1, 0, 0) If $ioptimalcolors > 0 Then $ipalettetype = $gdip_palettetypeoptimal Local $tpalette = DllStructCreate("uint Flags; uint Count; uint ARGB[" & $ientries & "];") DllStructSetData($tpalette, "Flags", $ipalettetype) DllStructSetData($tpalette, "Count", $ientries) Local $aresult = DllCall($ghgdipdll, "int", "GdipInitializePalette", "struct*", $tpalette, "uint", $ipalettetype, "uint", $ioptimalcolors, "bool", $busetransparentcolor, "handle", $hbitmap) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $tpalette EndFunc Func _gdiplus_imagedispose($himage) Local $aresult = DllCall($ghgdipdll, "int", "GdipDisposeImage", "handle", $himage) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicscreatefromhwnd($hwnd) Local $aresult = DllCall($ghgdipdll, "int", "GdipCreateFromHWND", "hwnd", $hwnd, "handle*", 0) If @error Then Return SetError(@error, @extended, 0) If $aresult[0] Then Return SetError(10, $aresult[0], 0) Return $aresult[2] EndFunc Func _gdiplus_graphicsdrawimagerect($hgraphics, $himage, $nx, $ny, $nw, $nh) Local $aresult = DllCall($ghgdipdll, "int", "GdipDrawImageRect", "handle", $hgraphics, "handle", $himage, "float", $nx, "float", $ny, "float", $nw, "float", $nh) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsdrawimagerectrect($hgraphics, $himage, $nsrcx, $nsrcy, $nsrcwidth, $nsrcheight, $ndstx, $ndsty, $ndstwidth, $ndstheight, $pattributes = 0, $iunit = 2) Local $aresult = DllCall($ghgdipdll, "int", "GdipDrawImageRectRect", "handle", $hgraphics, "handle", $himage, "float", $ndstx, "float", $ndsty, "float", $ndstwidth, "float", $ndstheight, "float", $nsrcx, "float", $nsrcy, "float", $nsrcwidth, "float", $nsrcheight, "int", $iunit, "handle", $pattributes, "ptr", 0, "ptr", 0) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsdrawline($hgraphics, $nx1, $ny1, $nx2, $ny2, $hpen = 0) __gdiplus_pendefcreate($hpen) Local $aresult = DllCall($ghgdipdll, "int", "GdipDrawLine", "handle", $hgraphics, "handle", $hpen, "float", $nx1, "float", $ny1, "float", $nx2, "float", $ny2) __gdiplus_pendefdispose() If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsdrawpath($hgraphics, $hpath, $hpen = 0) __gdiplus_pendefcreate($hpen) Local $aresult = DllCall($ghgdipdll, "int", "GdipDrawPath", "handle", $hgraphics, "handle", $hpen, "handle", $hpath) __gdiplus_pendefdispose() If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsdrawpie($hgraphics, $nx, $ny, $nwidth, $nheight, $fstartangle, $fsweepangle, $hpen = 0) __gdiplus_pendefcreate($hpen) Local $aresult = DllCall($ghgdipdll, "int", "GdipDrawPie", "handle", $hgraphics, "handle", $hpen, "float", $nx, "float", $ny, "float", $nwidth, "float", $nheight, "float", $fstartangle, "float", $fsweepangle) __gdiplus_pendefdispose() If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsdrawpolygon($hgraphics, $apoints, $hpen = 0) Local $icount = $apoints[0][0] Local $tpoints = DllStructCreate("float[" & $icount * 2 & "]") For $ii = 1 To $icount DllStructSetData($tpoints, 1, $apoints[$ii][0], (($ii - 1) * 2) + 1) DllStructSetData($tpoints, 1, $apoints[$ii][1], (($ii - 1) * 2) + 2) Next __gdiplus_pendefcreate($hpen) Local $aresult = DllCall($ghgdipdll, "int", "GdipDrawPolygon", "handle", $hgraphics, "handle", $hpen, "struct*", $tpoints, "int", $icount) __gdiplus_pendefdispose() If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsdrawrect($hgraphics, $nx, $ny, $nwidth, $nheight, $hpen = 0) __gdiplus_pendefcreate($hpen) Local $aresult = DllCall($ghgdipdll, "int", "GdipDrawRectangle", "handle", $hgraphics, "handle", $hpen, "float", $nx, "float", $ny, "float", $nwidth, "float", $nheight) __gdiplus_pendefdispose() If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsdrawstring($hgraphics, $sstring, $nx, $ny, $sfont = "Arial", $nsize = 10, $iformat = 0) Local $hbrush = _gdiplus_brushcreatesolid() Local $hformat = _gdiplus_stringformatcreate($iformat) Local $hfamily = _gdiplus_fontfamilycreate($sfont) Local $hfont = _gdiplus_fontcreate($hfamily, $nsize) Local $tlayout = _gdiplus_rectfcreate($nx, $ny, 0, 0) Local $ainfo = _gdiplus_graphicsmeasurestring($hgraphics, $sstring, $hfont, $tlayout, $hformat) If @error Then Return SetError(@error, @extended, 0) Local $aresult = _gdiplus_graphicsdrawstringex($hgraphics, $sstring, $hfont, $ainfo[0], $hformat, $hbrush) Local $ierror = @error, $iextended = @extended _gdiplus_fontdispose($hfont) _gdiplus_fontfamilydispose($hfamily) _gdiplus_stringformatdispose($hformat) _gdiplus_brushdispose($hbrush) Return SetError($ierror, $iextended, $aresult) EndFunc Func _gdiplus_graphicsdrawstringex($hgraphics, $sstring, $hfont, $tlayout, $hformat, $hbrush) Local $aresult = DllCall($ghgdipdll, "int", "GdipDrawString", "handle", $hgraphics, "wstr", $sstring, "int", -1, "handle", $hfont, "struct*", $tlayout, "handle", $hformat, "handle", $hbrush) If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsfillclosedcurve($hgraphics, $apoints, $hbrush = 0) Local $icount = $apoints[0][0] Local $tpoints = DllStructCreate("float[" & $icount * 2 & "]") For $ii = 1 To $icount DllStructSetData($tpoints, 1, $apoints[$ii][0], (($ii - 1) * 2) + 1) DllStructSetData($tpoints, 1, $apoints[$ii][1], (($ii - 1) * 2) + 2) Next __gdiplus_brushdefcreate($hbrush) Local $aresult = DllCall($ghgdipdll, "int", "GdipFillClosedCurve", "handle", $hgraphics, "handle", $hbrush, "struct*", $tpoints, "int", $icount) __gdiplus_brushdefdispose() If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Func _gdiplus_graphicsfillclosedcurve2($hgraphics, $apoints, $ntension, $hbrush = 0, $ifillmode = 0) Local $ii, $icount, $tpoints, $aresult __gdiplus_brushdefcreate($hbrush) $icount = $apoints[0][0] $tpoints = DllStructCreate("float[" & $icount * 2 & "]") For $ii = 1 To $icount DllStructSetData($tpoints, 1, $apoints[$ii][0], (($ii - 1) * 2) + 1) DllStructSetData($tpoints, 1, $apoints[$ii][1], (($ii - 1) * 2) + 2) Next $aresult = DllCall($ghgdipdll, "int", "GdipFillClosedCurve2", "handle", $hgraphics, "handle", $hbrush, "struct*", $tpoints, "int", $icount, "float", $ntension, "int", $ifillmode) __gdiplus_brushdefdispose() If @error Then Return SetError(@error, @extended, False) If $aresult[0] Then Return SetError(10, $aresult[0], False) Return True EndFunc Edited March 7, 2015 by nullschritt Link to comment Share on other sites More sharing options...
nullschritt Posted March 8, 2015 Author Share Posted March 8, 2015 (edited) Even changing settings in the example script does nothing Edited March 8, 2015 by nullschritt Link to comment Share on other sites More sharing options...
markyrocks Posted March 8, 2015 Share Posted March 8, 2015 Was looking for this saw this earlier. https://www.autoitscript.com/autoit3/docs/libfunctions/_GDIPlus_BitmapCloneArea.htm Definitely has the abilities to reduce bit sizes Spoiler "I Believe array math to be potentially fatal, I may be dying from array math poisoning" Link to comment Share on other sites More sharing options...
AndyG Posted March 8, 2015 Share Posted March 8, 2015 _GDIPlus_BitmapCreateFromScan0() Pixelformat: $GDIP_PXF01INDEXED = 1 bit per pixel, indexed $GDIP_PXF04INDEXED = 4 bits per pixel, indexed $GDIP_PXF08INDEXED = 8 bits per pixel, indexed $GDIP_PXF16GRAYSCALE = 16 bits per pixel, grayscale $GDIP_PXF16RGB555 = 16 bits per pixel; 5 bits for each RGB component $GDIP_PXF16RGB565 = 16 bits per pixel; 5 bits for red, 6 bits for green and 5 bits blue $GDIP_PXF16ARGB1555 = 16 bits per pixel; 1 bit for alpha and 5 bits for each RGB component $GDIP_PXF24RGB = 24 bits per pixel; 8 bits for each RGB component $GDIP_PXF32RGB = 32 bits per pixel; 8 bits for each RGB component. No alpha component. $GDIP_PXF32ARGB = 32 bits per pixel; 8 bits for each RGB and alpha component $GDIP_PXF32PARGB = 32 bits per pixel; 8 bits for each RGB and alpha component, pre-mulitiplied Kyan 1 Link to comment Share on other sites More sharing options...
nullschritt Posted March 8, 2015 Author Share Posted March 8, 2015 Was looking for this saw this earlier. https://www.autoitscript.com/autoit3/docs/libfunctions/_GDIPlus_BitmapCloneArea.htmDefinitely has the abilities to reduce bit sizesThis does exactly what I want it to, but it's not giving the results as expected. When I reduce the bitvalue and save the image it actually takes up more space than if I didn't change the bitvalue. The image without a doubt has less colors, but the output file is slightly bigger. This doesn't make any logical sense to me. Link to comment Share on other sites More sharing options...
markyrocks Posted March 8, 2015 Share Posted March 8, 2015 Sorry dude I haven't actually used it myself. I maybe here shortly but for different purposes. Will resizing the image make it take up less space? You can always resize it. And through my searches it also looks like the image can be saved using a different encoder. That compress it. And if it needs further compression you might be looking at something like winrar Spoiler "I Believe array math to be potentially fatal, I may be dying from array math poisoning" Link to comment Share on other sites More sharing options...
nullschritt Posted March 8, 2015 Author Share Posted March 8, 2015 I've got the results I want by combining resizing and altering the jpg output quality. I was able to get my images down to between 1-3kb each while still be at a quality that works for my application. (while lowering the bitvalue doesnt seem to reduce the file size, it does seem to make it look "smoother" after being downsized, and scaled back up.) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now