-
Notifications
You must be signed in to change notification settings - Fork 71
/
wic.ahk
1283 lines (1189 loc) · 67.9 KB
/
wic.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#Include Base.ahk
;;;;;;;;;;;;;;;;;;;;;;
;;IWICImagingFactory;;
;;;;;;;;;;;;;;;;;;;;;;
class IWICImagingFactory extends IUnknown
{
__new(){
this.__:=ComObjCreate("{cacaf262-9370-4615-a13b-9f5539da4c0a}","{ec5ec8a9-c395-4314-9c77-54d7a935ff70}"),this._v:=NumGet(this.__+0)
}
; Creates a new instance of the IWICBitmapDecoder class based on the given file.
CreateDecoderFromFilename(wzFilename,pguidVendor,dwDesiredAccess,metadataOptions){ ; WICDecodeOptions
WIC_hr(DllCall(this.vt(3),"ptr",this.__
,"str",wzFilename
,"ptr",WIC_GUID(GUID,pguidVendor)
,"uint",dwDesiredAccess
,"int",metadataOptions
,"ptr*",ppIDecoder
,"uint"),"CreateDecoderFromFilename")
return new IWICBitmapDecoder(ppIDecoder)
}
; Creates a new instance of the IWICBitmapDecoder class based on the given IStream.
CreateDecoderFromStream(pIStream,pguidVendor,metadataOptions){
WIC_hr(DllCall(this.vt(4),"ptr",this.__
,"ptr",IsObject(pIStream)?pIStream.__:pIStream
,"ptr",WIC_GUID(GUID,pguidVendor)
,"int",metadataOptions
,"ptr*",ppIDecoder
,"uint"),"CreateDecoderFromStream")
return new IWICBitmapDecoder(ppIDecoder)
}
; Creates a new instance of the IWICBitmapDecoder based on the given file handle.
; When a decoder is created using this method, the file handle must remain alive during the lifetime of the decoder.
CreateDecoderFromFileHandle(hFile,pguidVendor,metadataOptions){
WIC_hr(DllCall(this.vt(5),"ptr",this.__
,"ptr",hFile
,"ptr",WIC_GUID(GUID,pguidVendor)
,"int",metadataOptions
,"ptr*",ppIDecoder
,"uint"),"CreateDecoderFromFileHandle")
return new IWICBitmapDecoder(ppIDecoder)
}
; Creates a new instance of the IWICComponentInfo class for the given component class identifier (CLSID).
CreateComponentInfo(clsidComponent){
WIC_hr(DllCall(this.vt(6),"ptr",this.__
,"ptr",WIC_GUID(GUID,clsidComponent)
,"ptr*",ppIInfo
,"uint"),"CreateComponentInfo")
return new IWICComponentInfo(ppIInfo)
}
; Creates a new instance of IWICBitmapDecoder.
CreateDecoder(guidContainerFormat,pguidVendor){ ; REFGUID
WIC_hr(DllCall(this.vt(7),"ptr",this.__
,"ptr",WIC_GUID(GUID1,guidContainerFormat)
,"ptr",WIC_GUID(GUID2,pguidVendor)
,"ptr*",ppIDecoder
,"uint"),"CreateDecoder")
return new IWICBitmapDecoder(ppIDecoder)
}
; Creates a new instance of the IWICBitmapEncoder class.
; Other values may be available for both guidContainerFormat and pguidVendor depending on the installed WIC-enabled encoders. The values listed are those that are natively supported by the operating system.
CreateEncoder(guidContainerFormat,pguidVendor){
WIC_hr(DllCall(this.vt(8),"ptr",this.__
,"ptr",WIC_GUID(GUID1,guidContainerFormat)
,"ptr",WIC_GUID(GUID2,pguidVendor)
,"ptr*",ppIEncoder
,"uint"),"CreateEncoder")
return new IWICBitmapEncoder(ppIEncoder)
}
; Creates a new instance of the IWICPalette class.
CreatePalette(){
WIC_hr(DllCall(this.vt(9),"ptr",this.__
,"ptr*",ppIPalette
,"uint"),"CreatePalette")
return new IWICPalette(ppIPalette)
}
; Creates a new instance of the IWICFormatConverter class.
CreateFormatConverter(){
WIC_hr(DllCall(this.vt(10),"ptr",this.__
,"ptr*",ppIFormatConverter
,"uint"),"CreateFormatConverter")
return new IWICFormatConverter(ppIFormatConverter)
}
; Creates a new instance of an IWICBitmapScaler.
CreateBitmapScaler(){
WIC_hr(DllCall(this.vt(11),"ptr",this.__
,"ptr*",ppIBitmapScaler
,"uint"),"CreateBitmapScaler")
return new IWICBitmapScaler(ppIBitmapScaler)
}
; Creates a new instance of an IWICBitmapClipper object.
CreateBitmapClipper(){
WIC_hr(DllCall(this.vt(12),"ptr",this.__
,"ptr*",ppIBitmapClipper
,"uint"),"CreateBitmapClipper")
return new IWICBitmapClipper(ppIBitmapClipper)
}
; Creates a new instance of an IWICBitmapFlipRotator object.
CreateBitmapFlipRotator(){
WIC_hr(DllCall(this.vt(13),"ptr",this.__
,"ptr*",ppIBitmapFlipRotator
,"uint"),"CreateBitmapFlipRotator")
return new IWICBitmapFlipRotator(ppIBitmapFlipRotator)
}
; Creates a new instance of the IWICStream class.
CreateStream(){
WIC_hr(DllCall(this.vt(14),"ptr",this.__
,"ptr*",ppIWICStream
,"uint"),"CreateStream")
return new IWICStream(ppIWICStream)
}
; Creates a new instance of the IWICColorContext class.
CreateColorContext(){
WIC_hr(DllCall(this.vt(15),"ptr",this.__
,"ptr*",ppIWICColorContext
,"uint"),"CreateColorContext")
return new IWICColorContext(ppIWICColorContext)
}
; Creates a new instance of the IWICColorTransform class.
CreateColorTransformer(){
WIC_hr(DllCall(this.vt(16),"ptr",this.__
,"ptr*",ppIWICColorTransform
,"uint"),"CreateColorTransformer")
return new IWICColorTransform(IWICColorTransform)
}
; Creates an IWICBitmap object.
CreateBitmap(uiWidth,uiHeight,pixelFormat,option){ ; REFWICPixelFormatGUID , WICBitmapCreateCacheOption
WIC_hr(DllCall(this.vt(17),"ptr",this.__
,"uint",uiWidth,"uint",uiHeight
,"ptr",WIC_GUID(GUID,pixelFormat)
,"int",option
,"ptr*",ppIBitmap
,"uint"),"CreateBitmap")
return new IWICBitmap(ppIBitmap)
}
; Creates a IWICBitmap from a IWICBitmapSource.
CreateBitmapFromSource(pIBitmapSource,option){ ; IWICBitmapSource , WICBitmapCreateCacheOption
WIC_hr(DllCall(this.vt(18),"ptr",this.__
,"ptr",IsObject(pIBitmapSource)?pIBitmapSource.__:pIBitmapSource
,"int",option
,"ptr*",ppIBitmap
,"uint"),"CreateBitmapFromSource")
return new IWICBitmap(ppIBitmap)
}
; Creates an IWICBitmap from a specified rectangle of an IWICBitmapSource.
; Providing a rectangle that is larger than the source will produce undefined results.
; This method always creates a separate copy of the source image, similar to the cache option WICBitmapCacheOnLoad.
CreateBitmapFromSourceRect(pIBitmapSource,x,y,width,height){
WIC_hr(DllCall(this.vt(19),"ptr",this.__
,"ptr",IsObject(pIBitmapSource)?pIBitmapSource.__:pIBitmapSource
,"uint",x,"uint",y
,"uint",width,"uint",height
,"ptr*",ppIBitmap
,"uint"),"CreateBitmapFromSourceRect")
return new IWICBitmap(ppIBitmap)
}
; Creates an IWICBitmap from a memory block.
; The size of the IWICBitmap to be created must be smaller than or equal to the size of the image in pbBuffer.
; The stride of the destination bitmap will equal the stride of the source data, regardless of the width and height specified.
; The pixelFormat parameter defines the pixel format for both the input data and the output bitmap.
CreateBitmapFromMemory(uiWidth,uiHeight,pixelFormat,cbStride,cbBufferSize,pbBuffer){
WIC_hr(DllCall(this.vt(20),"ptr",this.__
,"uint",uiWidth,"uint",uiHeight
,"ptr",IsObject(pixelFormat)?pixelFormat[]:pixelFormat
,"uint",cbStride
,"uint",cbBufferSize
,"ptr",pbBuffer
,"ptr*",ppIBitmap
,"uint"),"CreateBitmapFromMemory")
return new IWICBitmap(ppIBitmap)
}
; Creates an IWICBitmap from a bitmap handle.
; For a non-palletized bitmap, set NULL for the hPalette parameter.
CreateBitmapFromHBITMAP(hBitmap,hPalette,options){
WIC_hr(DllCall(this.vt(21),"ptr",this.__
,"ptr",hBitmap
,"ptr",hPalette
,"int",options
,"ptr*",ppIBitmap,"uint"),"CreateBitmapFromHBITMAP")
return new IWICBitmap(ppIBitmap)
}
; Creates an IWICBitmap from an icon handle.
CreateBitmapFromHICON(hIcon){
WIC_hr(DllCall(this.vt(22),"ptr",this.__
,"ptr",hIcon
,"ptr*",ppIBitmap
,"uint"),"CreateBitmapFromHICON")
return new IWICBitmap(ppIBitmap)
}
; Creates an IEnumUnknown object of the specified component types.
; Component types must be enumerated seperately. Combinations of component types and WICAllComponents are unsupported.
CreateComponentEnumerator(componentTypes,options){ ; WICComponentType , WICComponentEnumerateOptions
WIC_hr(DllCall(this.vt(23),"ptr",this.__
,"int",componentTypes
,"int",options
,"ptr*",ppIEnumUnknown
,"uint"),"CreateComponentEnumerator")
return new IEnumUnknown(ppIEnumUnknown)
}
; Creates a new instance of the fast metadata encoder based on the given IWICBitmapDecoder.
; The Windows provided codecs do not support fast metadata encoding at the decoder level, and only support fast metadata encoding at the frame level. To create a fast metadata encoder from a frame, see CreateFastMetadataEncoderFromFrameDecode.
CreateFastMetadataEncoderFromDecoder(pIDecoder){ ; IWICBitmapDecoder
WIC_hr(DllCall(this.vt(24),"ptr",this.__
,"ptr",IsObject(pIDecoder)?pIDecoder.__:pIDecoder
,"ptr*",ppIFastEncoder
,"uint"),"CreateFastMetadataEncoderFromDecoder")
return new IWICFastMetadataEncoder(ppIFastEncoder)
}
; Creates a new instance of the fast metadata encoder based on the given image frame.
; Example demonstrates how to use the CreateFastMetadataEncoderFromFrameDecode method for fast metadata encoding. http://msdn.microsoft.com/en-us/library/windows/desktop/ee690315%28v=vs.85%29.aspx
CreateFastMetadataEncoderFromFrameDecode(pIFrameDecoder){ ; IWICBitmapFrameDecode
WIC_hr(DllCall(this.vt(25),"ptr",this.__
,"ptr",IsObject(pIFrameDecoder)?pIFrameDecoder.__:pIFrameDecoder
,"ptr*",ppIFastEncoder
,"uint"),"CreateFastMetadataEncoderFromFrameDecode")
return new IWICFastMetadataEncoder(ppIFastEncoder)
}
; Creates a new instance of a query writer.
CreateQueryWriter(guidMetadataFormat,pguidVendor){
WIC_hr(DllCall(this.vt(26),"ptr",this.__
,"ptr",WIC_GUID(GUID1,guidMetadataFormat)
,"ptr",WIC_GUID(GUID2,pguidVendor)
,"ptr*",ppIQueryWriter
,"uint"),"CreateQueryWriter")
return new IWICMetadataQueryWriter(ppIQueryWriter)
}
; Creates a new instance of a query writer based on the given query reader. The query writer will be pre-populated with metadata from the query reader.
CreateQueryWriterFromReader(pIQueryReader,pguidVendor){
WIC_hr(DllCall(this.vt(27),"ptr",this.__
,"ptr",WIC_GUID(GUID1,pIQueryReader)
,"ptr",WIC_GUID(GUID2,pguidVendor)
,"ptr*",ppIQueryWriter
,"uint"),"CreateQueryWriterFromReader")
return new IWICMetadataQueryWriter(ppIQueryWriter)
}
}
;;;;;;;;;;;;;;;;;;;
;;Bitmap Resource;;IWICBitmapSource.
;;;;;;;;;;;;;;;;;;;
class IWICBitmapSource extends IUnknown
{
; Retrieves the pixel width and height of the bitmap.
GetSize(){
WIC_hr(DllCall(this.vt(3),"ptr",this.__
,"uint*",puiWidth,"uint*",puiHeight
,"uint"),"GetSize")
return [puiWidth,puiHeight]
}
; Retrieves the pixel format of the bitmap source.
; The pixel format returned by this method is not necessarily the pixel format the image is stored as. The codec may perform a format conversion from the storage pixel format to an output pixel format.
GetPixelFormat(ByRef pPixelFormat){
WIC_hr(DllCall(this.vt(4),"ptr",this.__
,"ptr",pPixelFormat
,"uint"),"GetPixelFormat")
return pPixelFormat ; WICPixelFormatGUID
}
; Retrieves the sampling rate between pixels and physical world measurements.
; Some formats, such as GIF and ICO, do not have full DPI support. For GIF, this method calculates the DPI values from the aspect ratio, using a base DPI of (96.0, 96.0). The ICO format does not support DPI at all, and the method always returns (96.0,96.0) for ICO images.
; Additionally, WIC itself does not transform images based on the DPI values in an image. It is up to the caller to transform an image based on the resolution returned.
GetResolution(){
WIC_hr(DllCall(this.vt(5),"ptr",this.__
,"double*",pDpiX,"double*",pDpiY
,"uint"),"GetResolution")
return [pDpiX,pDpiY]
}
; Retrieves the color table for indexed pixel formats.
; If the IWICBitmapSource is an IWICBitmapFrameDecode, the function may return the image's global palette if a frame-level palette is not available. The global palette may also be retrieved using the CopyPalette method.
CopyPalette(pIPalette){ ; IWICPalette
return WIC_hr(DllCall(this.vt(6),"ptr",this.__
,"ptr",IsObject(pIPalette)?pIPalette.__:pIPalette
,"uint"),"CopyPalette")
}
; Instructs the object to produce pixels.
/*
CopyPixels is one of the two main image processing routines (the other being Lock) triggering the actual processing. It instructs the object to produce pixels according to its algorithm - this may involve decoding a portion of a JPEG stored on disk, copying a block of memory, or even analytically computing a complex gradient. The algorithm is completely dependent on the object implementing the interface.
The caller can restrict the operation to a rectangle of interest (ROI) using the prc parameter. The ROI sub-rectangle must be fully contained in the bounds of the bitmap. Specifying a NULL ROI implies that the whole bitmap should be returned.
The caller controls the memory management and must provide an output buffer (pbBuffer) for the results of the copy along with the buffer's bounds (cbBufferSize). The cbStride parameter defines the count of bytes between two vertically adjacent pixels in the output buffer. The caller must ensure that there is sufficient buffer to complete the call based on the width, height and pixel format of the bitmap and the sub-rectangle provided to the copy method.
If the caller needs to perform numerous copies of an expensive IWICBitmapSource such as a JPEG, it is recommended to create an in-memory IWICBitmap first.
The callee must only write to the first (prc->Width*bitsperpixel+7)/8 bytes of each line of the output buffer (in this case, a line is a consecutive string of cbStride bytes).
*/
CopyPixels(prc,cbStride,cbBufferSize){ ; WICRect
WIC_hr(DllCall(this.vt(7),"ptr",this.__
,"ptr",IsObject(prc)?prc[]:prc
,"uint",cbStride
,"uint",cbBufferSize
,"ptr*",pbBuffer
,"uint"),"CopyPixels")
return pbBuffer
}
}
class IWICBitmap extends IWICBitmapSource
{
; Provides access to a rectangular area of the bitmap.
; Locks are exclusive for writing but can be shared for reading. You cannot call CopyPixels while the IWICBitmap is locked for writing. Doing so will return an error, since locks are exclusive.
; Example, an IWICBitmap is created and the image data is cleared using an IWICBitmapLock. http://msdn.microsoft.com/en-us/library/windows/desktop/ee690187%28v=vs.85%29.aspx
Lock(prcLock,flags){ ; WICRect , WICBitmapLockFlags
WIC_hr(DllCall(this.vt(8),"ptr",this.__
,"ptr",IsObject(prcLock)?prcLock[]:prcLock
,"int",flags
,"ptr*",ppILock
,"uint"),"Lock")
return ppILock
}
; Provides access for palette modifications.
SetPalette(pIPalette){ ; IWICPalette
return WIC_hr(DllCall(this.vt(9),"ptr",this.__
,"ptr",IsObject(pIPalette)?pIPalette.__:pIPalette
,"uint"),"SetPalette")
}
; Changes the physical resolution of the image.
; This method has no effect on the actual pixels or samples stored in the bitmap. Instead the interpretation of the sampling rate is modified. This means that a 96 DPI image which is 96 pixels wide is one inch. If the physical resolution is modified to 48 DPI, then the bitmap is considered to be 2 inches wide but has the same number of pixels. If the resolution is less than REAL_EPSILON (1.192092896e-07F) the error code WINCODEC_ERR_INVALIDPARAMETER is returned.
SetResolution(dpiX,dpiY){
return WIC_hr(DllCall(this.vt(10),"ptr",this.__
,"double",dpiX,"double",dpiY
,"uint"),"SetResolution")
}
}
class IWICBitmapScaler extends IWICBitmapSource
{
; Initializes the bitmap scaler with the provided parameters.
; IWICBitmapScaler can't be initialized multiple times. For example, when scaling every frame in a multi-frame image, a new IWICBitmapScaler must be created and initialized for each frame.
Initialize(pISource,uiWidth,uiHeight,mode){ ; IWICBitmapSource , WICBitmapInterpolationMode
return WIC_hr(DllCall(this.vt(8),"ptr",this.__
,"ptr",IsObject(pISource)?pISource.__:pISource
,"uint",uiWidth,"uint",uiHeight
,"int",mode
,"uint"),"Initialize")
}
}
class IWICBitmapClipper extends IWICBitmapSource
{
; Initializes the bitmap clipper with the provided parameters.
; Example creates and initializes a clipper using the passed in parameters. http://msdn.microsoft.com/en-us/library/windows/desktop/ee719677%28v=vs.85%29.aspx
Initialize(pISource,prc){ ; IWICBitmapSource , WICRect
return WIC_hr(DllCall(this.vt(8),"ptr",this.__
,"ptr",IsObject(pISource)?pISource.__:pISource
,"ptr",IsObject(prc)?prc[]:prc
,"uint"),"Initialize")
}
}
class IWICBitmapFlipRotator extends IWICBitmapSource
{
; Initializes the bitmap flip rotator with the provided parameters.
; Example http://msdn.microsoft.com/en-us/library/windows/desktop/ee690132%28v=vs.85%29.aspx
Initialize(pISource,options){ ; IWICBitmapSource , WICBitmapTransformOptions
return WIC_hr(DllCall(this.vt(8),"ptr",this.__
,"ptr",IsObject(pISource)?pISource.__:pISource
,"int",options
,"uint"),"Initialize")
}
}
class IWICColorTransform extends IWICBitmapSource
{
; Initializes an IWICColorTransform with a IWICBitmapSource and transforms it from one IWICColorContext to another.
; Example performs a color transform from one IWICColorContext to another. http://msdn.microsoft.com/en-us/library/windows/desktop/ee690202%28v=vs.85%29.aspx
Initialize(pIBitmapSource,pIContextSource,pIContextDest,pixelFmtDest){ ; IWICBitmapSource , IWICColorContext , REFWICPixelFormatGUID
return WIC_hr(DllCall(this.vt(8),"ptr",this.__
,"ptr",IsObject(pIBitmapSource)?pIBitmapSource.__:pIBitmapSource
,"ptr",IsObject(pIContextSource)?pIContextSource.__:pIContextSource
,"ptr",IsObject(pIContextDest)?pIContextDest.__:pIContextDest
,"ptr",IsObject(pixelFmtDest)?pixelFmtDest[]:pixelFmtDest
,"uint"),"Initialize")
}
}
class IWICBitmapFrameDecode extends IWICBitmapSource
{
; Retrieves a metadata query reader for the frame.
; For image formats with one frame (JPG, PNG, JPEG-XR), the frame-level query reader of the first frame is used to access all image metadata, and the decoder-level query reader isn’t used. For formats with more than one frame (GIF, TIFF), the frame-level query reader for a given frame is used to access metadata specific to that frame, and in the case of GIF a decoder-level metadata reader will be present. If the decoder doesn’t support metadata (BMP, ICO), this will return WINCODEC_ERR_UNSUPPORTEDOPERATION.
GetMetadataQueryReader(){
WIC_hr(DllCall(this.vt(8),"ptr",this.__
,"ptr*",ppIMetadataQueryReader
,"uint"),"GetMetadataQueryReader")
return new IWICMetadataQueryReader(ppIMetadataQueryReader)
}
; Retrieves the IWICColorContext associated with the image frame.
; If NULL is passed for ppIColorContexts, and 0 is passed for cCount, this method will return the total number of color contexts in the image in pcActualCount.
; The ppIColorContexts array must be filled with valid data: each IWICColorContext* in the array must have been created using IWICImagingFactory::CreateColorContext.
GetColorContexts(cCount){
ppIColorContexts:=Struct("ptr[" cCount "]")
WIC_hr(DllCall(this.vt(9),"ptr",this.__
,"uint",cCount
,"ptr",ppIColorContexts[]
,"uint*",pcActualCount
,"uint"),"GetColorContexts")
return [ppIColorContexts,pcActualCount]
}
; Retrieves a small preview of the frame, if supported by the codec.
; Not all formats support thumbnails. Joint Photographic Experts Group (JPEG), Tagged Image File Format (TIFF), and Microsoft Windows Digital Photo (WDP) support thumbnails.
; If the codec does not support thumbnails, return WINCODEC_ERROR_CODECNOTHUMBNAIL rather than E_NOTIMPL.
GetThumbnail(){
WIC_hr(DllCall(this.vt(10),"ptr",this.__
,"ptr*",ppIThumbnail
,"uint"),"GetThumbnail")
return new IWICBitmapSource(ppIThumbnail)
}
}
;;;;;;;;;;;;;;;;;;;;
;;Format Converter;;Used to convert from one pixel format to another.
;;;;;;;;;;;;;;;;;;;;
class IWICFormatConverter extends IWICBitmapSource
{
; Initializes the format converter.
Initialize(pISource,dstFormat,dither,pIPalette,alphaThresholdPercent,paletteTranslate){ ;
return WIC_hr(DllCall(this.vt(8),"ptr",this.__
,"ptr",IsObject(pISource)?pISource.__:pISource
,"ptr",IsObject(dstFormat)?dstFormat[]:dstFormat
,"uint",dither
,"ptr",IsObject(pIPalette)?pIPalette.__:pIPalette
,"double",alphaThresholdPercent
,"uint",paletteTranslate
,"uint"),"Initialize")
}
; Determines if the source pixel format can be converted to the destination pixel format.
/*
If you do not have a predefined palette, you must first create one. Use InitializeFromBitmap to create the palette object, then pass it in along with your other parameters.
dither, pIPalette, alphaThresholdPercent, and paletteTranslate are used to mitigate color loss when converting to a reduced bit-depth format. For conversions that do not need these settings, the following parameters values should be used: dither set to WICBitmapDitherTypeNone, pIPalette set to NULL, alphaThresholdPercent set to 0.0f, and paletteTranslate set to WICBitmapPaletteTypeCustom.
The basic algorithm involved when using an ordered dither requires a fixed palette, found in the WICBitmapPaletteType enumeration, in a specific order. Often, the actual palette provided for the output may have a different ordering or some slight variation in the actual colors. This is the case when using the Microsoft Windows palette which has slight differences among versions of Windows. To provide for this, a palette and a palette translation are given to the format converter. The pIPalette is the actual destination palette to be used and the paletteTranslate is a fixed palette. Once the conversion is complete, the colors are mapped from the fixed palette to the actual colors in pIPalette using a nearest color matching algorithm.
If colors in pIPalette do not closely match those in paletteTranslate, the mapping may produce undesireable results.
WICBitmapDitherTypeOrdered4x4 can be useful in format conversions from 8-bit formats to 5- or 6-bit formats as there is no way to accurately convert color data.
WICBitmapDitherTypeErrorDiffusion selects the error diffusion algorithm and may be used with any palette. If an arbitrary palette is provided, WICBitmapPaletteCustom should be passed in as the paletteTranslate. Error diffusion often provides superior results compared to the ordered dithering algorithms especially when combined with the optimized palette generation functionality on the IWICPalette.
When converting a bitmap which has an alpha channel, such as a Portable Network Graphics (PNG), to 8bpp, the alpha channel is normally ignored. Any pixels which were transparent in the original bitmap show up as black in the final output because both transparent and black have pixel values of zero in the respective formats.
Some 8bpp content can contains an alpha color; for instance, the Graphics Interchange Format (GIF) format allows for a single palette entry to be used as a transparent color. For this type of content, alphaThresholdPercent specifies what percentage of transparency should map to the transparent color. Because the alpha value is directly proportional to the opacity (not transparency) of a pixel, the alphaThresholdPercent indicates what level of opacity is mapped to the fully transparent color. For instance, 9.8% implies that any pixel with an alpha value of less than 25 will be mapped to the transparent color. A value of 100% maps all pixels which are not fully opaque to the transparent color. Note that the palette should provide a transparent color. If it does not, the 'transparent' color will be the one closest to zero - often black.
*/
CanConvert(srcPixelFormat,dstPixelFormat){
WIC_hr(DllCall(this.vt(9),"ptr",this.__
,"ptr",IsObject(srcPixelFormat)?srcPixelFormat[]:srcPixelFormat
,"ptr",IsObject(dstPixelFormat)?dstPixelFormat[]:dstPixelFormat
,"int*",pfCanConvert
,"uint"),"CanConvert")
return pfCanConvert
}
}
;;;;;;;;;;;
;;Decoder;;Used to decode image data from a stream into a format that is useful for image processing.
;;;;;;;;;;;
class IWICBitmapDecoder extends IUnknown
{
; Retrieves the capabilities of the decoder based on the specified stream.
; Custom decoder implementations should save the current position of the specified IStream, read whatever information is necessary in order to determine which capabilities it can provide for the supplied stream, and restore the stream position.
QueryCapability(pIStream){
WIC_hr(DllCall(this.vt(3),"ptr",this.__
,"ptr",IsObject(pIStream)?pIStream.__:pIStream
,"int*",pdwCapability
,"uint"),"QueryCapability")
return pdwCapability ; WICBitmapDecoderCapabilities
}
; Initializes the decoder with the provided stream.
Initialize(pIStream,cacheOptions){ ; WICDecodeOptions
return WIC_hr(DllCall(this.vt(4),"ptr",this.__,"ptr"
,IsObject(pIStream)?pIStream.__:pIStream
,"uint",cacheOptions
,"uint"),"Initialize")
}
; Retrieves the image's container format.
GetContainerFormat(){
WIC_hr(DllCall(this.vt(5),"ptr",this.__
,"ptr*",pguidContainerFormat
,"uint"),"GetContainerFormat")
return pguidContainerFormat
}
; Retrieves an IWICBitmapDecoderInfo for the image.
GetDecoderInfo(){
WIC_hr(DllCall(this.vt(6),"ptr",this.__
,"ptr*",ppIDecoderInfo
,"uint"),"GetDecoderInfo")
return new IWICBitmapDecoderInfo(ppIDecoderInfo)
}
; Copies the decoder's IWICPalette.
; CopyPalette returns a global palette (a palette that applies to all the frames in the image) if there is one; otherwise, it returns WINCODEC_ERR_PALETTEUNAVAILABLE. If an image doesn't have a global palette, it may still have a frame-level palette, which can be retrieved using IWICBitmapFrameDecode::CopyPalette.
CopyPalette(pIPalette){
return WIC_hr(DllCall(this.vt(7),"ptr",this.__
,"ptr",IsObject(pIPalette)?pIPalette.__:pIPalette
,"uint"),"CopyPalette")
}
; Retrieves the metadata query reader from the decoder.
; If an image format does not support container-level metadata, this will return WINCODEC_ERR_UNSUPPORTEDOPERATION. The only Windows provided image format that supports container-level metadata is GIF. Instead, use IWICBitmapFrameDecode::GetMetadataQueryReader.
GetMetadataQueryReader(){
WIC_hr(DllCall(this.vt(8),"ptr",this.__
,"ptr*",ppIMetadataQueryReader
,"uint"),"GetMetadataQueryReader")
return new IWICMetadataQueryReader(ppIMetadataQueryReader)
}
; Retrieves a preview image, if supported.
; Not all formats support previews. Only the native Microsoft Windows Digital Photo (WDP) codec support previews.
GetPreview(){
WIC_hr(DllCall(this.vt(9),"ptr",this.__
,"ptr*",ppIBitmapSource
,"uint"),"GetPreview")
return new IWICBitmapSource(ppIBitmapSource)
}
; Retrieves the IWICColorContext objects of the image.
GetColorContexts(cCount){
ppIColorContexts:=Struct("ptr[" cCount "]")
WIC_hr(DllCall(this.vt(10),"ptr",this.__
,"uint",cCount
,"ptr",ppIColorContexts[]
,"uint*",pcActualCount
,"uint"),"GetColorContexts")
return [ppIColorContexts,pcActualCount] ; IWICColorContext
}
; Retrieves a bitmap thumbnail of the image, if one exists
; The returned thumbnail can be of any size, so the caller should scale the thumbnail to the desired size. The only Windows provided image formats that support thumbnails are JPEG, TIFF, and JPEG-XR. If the thumbnail is not available, this will return WINCODEC_ERR_CODECNOTHUMBNAIL.
GetThumbnail(){
WIC_hr(DllCall(this.vt(11),"ptr",this.__
,"ptr*",ppIThumbnail
,"uint"),"GetThumbnail")
return new IWICBitmapSource(ppIThumbnail)
}
; Retrieves the total number of frames in the image.
GetFrameCount(){
WIC_hr(DllCall(this.vt(12),"ptr",this.__
,"uint*",pCount
,"uint"),"GetFrameCount")
return pCount
}
; Retrieves the specified frame of the image.
GetFrame(index){
WIC_hr(DllCall(this.vt(13),"ptr",this.__
,"uint",index
,"ptr*",ppIBitmapFrame
,"uint"),"GetFrame")
return new IWICBitmapFrameDecode(ppIBitmapFrame)
}
}
;;;;;;;;;;;
;;Encoder;;Writes image data to a stream.
;;;;;;;;;;;
class IWICBitmapEncoder extends IUnknown
{
; Initializes the encoder with an IStream which tells the encoder where to encode the bits.
Initialize(pIStream,cacheOption){ ; WICBitmapEncoderCacheOption
return WIC_hr(DllCall(this.vt(3),"ptr",this.__
,"ptr",IsObject(pIStream)?pIStream.__:pIStream
,"int",cacheOption
,"uint"),"Initialize")
}
; Retrieves the encoder's container format.
GetContainerFormat(){
WIC_hr(DllCall(this.vt(4),"ptr",this.__
,"ptr*",pguidContainerFormat
,"uint"),"GetContainerFormat")
return pguidContainerFormat
}
; Retrieves an IWICBitmapEncoderInfo for the encoder.
GetEncoderInfo(){
WIC_hr(DllCall(this.vt(5),"ptr",this.__
,"ptr*",ppIEncoderInfo
,"uint"),"GetEncoderInfo")
return new IWICBitmapEncoderInfo(ppIEncoderInfo)
}
; Sets the IWICColorContext objects for the encoder.
SetColorContexts(cCount,ppIColorContext){
return WIC_hr(DllCall(this.vt(6),"ptr",this.__
,"uint",cCount
,"ptr",IsObject(ppIColorContext)?ppIColorContext[]:ppIColorContext
,"uint"),"SetColorContexts")
}
; Sets the global palette for the image.
; Only GIF images support an optional global palette, and you must set the global palette before adding any frames to the image. You only need to set the palette for indexed pixel formats.
SetPalette(pIPalette){ ; IWICPalette
return WIC_hr(DllCall(this.vt(7),"ptr",this.__
,"ptr",IsObject(pIPalette)?pIPalette.__:pIPalette
,"uint"),"SetPalette")
}
; Sets the global thumbnail for the image.
SetThumbnail(pIThumbnail){ ; IWICBitmapSource
return WIC_hr(DllCall(this.vt(8),"ptr",this.__
,"ptr",IsObject(pIThumbnail)?pIThumbnail.__:pIThumbnail
,"uint"),"SetThumbnail")
}
; Sets the global preview for the image.
SetPreview(pIPreview){
return WIC_hr(DllCall(this.vt(9),"ptr",this.__
,"ptr",IsObject(pIPreview)?pIPreview.__:pIPreview
,"uint"),"SetPreview")
}
; Creates a new IWICBitmapFrameEncode instance.
; The parameter ppIEncoderOptions can be used to receive an IPropertyBag2 that can then be used to specify encoder options. This is done by passing a pointer to a NULL IPropertyBag2 pointer in ppIEncoderOptions. The returned IPropertyBag2 is initialized with all encoder options that are available for the given format, at their default values. To specify non-default encoding behavior, set the needed encoder options on the IPropertyBag2 and pass it to IWICBitmapFrameEncode::Initialize.
; Note Do not pass in a pointer to an initialized IPropertyBag2. The pointer will be overwritten, and the original IPropertyBag2 will not be freed.
; Otherwise, you can pass NULL in ppIEncoderOptions if you do not intend to specify encoder options.
; See Encoding Overview for an example of how to set encoder options.
; For formats that support encoding multiple frames (for example, TIFF, JPEG-XR), you can work on only one frame at a time. This means that you must call IWICBitmapFrameEncode::Commit before you call CreateNewFrame again.
CreateNewFrame(ppIEncoderOptions=0){
WIC_hr(DllCall(this.vt(10),"ptr",this.__
,"ptr*",ppIFrameEncode
,"ptr*",ppIEncoderOptions
,"uint"),"CreateNewFrame")
return new IWICBitmapFrameEncode(ppIFrameEncode)
}
; Commits all changes for the image and closes the stream.
; To finalize an image, both the frame Commit and the encoder Commit must be called. However, only call the encoder Commit method after all frames have been committed.
; After the encoder has been committed, it can't be re-initialized or reused with another stream. A new encoder interface must be created, for example, with IWICImagingFactory::CreateEncoder.
; For the encoder Commit to succeed, you must at a minimum call IWICBitmapEncoder::Initialize and either IWICBitmapFrameEncode::WriteSource or IWICBitmapFrameEncode::WritePixels.
; IWICBitmapFrameEncode::WriteSource specifies all parameters needed to encode the image data. IWICBitmapFrameEncode::WritePixels requires that you also call IWICBitmapFrameEncode::SetSize, IWICBitmapFrameEncode::SetPixelFormat, and IWICBitmapFrameEncode::SetPalette (if the pixel format is indexed).
Commit(){
return WIC_hr(DllCall(this.vt(11),"ptr",this.__,"uint"),"Commit")
}
; Retrieves a metadata query writer for the encoder.
GetMetadataQueryWriter(){
WIC_hr(DllCall(this.vt(12),"ptr",this.__
,"ptr*",ppIMetadataQueryWriter
,"uint"),"GetMetadataQueryWriter")
return new IWICMetadataQueryWriter(ppIMetadataQueryWriter)
}
}
;;;;;;;;;;
;;Stream;;Used to read and write data from a file, network resource, a block of memory, and so on.
;;;;;;;;;;
class IWICStream extends IStream
{
; Initializes a stream from another stream. Access rights are inherited from the underlying stream.
InitializeFromIStream(pIStream){
return WIC_hr(DllCall(this.vt(14),"ptr",this.__
,"ptr",IsObject(pIStream)?pIStream.__:pIStream
,"uint"),"InitializeFromIStream")
}
; Initializes a stream from a particular file.
; The IWICStream interface methods do not enable you to provide a file sharing option. To create a shared file stream for an image, use the SHCreateStreamOnFileEx function. This stream can then be used to create an IWICBitmapDecoder using the CreateDecoderFromStream method.
; Example demonstrates the use of the InitializeFromFilename to create an image decoder. msdn.microsoft.com/en-us/library/windows/desktop/ee719788(v=vs.85).aspx
InitializeFromFilename(wzFileName,dwDesiredAccess){
return WIC_hr(DllCall(this.vt(15),"ptr",this.__
,"str",wzFileName
,"uint",dwDesiredAccess
,"uint"),"InitializeFromFilename")
}
; Initializes a stream to treat a block of memory as a stream. The stream cannot grow beyond the buffer size.
; This method should be avoided whenever possible. The caller is responsible for ensuring the memory block is valid for the lifetime of the stream when using InitializeFromMemory. A workaround for this behavior is to create an IStream and use InitializeFromIStream to create the IWICStream.
; If you require a growable memory stream, use CreateStreamOnHGlobal.
InitializeFromMemory(pbBuffer,cbBufferSize){
return WIC_hr(DllCall(this.vt(16),"ptr",this.__
,"ptr",pbBuffer
,"uint",cbBufferSize
,"uint"),"InitializeFromMemory")
}
; Initializes the stream as a substream of another stream.
; The stream functions with its own stream position, independent of the underlying stream but restricted to a region. All seek positions are relative to the sub region. It is allowed, though not recommended, to have multiple writable sub streams overlapping the same range.
InitializeFromIStreamRegion(pIStream,ulOffset,ulMaxSize){
return WIC_hr(DllCall(this.vt(17),"ptr",this.__
,"ptr",IsObject(pIStream)?pIStream.__:pIStream
,"uint64",ulOffset
,"uint64",ulMaxSize
,"uint"),"InitializeFromIStreamRegion")
}
}
;;;;;;;;;;;;;;;;;;;;;;;;;
;;Metadata Query Reader;;Used to read metadata of an image or image frame.
;;Metadata Query Writer;;Used to write metadata to an image or image frame.
;;;;;;;;;;;;;;;;;;;;;;;;;
class IWICMetadataQueryReader extends IUnknown
{
; Gets the metadata query readers container format.
GetContainerFormat(){
WIC_hr(DllCall(this.vt(3),"ptr",this.__
,"ptr*",pguidContainerFormat
,"uint"),"GetContainerFormat")
return pguidContainerFormat
}
; Retrieves the current path relative to the root metadata block.
; If you pass NULL to wzNamespace, GetLocation ignores cchMaxLength and returns the required buffer length to store the path in the variable that pcchActualLength points to.
; If the query reader is relative to the top of the metadata hierarchy, it will return a single-char string.
; If the query reader is relative to a nested metadata block, this method will return the path to the current query reader.
GetLocation(cchMaxLength,wzNamespace){
WIC_hr(DllCall(this.vt(4),"ptr",this.__
,"uint",cchMaxLength
,"wstr",wzNamespace
,"uint*",pcchActualLength
,"uint"),"GetLocation")
return pcchActualLength
}
; For more information on the metadata query language, see the Metadata Query Language Overview. http://msdn.microsoft.com/en-us/library/windows/desktop/ee719796%28v=vs.85%29.aspx
; Retrieves the metadata block or item identified by a metadata query expression.
; GetMetadataByName uses metadata query expressions to access embedded metadata.
; If multiple blocks or items exist that are expressed by the same query expression, the first metadata block or item found will be returned.
GetMetadataByName(wzName){
WIC_hr(DllCall(this.vt(5),"ptr",this.__
,"wstr",wzName
,"ptr",PROPVARIANT(pvarValue)
,"uint"),"GetMetadataByName")
return GetVariantValue(pvarValue) ; PROPVARIANT
}
; Gets an enumerator of all metadata items at the current relative location within the metadata hierarchy.
; The retrieved enumerator only contains query strings for the metadata blocks and items in the current level of the hierarchy.
GetEnumerator(){
WIC_hr(DllCall(this.vt(6),"ptr",this.__
,"ptr*",ppIEnumString
,"uint"),"GetEnumerator")
return new IEnumString(ppIEnumString) ; IEnumString
}
}
class IWICMetadataQueryWriter extends IWICMetadataQueryReader
{
; Sets a metadata item to a specific location.
; SetMetadataByName uses metadata query expressions to remove metadata.
; If the value set is a nested metadata block then use variant type VT_UNKNOWN and pvarValue pointing to the IWICMetadataQueryWriter of the new metadata block. The ordering of metadata items is at the discretion of the query writer since relative locations are not specified.
SetMetadataByName(wzName,pvarValue){ ; PROPVARIANT not completed see Metadata Query Language Overview
return WIC_hr(DllCall(this.vt(7),"ptr",this.__
,"str",wzName
,"ptr",pvarValue
,"uint"),"SetMetadataByName")
}
; Removes a metadata item from a specific location using a metadata query expression.
; RemoveMetadataByName uses metadata query expressions to remove metadata.
; If the metadata item is a metadata block, it is removed from the metadata hierarchy.
RemoveMetadataByName(wzName){
return WIC_hr(DllCall(this.vt(8),"ptr",this.__
,"str",wzName
,"uint"),"RemoveMetadataByName")
}
}
;;;;;;;;;;;;;;;;;
;;WIC Constants;;
;;;;;;;;;;;;;;;;;
WIC_Struct(name,p=0){
static init:=1,_:=[]
if init{
init:=0
,_["WICRect"]:=struct("INT X;INT Y;INT Width;INT Height;")
,_["WICBitmapPattern"]:=struct("ULARGE_INTEGER Position;ULONG Length;BYTE *Pattern;BYTE *Mask;BOOL EndOfStream;")
,_["WICRawCapabilitiesInfo"]:=struct("UINT cbSize;UINT CodecMajorVersion;UINT CodecMinorVersion;int ExposureCompensationSupport;int ContrastSupport;int RGBWhitePointSupport;int NamedWhitePointSupport;UINT NamedWhitePointSupportMask;int KelvinWhitePointSupport;int GammaSupport;int TintSupport;int SaturationSupport;int SharpnessSupport;int NoiseReductionSupport;int DestinationColorProfileSupport;int ToneCurveSupport;WICRawRotationCapabilities RotationSupport;int RenderModeSupport;")
,_["WICRawToneCurvePoint"]:=struct("double Input;double Output;")
,_["WICRawToneCurve"]:=struct("UINT cPoints;WICRawToneCurvePoint aPoints[1];")
}
return _.haskey(name)?_[name].clone(p=0?[]:p):"Struct not exists."
}
WIC_Constant(){
static init:=1,_:=[]
if init{
init:=0
_["WICColorContextUninitialized"]:=0
,_["WICColorContextProfile"]:=0x1
,_["WICColorContextExifColorSpace"]:=0x2
,_["WICBitmapNoCache"]:=0
,_["WICBitmapCacheOnDemand"]:=0x1
,_["WICBitmapCacheOnLoad"]:=0x2
,_["WICBITMAPCREATECACHEOPTION_FORCE_DWORD"]:=0x7fffffff
,_["WICDecodeMetadataCacheOnDemand"]:=0
,_["WICDecodeMetadataCacheOnLoad"]:=0x1
,_["WICMETADATACACHEOPTION_FORCE_DWORD"]:=0x7fffffff
_["WICBitmapEncoderCacheInMemory"]:=0
,_["WICBitmapEncoderCacheTempFile"]:=0x1
,_["WICBitmapEncoderNoCache"]:=0x2
,_["WICBITMAPENCODERCACHEOPTION_FORCE_DWORD"]:=0x7fffffff
,_["WICDecoder"]:=0x1
,_["WICEncoder"]:=0x2
,_["WICPixelFormatConverter"]:=0x4
,_["WICMetadataReader"]:=0x8
,_["WICMetadataWriter"]:=0x10
,_["WICPixelFormat"]:=0x20
_["WICAllComponents"]:=0x3f
,_["WICCOMPONENTTYPE_FORCE_DWORD"]:=0x7fffffff
,_["WICComponentEnumerateDefault"]:=0
,_["WICComponentEnumerateRefresh"]:=0x1
,_["WICComponentEnumerateDisabled"]:=0x80000000
,_["WICComponentEnumerateUnsigned"]:=0x40000000
,_["WICComponentEnumerateBuiltInOnly"]:=0x20000000
,_["WICCOMPONENTENUMERATEOPTIONS_FORCE_DWORD"]:=0x7fffffff
,_["WICBitmapInterpolationModeNearestNeighbor"]:=0
,_["WICBitmapInterpolationModeLinear"]:=0x1
_["WICBitmapInterpolationModeCubic"]:=0x2
,_["WICBitmapInterpolationModeFant"]:=0x3
,_["WICBITMAPINTERPOLATIONMODE_FORCE_DWORD"]:=0x7fffffff
,_["WICBitmapPaletteTypeCustom"]:=0
,_["WICBitmapPaletteTypeMedianCut"]:=0x1
,_["WICBitmapPaletteTypeFixedBW"]:=0x2
,_["WICBitmapPaletteTypeFixedHalftone8"]:=0x3
,_["WICBitmapPaletteTypeFixedHalftone27"]:=0x4
,_["WICBitmapPaletteTypeFixedHalftone64"]:=0x5
,_["WICBitmapPaletteTypeFixedHalftone125"]:=0x6
_["WICBitmapPaletteTypeFixedHalftone216"]:=0x7
,_["WICBitmapPaletteTypeFixedWebPalette"]:=WICBitmapPaletteTypeFixedHalftone216
,_["WICBitmapPaletteTypeFixedHalftone252"]:=0x8
,_["WICBitmapPaletteTypeFixedHalftone256"]:=0x9
,_["WICBitmapPaletteTypeFixedGray4"]:=0xa
,_["WICBitmapPaletteTypeFixedGray16"]:=0xb
,_["WICBitmapPaletteTypeFixedGray256"]:=0xc
,_["WICBITMAPPALETTETYPE_FORCE_DWORD"]:=0x7fffffff
,_["WICBitmapDitherTypeNone"]:=0
,_["WICBitmapDitherTypeSolid"]:=0
_["WICBitmapDitherTypeOrdered4x4"]:=0x1
,_["WICBitmapDitherTypeOrdered8x8"]:=0x2
,_["WICBitmapDitherTypeOrdered16x16"]:=0x3
,_["WICBitmapDitherTypeSpiral4x4"]:=0x4
,_["WICBitmapDitherTypeSpiral8x8"]:=0x5
,_["WICBitmapDitherTypeDualSpiral4x4"]:=0x6
,_["WICBitmapDitherTypeDualSpiral8x8"]:=0x7
,_["WICBitmapDitherTypeErrorDiffusion"]:=0x8
,_["WICBITMAPDITHERTYPE_FORCE_DWORD"]:=0x7fffffff
,_["WICBitmapUseAlpha"]:=0
_["WICBitmapUsePremultipliedAlpha"]:=0x1
,_["WICBitmapIgnoreAlpha"]:=0x2
,_["WICBITMAPALPHACHANNELOPTIONS_FORCE_DWORD"]:=0x7fffffff
,_["WICBitmapTransformRotate0"]:=0
,_["WICBitmapTransformRotate90"]:=0x1
,_["WICBitmapTransformRotate180"]:=0x2
,_["WICBitmapTransformRotate270"]:=0x3
,_["WICBitmapTransformFlipHorizontal"]:=0x8
,_["WICBitmapTransformFlipVertical"]:=0x10
,_["WICBITMAPTRANSFORMOPTIONS_FORCE_DWORD"]:=0x7fffffff
_["WICBitmapLockRead"]:=0x1
,_["WICBitmapLockWrite"]:=0x2
,_["WICBITMAPLOCKFLAGS_FORCE_DWORD"]:=0x7fffffff
,_["WICBitmapDecoderCapabilitySameEncoder"]:=0x1
,_["WICBitmapDecoderCapabilityCanDecodeAllImages"]:=0x2
,_["WICBitmapDecoderCapabilityCanDecodeSomeImages"]:=0x4
,_["WICBitmapDecoderCapabilityCanEnumerateMetadata"]:=0x8
,_["WICBitmapDecoderCapabilityCanDecodeThumbnail"]:=0x10
,_["WICBITMAPDECODERCAPABILITIES_FORCE_DWORD"]:=0x7fffffff
,_["WICProgressOperationCopyPixels"]:=0x1
_["WICProgressOperationWritePixels"]:=0x2
,_["WICProgressOperationAll"]:=0xffff
,_["WICPROGRESSOPERATION_FORCE_DWORD"]:=0x7fffffff
,_["WICProgressNotificationBegin"]:=0x10000
,_["WICProgressNotificationEnd"]:=0x20000
,_["WICProgressNotificationFrequent"]:=0x40000
,_["WICProgressNotificationAll"]:=0xffff0000
,_["WICPROGRESSNOTIFICATION_FORCE_DWORD"]:=0x7fffffff
,_["WICComponentSigned"]:=0x1
,_["WICComponentUnsigned"]:=0x2
_["WICComponentSafe"]:=0x4
,_["WICComponentDisabled"]:=0x80000000
,_["WICCOMPONENTSIGNING_FORCE_DWORD"]:=0x7fffffff
,_["WICGifLogicalScreenSignature"]:=0x1
,_["WICGifLogicalScreenDescriptorWidth"]:=0x2
,_["WICGifLogicalScreenDescriptorHeight"]:=0x3
,_["WICGifLogicalScreenDescriptorGlobalColorTableFlag"]:=0x4
,_["WICGifLogicalScreenDescriptorColorResolution"]:=0x5
,_["WICGifLogicalScreenDescriptorSortFlag"]:=0x6
,_["WICGifLogicalScreenDescriptorGlobalColorTableSize"]:=0x7
_["WICGifLogicalScreenDescriptorBackgroundColorIndex"]:=0x8
,_["WICGifLogicalScreenDescriptorPixelAspectRatio"]:=0x9
,_["WICGifLogicalScreenDescriptorProperties_FORCE_DWORD"]:=0x7fffffff
,_["WICGifImageDescriptorLeft"]:=0x1
,_["WICGifImageDescriptorTop"]:=0x2
,_["WICGifImageDescriptorWidth"]:=0x3
,_["WICGifImageDescriptorHeight"]:=0x4
,_["WICGifImageDescriptorLocalColorTableFlag"]:=0x5
,_["WICGifImageDescriptorInterlaceFlag"]:=0x6
,_["WICGifImageDescriptorSortFlag"]:=0x7
_["WICGifImageDescriptorLocalColorTableSize"]:=0x8
,_["WICGifImageDescriptorProperties_FORCE_DWORD"]:=0x7fffffff
,_["WICGifGraphicControlExtensionDisposal"]:=0x1
,_["WICGifGraphicControlExtensionUserInputFlag"]:=0x2
,_["WICGifGraphicControlExtensionTransparencyFlag"]:=0x3
,_["WICGifGraphicControlExtensionDelay"]:=0x4
,_["WICGifGraphicControlExtensionTransparentColorIndex"]:=0x5
,_["WICGifGraphicControlExtensionProperties_FORCE_DWORD"]:=0x7fffffff
,_["WICGifApplicationExtensionApplication"]:=0x1
,_["WICGifApplicationExtensionData"]:=0x2
_["WICGifApplicationExtensionProperties_FORCE_DWORD"]:=0x7fffffff
,_["WICGifCommentExtensionText"]:=0x1
,_["WICGifCommentExtensionProperties_FORCE_DWORD"]:=0x7fffffff
,_["WICJpegCommentText"]:=0x1
,_["WICJpegCommentProperties_FORCE_DWORD"]:=0x7fffffff
,_["WICJpegLuminanceTable"]:=0x1
,_["WICJpegLuminanceProperties_FORCE_DWORD"]:=0x7fffffff
,_["WICJpegChrominanceTable"]:=0x1
,_["WICJpegChrominanceProperties_FORCE_DWORD"]:=0x7fffffff
,_["WIC8BIMIptcPString"]:=0
_["WIC8BIMIptcEmbeddedIPTC"]:=0x1
,_["WIC8BIMIptcProperties_FORCE_DWORD"]:=0x7fffffff
,_["WIC8BIMResolutionInfoPString"]:=0x1
,_["WIC8BIMResolutionInfoHResolution"]:=0x2
,_["WIC8BIMResolutionInfoHResolutionUnit"]:=0x3
,_["WIC8BIMResolutionInfoWidthUnit"]:=0x4
,_["WIC8BIMResolutionInfoVResolution"]:=0x5
,_["WIC8BIMResolutionInfoVResolutionUnit"]:=0x6
,_["WIC8BIMResolutionInfoHeightUnit"]:=0x7
,_["WIC8BIMResolutionInfoProperties_FORCE_DWORD"]:=0x7fffffff
_["WIC8BIMIptcDigestPString"]:=0x1
,_["WIC8BIMIptcDigestIptcDigest"]:=0x2
,_["WIC8BIMIptcDigestProperties_FORCE_DWORD"]:=0x7fffffff
,_["WICPngGamaGamma"]:=0x1
,_["WICPngGamaProperties_FORCE_DWORD"]:=0x7fffffff
,_["WICPngBkgdBackgroundColor"]:=0x1
,_["WICPngBkgdProperties_FORCE_DWORD"]:=0x7fffffff
,_["WICPngItxtKeyword"]:=0x1
,_["WICPngItxtCompressionFlag"]:=0x2
,_["WICPngItxtLanguageTag"]:=0x3
_["WICPngItxtTranslatedKeyword"]:=0x4
,_["WICPngItxtText"]:=0x5
,_["WICPngItxtProperties_FORCE_DWORD"]:=0x7fffffff
,_["WICPngChrmWhitePointX"]:=0x1
,_["WICPngChrmWhitePointY"]:=0x2
,_["WICPngChrmRedX"]:=0x3
,_["WICPngChrmRedY"]:=0x4
,_["WICPngChrmGreenX"]:=0x5
,_["WICPngChrmGreenY"]:=0x6
,_["WICPngChrmBlueX"]:=0x7
_["WICPngChrmBlueY"]:=0x8
,_["WICPngChrmProperties_FORCE_DWORD"]:=0x7fffffff
,_["WICPngHistFrequencies"]:=0x1
,_["WICPngHistProperties_FORCE_DWORD"]:=0x7fffffff
,_["WICPngIccpProfileName"]:=0x1
,_["WICPngIccpProfileData"]:=0x2
,_["WICPngIccpProperties_FORCE_DWORD"]:=0x7fffffff
,_["WICPngSrgbRenderingIntent"]:=0x1
,_["WICPngSrgbProperties_FORCE_DWORD"]:=0x7fffffff
,_["WICPngTimeYear"]:=0x1
_["WICPngTimeMonth"]:=0x2
,_["WICPngTimeDay"]:=0x3
,_["WICPngTimeHour"]:=0x4
,_["WICPngTimeMinute"]:=0x5
,_["WICPngTimeSecond"]:=0x6
,_["WICPngTimeProperties_FORCE_DWORD"]:=0x7fffffff
,_["WICSectionAccessLevelRead"]:=0x1
,_["WICSectionAccessLevelReadWrite"]:=0x3
,_["WICSectionAccessLevel_FORCE_DWORD"]:=0x7fffffff
,_["WICPixelFormatNumericRepresentationUnspecified"]:=0
_["WICPixelFormatNumericRepresentationIndexed"]:=0x1
,_["WICPixelFormatNumericRepresentationUnsignedInteger"]:=0x2