-
Notifications
You must be signed in to change notification settings - Fork 3
/
uwmf_print.c
1635 lines (1500 loc) · 70.5 KB
/
uwmf_print.c
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
/**
@file uwmf_print.c
@brief Functions for printing WMF records
*/
/*
File: uwmf_print.c
Version: 0.0.6
Date: 21-MAY-2015
Author: David Mathog, Biology Division, Caltech
email: [email protected]
Copyright: 2015 David Mathog and California Institute of Technology (Caltech)
*/
#ifdef __cplusplus
extern "C" {
#endif
#include <stdlib.h>
#include <stdio.h>
#include <stddef.h> /* for offsetof() macro */
#include <string.h>
#include "uwmf_print.h"
//! \cond
#define UNUSED(x) (void)(x)
/* **********************************************************************************************
These functions print standard objects used in the WMR records.
The low level ones do not append EOL.
*********************************************************************************************** */
/* many of these are implemented in uemf_print.c and not replicated here */
/**
\brief Print a U_BRUSH object.
\param b U_BRUSH object.
style bColor bHatch
U_BS_SOLID ColorRef Object Not used (bytes present???)
U_BS_NULL ignored ignored (bytes present???).
U_BS_PATTERN ignored Bitmap16 object holding patern
U_BS_DIBPATTERNPT ColorUsage Enum DIB object
U_BS_HATCHED ColorRef Object HatchStyle Enumeration
*/
void brush_print(
U_BRUSH b
){
uint16_t hatch;
U_COLORREF Color;
switch(b.Style){
case U_BS_SOLID:
memcpy(&Color, &b.Color, sizeof(U_COLORREF));
printf("Color:"); colorref_print(Color);
break;
case U_BS_NULL:
printf("Null");
break;
case U_BS_PATTERN:
printf("Pattern:(not shown)");
break;
case U_BS_DIBPATTERNPT:
printf("DIBPattern:(not shown)");
break;
case U_BS_HATCHED:
memcpy(&hatch, b.Data, 2);
printf("Hatch:0x%4.4X ", hatch);
break;
}
}
/**
\brief Print a U_FONT object from a char *pointer.
The U_FONT struct object may not be properly aligned, but all of the fields within it will
OK for alignment.
\param font U_FONT object (as a char * pointer)
*/
void font_print(
const char *font
){
printf("Height:%d ", *(int16_t *)(font + offsetof(U_FONT,Height )));
printf("Width:%d ", *(int16_t *)(font + offsetof(U_FONT,Width )));
printf("Escapement:%d ", *(int16_t *)(font + offsetof(U_FONT,Escapement )));
printf("Orientation:%d ", *(int16_t *)(font + offsetof(U_FONT,Orientation )));
printf("Weight:%d ", *(int16_t *)(font + offsetof(U_FONT,Weight )));
printf("Italic:0x%2.2X ", *(uint8_t *)(font + offsetof(U_FONT,Italic )));
printf("Underline:0x%2.2X ", *(uint8_t *)(font + offsetof(U_FONT,Underline )));
printf("StrikeOut:0x%2.2X ", *(uint8_t *)(font + offsetof(U_FONT,StrikeOut )));
printf("CharSet:0x%2.2X ", *(uint8_t *)(font + offsetof(U_FONT,CharSet )));
printf("OutPrecision:0x%2.2X ", *(uint8_t *)(font + offsetof(U_FONT,OutPrecision )));
printf("ClipPrecision:0x%2.2X ", *(uint8_t *)(font + offsetof(U_FONT,ClipPrecision )));
printf("Quality:0x%2.2X ", *(uint8_t *)(font + offsetof(U_FONT,Quality )));
printf("PitchAndFamily:0x%2.2X ", *(uint8_t *)(font + offsetof(U_FONT,PitchAndFamily)));
printf("FaceName:%s ", (font + offsetof(U_FONT,FaceName )));
}
/**
\brief Print a U_PLTNTRY object.
\param pny U_PLTNTRY object.
*/
void pltntry_print(
U_PLTNTRY pny
){
printf("Value:%u ", pny.Value);
printf("Red:%u ", pny.Red );
printf("Green:%u ", pny.Green);
printf("Blue:%u ", pny.Blue );
}
/**
\brief Print a pointer to a U_PALETTE object.
\param p Pointer to a U_PALETTE object
\param PalEntries Array of Palette Entries
*/
void palette_print(
const U_PALETTE *p,
const char *PalEntries
){
int i;
U_PLTNTRY pny;
printf("Start:%X ", p->Start );
printf("NumEntries:%u ",p->NumEntries );
if(p->NumEntries && PalEntries){
for(i=0; i < p->NumEntries; i++, PalEntries += sizeof(U_PLTNTRY)){
memcpy(&pny, PalEntries, sizeof(U_PLTNTRY));
printf("%d:",i); pltntry_print(pny);
}
}
}
/**
\brief Print a U_PEN object.
\param p U_PEN object
uint16_t Style; //!< PenStyle Enumeration
uint16_t Width; //!< Pen Width in object dimensions
uint16_t unused; //!< unused
union {
U_COLORREF Color; //!< Pen color (NOT aligned on 4n byte boundary!)
uint16_t Colorw[2]; //!< reassemble/store the Color value using these, NOT Color.
};
*/
void pen_print(
U_PEN p
){
U_COLORREF Color;
printf("Style:0x%8.8X " ,p.Style );
printf("Width:%u " ,p.Widthw[0] );
memcpy(&Color, &p.Color, sizeof(U_COLORREF));
printf("Color"); colorref_print(Color);
}
/**
\brief Print U_RECT16 object
Prints in order left, top, right, bottom
\param rect U_RECT16 object
*/
void rect16_ltrb_print(
U_RECT16 rect
){
printf("LTRB{%d,%d,%d,%d} ",rect.left,rect.top,rect.right,rect.bottom);
}
/**
\brief Print U_RECT16 object
Some WMF rects use the order bottom, right, top, left. These are passed in using
the same structure as for a normal U_RECT16 so:
position holds
left bottom
top right
right top
bottom left
This is used by WMR_RECTANGLE and many others.
\param rect U_RECT16 object
*/
void rect16_brtl_print(
U_RECT16 rect
){
printf("BRTL{%d,%d,%d,%d} ",rect.bottom,rect.right,rect.top,rect.left);
}
/**
\brief Print U_REGION object from a char * pointer.
\param region U_REGION object
*/
void region_print(
const char *region
){
U_RECT16 rect16;
printf("Type:%d ", *(uint16_t *)(region + offsetof(U_REGION,Type )));
printf("Size:%d ", *( int16_t *)(region + offsetof(U_REGION,Size )));
printf("sCount:%d ",*( int16_t *)(region + offsetof(U_REGION,sCount)));
printf("sMax:%d ", *( int16_t *)(region + offsetof(U_REGION,sMax )));
memcpy(&rect16, (region + offsetof(U_REGION,sRect )), sizeof(U_RECT16));
printf("sRect: "); rect16_ltrb_print(rect16);
}
/**
\brief Print U_BITMAP16 object
\param b U_BITMAP16 object
*/
void bitmap16_print(
U_BITMAP16 b
){
printf("Type:%d ", b.Type );
printf("Width:%d ", b.Width );
printf("Height:%d ", b.Height );
printf("WidthBytes:%d ", b.WidthBytes);
printf("Planes:%d ", b.Planes );
printf("BitsPixel:%d ", b.BitsPixel );
printf("BitsBytes:%d ", (((b.Width * b.BitsPixel + 15) >> 4) << 1) * b.Height );
}
/**
\brief Print U_BITMAPCOREHEADER object
\param ch U_BITMAPCOREHEADER object
*/
void bitmapcoreheader_print(
U_BITMAPCOREHEADER ch
){
uint32_t Size;
memcpy(&Size, &(ch.Size_4), 4); /* will be aligned, but is in two pieces */
printf("Size:%d ", Size);
printf("Width:%d ", ch.Width);
printf("Height:%d ", ch.Height);
printf("Planes:%d ", ch.Planes);
printf("BitCount:%d ", ch.BitCount);
}
/** LogBrushW Object WMF PDF 2.2.2.10
\brief Print a U_LOGBRUSHW object.
\param lb U_LOGBRUSHW object.
style Color Hatch
U_BS_SOLID ColorRef Object Not used (bytes present???)
U_BS_NULL ignored ignored (bytes present???).
U_BS_PATTERN ignored not used (Action is not strictly defined)
U_BS_DIBPATTERN ignored not used (Action is not strictly defined)
U_BS_DIBPATTERNPT ignored not used (Action is not strictly defined)
U_BS_HATCHED ColorRef Object HatchStyle Enumeration
*/
void wlogbrush_print(
const char *lb
){
U_COLORREF Color;
uint16_t Style = *(uint16_t *)(lb + offsetof(U_WLOGBRUSH,Style));
uint16_t Hatch = *(uint16_t *)(lb + offsetof(U_WLOGBRUSH,Hatch));
memcpy(&Color, lb + offsetof(U_WLOGBRUSH,Color), sizeof(U_COLORREF));
printf("Style:0x%4.4X ",Style);
switch(Style){
case U_BS_SOLID:
printf("Color:"); colorref_print(Color);
break;
case U_BS_NULL:
printf("Null");
break;
case U_BS_PATTERN:
printf("Pattern:(not implemented)");
break;
case U_BS_DIBPATTERN:
printf("DIBPattern:(not implemented)");
break;
case U_BS_DIBPATTERNPT:
printf("DIBPatternPt:(not implemented)");
break;
case U_BS_HATCHED:
printf("Color:"); colorref_print(Color);
printf("Hatch:0x%4.4X ", Hatch);
break;
}
}
/**
\brief Print U_POLYPOLY object from pointer
\param nPolys Number of elements in aPolyCounts
\param aPolyCounts Number of points in each poly (sequential)
\param Points pointer to array of U_POINT16 in memory. Probably not aligned.
*/
void polypolygon_print(
uint16_t nPolys,
const uint16_t *aPolyCounts,
const char *Points
){
int i,j;
U_POINT16 pt;
for(i=0; i<nPolys; i++, aPolyCounts++){
printf(" Polygon[%d]: ",i);
for(j=0; j < *aPolyCounts; j++, Points += sizeof(U_POINT16)){
memcpy(&pt, Points, sizeof(U_POINT16)); /* may not be aligned */
point16_print(pt);
}
}
}
/**
\brief Print U_SCAN object
\param sc U_SCAN object
*/
void scan_print(
U_SCAN sc
){
printf("Count:%d ", sc.count);
printf("Top:%d ", sc.top);
printf("Bottom:%d ", sc.bottom);
printf("data:(not shown)");
}
/**
\brief Print a summary of a DIB header
\param dh void pointer to DIB header
A DIB header in an WMF may be either a BitmapCoreHeader or BitmapInfoHeader.
*/
void dibheader_print(const char *dh, const char *blimit){
uint32_t Size;
memcpy(&Size, dh, 4); /* may not be aligned */
if(Size == 0xC ){
printf("(BitmapCoreHeader) ");
U_BITMAPCOREHEADER bmch;
memcpy(&bmch, dh, sizeof(U_BITMAPCOREHEADER)); /* may not be aligned */
bitmapcoreheader_print(bmch);
}
else {
printf(" (BitmapInfoHeader) ");
bitmapinfo_print(dh, blimit); /* may not be aligned, called routine must handle it */
}
}
/**
\brief Print WMF header object
\returns size of entire header structure
\param contents pointer to the first byte in the buffer holding the entire WMF file in memory
\param blimit pointer to the byte after the last byte in contents
If the header is preceded by a placeable struture, print that as well.
*/
int wmfheader_print(
const char *contents,
const char *blimit
){
U_WMRPLACEABLE Placeable;
U_WMRHEADER Header;
int size = wmfheader_get(contents, blimit, &Placeable, &Header);
uint32_t utmp4;
U_RECT16 rect16;
uint32_t Key;
memcpy(&Key, contents + offsetof(U_WMRPLACEABLE,Key), 4);
if(Placeable.Key == 0x9AC6CDD7){
printf("WMF, Placeable: ");
printf("HWmf:%u ", Placeable.HWmf);
memcpy(&rect16, &(Placeable.Dst), sizeof(U_RECT16));
printf("Box:"); rect16_ltrb_print(rect16);
printf("Inch:%u ", Placeable.Inch);
printf("Checksum:%d ", Placeable.Checksum);
printf("Calculated_Checksum:%d\n",U_16_checksum((int16_t *)contents,10));
}
else {
printf("WMF, Not Placeable\n");
}
printf(" RecType:%d\n", Header.iType);
printf(" 16bit words in record:%d\n", Header.Size16w);
printf(" Version:%d\n", Header.version);
memcpy(&utmp4, &(Header.Sizew),4);
printf(" 16bit words in file:%d\n",utmp4);
printf(" Objects:%d\n", Header.nObjects);
memcpy(&utmp4, &(Header.maxSize),4);
printf(" Largest Record:%d\n", utmp4);
printf(" nMembers:%d\n", Header.nMembers);
return(size);
}
/* **********************************************************************************************
These functions contain shared code used by various U_WMR*_print functions. These should NEVER be called
by end user code and to further that end prototypes are NOT provided and they are hidden from Doxygen.
*********************************************************************************************** */
void wcore_points_print(uint16_t nPoints, const char *aPoints){
int i;
U_POINT16 pt;
printf(" Points: ");
for(i=0;i<nPoints; i++){
memcpy(&pt, aPoints + i*4, sizeof(U_POINT16)); /* aPoints U_POINT16 structure may not be aligned, so copy it out */
printf("[%d]:",i); point16_print(pt);
}
printf("\n");
}
/* **********************************************************************************************
These are the core WMR functions, each creates a particular type of record.
All return these records via a char* pointer, which is NULL if the call failed.
They are listed in order by the corresponding U_WMR_* index number.
*********************************************************************************************** */
/**
\brief Print a pointer to a U_WMR_whatever record which has not been implemented.
\param contents pointer to a buffer holding a WMR record
*/
void U_WMRNOTIMPLEMENTED_print(const char *contents){
UNUSED(contents);
printf(" Not Implemented!\n");
}
void U_WMREOF_print(const char *contents){
UNUSED(contents);
}
void U_WMRSETBKCOLOR_print(const char *contents){
U_COLORREF Color;
int size = U_WMRSETBKCOLOR_get(contents, &Color);
if(size>0){
printf(" %-15s ","Color:"); colorref_print(Color); printf("\n");
}
}
void U_WMRSETBKMODE_print(const char *contents){
uint16_t iMode;
int size = U_WMRSETBKMODE_get(contents, &iMode);
if(size>0){
printf(" %-15s 0x%4.4X\n","iMode:", iMode);
}
}
void U_WMRSETMAPMODE_print(const char *contents){
uint16_t iMode;
int size = U_WMRSETMAPMODE_get(contents, &iMode);
if(size>0){
printf(" %-15s 0x%4.4X\n","iMode:", iMode);
}
}
void U_WMRSETROP2_print(const char *contents){
uint16_t iMode;
int size = U_WMRSETROP2_get(contents, &iMode);
if(size>0){
printf(" %-15s 0x%4.4X\n","iMode:", iMode);
}
}
void U_WMRSETRELABS_print(const char *contents){
UNUSED(contents);
/* This record type has only the common 6 bytes, so nothing (else) to print */
}
void U_WMRSETPOLYFILLMODE_print(const char *contents){
uint16_t iMode;
int size = U_WMRSETPOLYFILLMODE_get(contents, &iMode);
if(size>0){
printf(" %-15s 0x%4.4X\n","iMode:", iMode);
}
}
void U_WMRSETSTRETCHBLTMODE_print(const char *contents){
uint16_t iMode;
int size = U_WMRSETSTRETCHBLTMODE_get(contents, &iMode);
if(size>0){
printf(" %-15s 0x%4.4X\n","iMode:", iMode);
}
}
void U_WMRSETTEXTCHAREXTRA_print(const char *contents){
uint16_t iMode;
int size = U_WMRSETTEXTCHAREXTRA_get(contents, &iMode);
if(size>0){
printf(" %-15s 0x%4.4X\n","iMode:", iMode);
}
}
void U_WMRSETTEXTCOLOR_print(const char *contents){
U_COLORREF Color;
int size = U_WMRSETTEXTCOLOR_get(contents, &Color);
if(size>0){
printf(" %-15s ","Color:"); colorref_print(Color); printf("\n");
}
}
void U_WMRSETTEXTJUSTIFICATION_print(const char *contents){
uint16_t Count;
uint16_t Extra;
int size = U_WMRSETTEXTJUSTIFICATION_get(contents, &Count, &Extra);
if(size){
printf(" %-15s %d\n","Count", Count);
printf(" %-15s %d\n","Extra", Extra);
}
}
void U_WMRSETWINDOWORG_print(const char *contents){
U_POINT16 coord;
int size = U_WMRSETWINDOWORG_get(contents, &coord);
if(size){
printf(" %-15s {%d,%d}\n","X,Y",coord.x, coord.y);
}
}
void U_WMRSETWINDOWEXT_print(const char *contents){
U_POINT16 coord;
int size = U_WMRSETWINDOWEXT_get(contents, &coord);
if(size){
printf(" %-15s {%d,%d}\n","W,H",coord.x, coord.y);
}
}
void U_WMRSETVIEWPORTORG_print(const char *contents){
U_POINT16 coord;
int size = U_WMRSETVIEWPORTORG_get(contents, &coord);
if(size){
printf(" %-15s {%d,%d}\n","X,Y",coord.x, coord.y);
}
}
void U_WMRSETVIEWPORTEXT_print(const char *contents){
U_POINT16 coord;
int size = U_WMRSETVIEWPORTEXT_get(contents, &coord);
if(size){
printf(" %-15s {%d,%d}\n","W,H",coord.x, coord.y);
}
}
void U_WMROFFSETWINDOWORG_print(const char *contents){
U_POINT16 coord;
int size = U_WMROFFSETWINDOWORG_get(contents, &coord);
if(size){
printf(" %-15s {%d,%d}\n","X,Y",coord.x, coord.y);
}
}
void U_WMRSCALEWINDOWEXT_print(const char *contents){
U_POINT16 Denom, Num;
int size = U_WMRSCALEWINDOWEXT_get(contents, &Denom, &Num);
if(size > 0){
printf(" yDenom:%d\n", Denom.y);
printf(" yNum:%d\n", Num.y );
printf(" xDenom:%d\n", Denom.x);
printf(" xNum:%d\n", Num.x );
}
}
void U_WMROFFSETVIEWPORTORG_print(const char *contents){
U_POINT16 coord;
int size = U_WMROFFSETVIEWPORTORG_get(contents, &coord);
if(size){
printf(" %-15s {%d,%d}\n","X,Y",coord.x, coord.y);
}
}
void U_WMRSCALEVIEWPORTEXT_print(const char *contents){
U_POINT16 Denom, Num;
int size = U_WMRSCALEVIEWPORTEXT_get(contents, &Denom, &Num);
if(size > 0){
printf(" yDenom:%d\n", Denom.y);
printf(" yNum:%d\n", Num.y );
printf(" xDenom:%d\n", Denom.x);
printf(" xNum:%d\n", Num.x );
}
}
void U_WMRLINETO_print(const char *contents){
U_POINT16 coord;
int size = U_WMRLINETO_get(contents, &coord);
if(size){
printf(" %-15s {%d,%d}\n","X,Y",coord.x, coord.y);
}
}
void U_WMRMOVETO_print(const char *contents){
U_POINT16 coord;
int size = U_WMRMOVETO_get(contents, &coord);
if(size > 0){
printf(" %-15s {%d,%d}\n","X,Y",coord.x, coord.y);
}
}
void U_WMREXCLUDECLIPRECT_print(const char *contents){
U_RECT16 rect16;
int size = U_WMREXCLUDECLIPRECT_get(contents, &rect16);
if(size > 0){
printf(" Rect:");
rect16_ltrb_print(rect16);
printf("\n");
}
}
void U_WMRINTERSECTCLIPRECT_print(const char *contents){
U_RECT16 rect16;
int size = U_WMRINTERSECTCLIPRECT_get(contents, &rect16);
if(size > 0){
printf(" Rect:");
rect16_ltrb_print(rect16);
printf("\n");
}
}
void U_WMRARC_print(const char *contents){
U_POINT16 StartArc, EndArc;
U_RECT16 rect16;
int size = U_WMRARC_get(contents, &StartArc, &EndArc, &rect16);
if(size > 0){
printf(" yRadial2:%d\n", EndArc.y);
printf(" xRadial2:%d\n", EndArc.x);
printf(" yRadial1:%d\n", StartArc.y);
printf(" xRadial1:%d\n", StartArc.x);
printf(" Rect:"); rect16_ltrb_print(rect16); printf("\n");
}
}
void U_WMRELLIPSE_print(const char *contents){
U_RECT16 rect16;
int size = U_WMRELLIPSE_get(contents, &rect16);
if(size > 0){
printf(" Rect:");
rect16_ltrb_print(rect16);
printf("\n");
}
}
void U_WMRFLOODFILL_print(const char *contents){
uint16_t Mode;
U_COLORREF Color;
U_POINT16 coord;
int size = U_WMRFLOODFILL_get(contents, &Mode, &Color, &coord);
if(size > 0){
printf(" Mode 0x%4.4X\n", Mode);
printf(" Color:"); colorref_print(Color); printf("\n");
printf(" X,Y {%d,%d}\n", coord.x, coord.y);
}
}
void U_WMRPIE_print(const char *contents){
U_POINT16 StartArc, EndArc;
U_RECT16 rect16;
int size = U_WMRPIE_get(contents, &StartArc, &EndArc, &rect16);
if(size > 0){
printf(" yRadial2:%d\n", EndArc.y);
printf(" xRadial2:%d\n", EndArc.x);
printf(" yRadial1:%d\n", StartArc.y);
printf(" xRadial1:%d\n", StartArc.x);
printf(" Rect:"); rect16_ltrb_print(rect16); printf("\n");
}
}
void U_WMRRECTANGLE_print(const char *contents){
U_RECT16 rect16;
int size = U_WMRRECTANGLE_get(contents, &rect16);
if(size > 0){
printf(" Rect:");
rect16_ltrb_print(rect16);
printf("\n");
}
}
void U_WMRROUNDRECT_print(const char *contents){
int16_t Height, Width;
U_RECT16 rect16;
int size = U_WMRROUNDRECT_get(contents, &Width, &Height, &rect16);
if(size > 0){
printf(" Width:%d\n", Width);
printf(" Height:%d\n", Height);
printf(" Rect:");
rect16_ltrb_print(rect16);
printf("\n");
}
}
void U_WMRPATBLT_print(const char *contents){
uint32_t dwRop3;
U_POINT16 Dst;
U_POINT16 cwh;
int size = U_WMRPATBLT_get(contents, &Dst, &cwh, &dwRop3);
if(size > 0){
printf(" Rop3:%8.8X\n", dwRop3 );
printf(" W,H:%d,%d\n", cwh.x, cwh.y );
printf(" Dst X,Y:{%d,%d}\n", Dst.x, Dst.y );
}
}
void U_WMRSAVEDC_print(const char *contents){
UNUSED(contents);
/* This record type has only the common 6 bytes, so nothing (else) to print */
}
void U_WMRSETPIXEL_print(const char *contents){
U_COLORREF Color;
U_POINT16 coord;
int size = U_WMRSETPIXEL_get(contents, &Color, &coord);
if(size > 0){
printf(" Color:"); colorref_print(Color); printf("\n");
printf(" X,Y {%d,%d}\n", coord.x, coord.y);
}
}
void U_WMROFFSETCLIPRGN_print(const char *contents){
U_POINT16 coord;
int size = U_WMROFFSETCLIPRGN_get(contents, &coord);
if(size > 0){
printf(" %-15s {%d,%d}\n","X,Y",coord.x, coord.y);
}
}
void U_WMRTEXTOUT_print(const char *contents){
int16_t Length;
const char *string;
U_POINT16 Dst;
int size = U_WMRTEXTOUT_get(contents, &Dst, &Length, &string);
if(size > 0){
printf(" X,Y:{%d,%d}\n", Dst.x,Dst.y);
printf(" Length:%d\n", Length);
printf(" String:<%.*s>\n", Length, string); /* May not be null terminated */
}
}
void U_WMRBITBLT_print(const char *contents){
uint32_t dwRop3;
U_POINT16 Dst, Src, cwh;
U_BITMAP16 Bm16;
const char *px;
int size = U_WMRBITBLT_get(contents, &Dst, &cwh, &Src, &dwRop3, &Bm16, &px);
if(size > 0){
printf(" Rop3:%8.8X\n", dwRop3 );
printf(" Src X,Y:{%d,%d}\n", Src.x, Src.y);
printf(" W,H:%d,%d\n", cwh.x, cwh.y);
printf(" Dst X,Y:{%d,%d}\n", Dst.x, Dst.y);
if(px){ printf(" Bitmap16:"); bitmap16_print(Bm16); printf("\n"); }
else { printf(" Bitmap16: none\n"); }
}
}
void U_WMRSTRETCHBLT_print(const char *contents){
uint32_t dwRop3;
U_POINT16 Dst, Src, cDst, cSrc;
U_BITMAP16 Bm16;
const char *px;
int size = U_WMRSTRETCHBLT_get(contents, &Dst, &cDst, &Src, &cSrc, &dwRop3, &Bm16, &px);
if(size > 0){
printf(" Rop3:%8.8X\n", dwRop3 );
printf(" Src W,H:%d,%d\n", cSrc.x, cSrc.y);
printf(" Src X,Y:{%d,%d}\n", Src.x, Src.y );
printf(" Dst W,H:%d,%d\n", cDst.x, cDst.y);
printf(" Dst X,Y:{%d,%d}\n", Dst.x, Dst.y );
if(px){ printf(" Bitmap16:"); bitmap16_print(Bm16); printf("\n"); }
else { printf(" Bitmap16: none\n"); }
}
}
void U_WMRPOLYGON_print(const char *contents){
uint16_t Length;
const char *Data;
int size = U_WMRPOLYGON_get(contents, &Length, &Data);
if(size > 0){
wcore_points_print(Length, Data);
}
}
void U_WMRPOLYLINE_print(const char *contents){
uint16_t Length;
const char *Data;
int size = U_WMRPOLYLINE_get(contents, &Length, &Data);
if(size > 0){
wcore_points_print(Length, Data);
}
}
void U_WMRESCAPE_print(const char *contents){
uint32_t utmp4;
uint16_t Escape;
uint16_t Length;
const char *Data;
int size = U_WMRESCAPE_get(contents, &Escape, &Length, &Data);
if(size > 0){
printf(" EscType:%s\n",U_wmr_escnames(Escape));
printf(" nBytes:%d\n",Length);
if((Escape == U_MFE_SETLINECAP) || (Escape == U_MFE_SETLINEJOIN) || (Escape == U_MFE_SETMITERLIMIT)){
memcpy(&utmp4, Data ,4);
printf(" Data:%d\n", utmp4);
}
else {
printf(" Data: (not shown)\n");
}
}
}
void U_WMRRESTOREDC_print(const char *contents){
UNUSED(contents);
/* This record type has only the common 6 bytes, so nothing (else) to print */
}
void U_WMRFILLREGION_print(const char *contents){
uint16_t Region;
uint16_t Brush;
int size = U_WMRFILLREGION_get(contents, &Region, &Brush);
if(size > 0){
printf(" %-15s %d\n","Region", Region);
printf(" %-15s %d\n","Brush", Brush);
}
}
void U_WMRFRAMEREGION_print(const char *contents){
uint16_t Region;
uint16_t Brush;
int16_t Height;
int16_t Width;
int size = U_WMRFRAMEREGION_get(contents, &Region, &Brush, &Height, &Width);
if(size > 0){
printf(" Region:%d\n",Region);
printf(" Brush:%d\n", Brush );
printf(" Height:%d\n",Height);
printf(" Width:%d\n", Width );
}
}
void U_WMRINVERTREGION_print(const char *contents){
uint16_t Region;
int size = U_WMRSETTEXTALIGN_get(contents, &Region);
if(size > 0){
printf(" %-15s %d\n","Region:", Region);
}
}
void U_WMRPAINTREGION_print(const char *contents){
uint16_t Region;
int size = U_WMRPAINTREGION_get(contents, &Region);
if(size>0){
printf(" %-15s %d\n","Region:", Region);
}
}
void U_WMRSELECTCLIPREGION_print(const char *contents){
uint16_t Region;
int size = U_WMRSELECTCLIPREGION_get(contents, &Region);
if(size>0){
printf(" %-15s %d\n","Region:", Region);
}
}
void U_WMRSELECTOBJECT_print(const char *contents){
uint16_t Object;
int size = U_WMRSELECTOBJECT_get(contents, &Object);
if(size>0){
printf(" %-15s %d\n","Object:", Object);
}
}
void U_WMRSETTEXTALIGN_print(const char *contents){
uint16_t iMode;
int size = U_WMRSETTEXTALIGN_get(contents, &iMode);
if(size>0){
printf(" %-15s 0x%4.4X\n","iMode:", iMode);
}
}
#define U_WMRDRAWTEXT_print U_WMRNOTIMPLEMENTED_print
void U_WMRCHORD_print(const char *contents){
U_POINT16 StartArc, EndArc;
U_RECT16 rect16;
int size = U_WMRCHORD_get(contents, &StartArc, &EndArc, &rect16);
if(size > 0){
printf(" yRadial2:%d\n", EndArc.y);
printf(" xRadial2:%d\n", EndArc.x);
printf(" yRadial1:%d\n", StartArc.y);
printf(" xRadial1:%d\n", StartArc.x);
printf(" Rect:"); rect16_ltrb_print(rect16); printf("\n");
}
}
void U_WMRSETMAPPERFLAGS_print(const char *contents){
uint32_t Flags4;
int size = U_WMRSETMAPPERFLAGS_get(contents, &Flags4);
if(size > 0){
printf(" %-15s 0x%8.8X\n","Flags4:", Flags4);
}
}
void U_WMREXTTEXTOUT_print(const char *contents){
U_RECT16 rect16;
U_POINT16 Dst;
int16_t Length;
uint16_t Opts;
const int16_t *dx;
const char *string;
int i;
int size = U_WMREXTTEXTOUT_get(contents, &Dst, &Length, &Opts, &string, &dx, &rect16);
if(size > 0){
printf(" X,Y:{%d,%d}\n", Dst.x, Dst.y);
printf(" Length:%d\n", Length );
printf(" Opts:%4.4X\n", Opts );
if(Opts & (U_ETO_OPAQUE | U_ETO_CLIPPED)){
printf(" Rect:"); rect16_ltrb_print(rect16); printf("\n");
}
printf(" String:<%.*s>\n",Length, string);
printf(" Dx:");
for(i=0; i<Length; i++,dx++){ printf("%d:", *dx ); }
printf("\n");
}
}
void U_WMRSETDIBTODEV_print(const char *contents){
uint16_t cUsage;
uint16_t ScanCount;
uint16_t StartScan;
U_POINT16 Dst;
U_POINT16 cwh;
U_POINT16 Src;
const char *dib;
int size = U_WMRSETDIBTODEV_get(contents, &Dst, &cwh, &Src, &cUsage, &ScanCount, &StartScan, &dib);
if(size > 0){
printf(" cUsage:%d\n", cUsage );
printf(" ScanCount:%d\n", ScanCount );
printf(" StartScan:%d\n", StartScan );
printf(" Src X,Y:{%d,%d}\n", Src.x, Src.y );
printf(" W,H:%d,%d\n", cwh.x, cwh.y );
printf(" Dst X,Y:{%d,%d}\n", Dst.x, Dst.y );
printf(" DIB:"); dibheader_print(dib, dib+size); printf("\n");
}
}
void U_WMRSELECTPALETTE_print(const char *contents){
uint16_t Palette;
int size = U_WMRSELECTPALETTE_get(contents, &Palette);
if(size > 0){
printf(" %-15s %d\n","Palette:", Palette);
}
}
void U_WMRREALIZEPALETTE_print(const char *contents){
UNUSED(contents);
/* This record type has only the common 6 bytes, so nothing (else) to print */
}
void U_WMRANIMATEPALETTE_print(const char *contents){
U_PALETTE Palette;
const char *PalEntries;
int size = U_WMRANIMATEPALETTE_get(contents, &Palette, &PalEntries);
if(size > 0){
printf(" Palette:"); palette_print(&Palette, PalEntries); printf("\n");
}
}
void U_WMRSETPALENTRIES_print(const char *contents){
U_PALETTE Palette;
const char *PalEntries;
int size = U_WMRSETPALENTRIES_get(contents, &Palette, &PalEntries);
if(size > 0){
printf(" Palette:"); palette_print(&Palette, PalEntries); printf("\n");
}
}
void U_WMRPOLYPOLYGON_print(const char *contents){
uint16_t nPolys;
const uint16_t *aPolyCounts;
const char *Points;
int size = U_WMRPOLYPOLYGON_get(contents, &nPolys, &aPolyCounts, &Points);
if(size > 0){
printf(" Polygons:"); polypolygon_print(nPolys, aPolyCounts, Points); printf("\n");
}
}
void U_WMRRESIZEPALETTE_print(const char *contents){
uint16_t Palette;
int size = U_WMRSELECTCLIPREGION_get(contents, &Palette);
if(size>0){
printf(" %-15s %d\n","Palette:", Palette);
}
}
#define U_WMR3A_print U_WMRNOTIMPLEMENTED_print
#define U_WMR3B_print U_WMRNOTIMPLEMENTED_print
#define U_WMR3C_print U_WMRNOTIMPLEMENTED_print
#define U_WMR3D_print U_WMRNOTIMPLEMENTED_print
#define U_WMR3E_print U_WMRNOTIMPLEMENTED_print
#define U_WMR3F_print U_WMRNOTIMPLEMENTED_print
void U_WMRDIBBITBLT_print(const char *contents){
U_POINT16 Dst, cwh, Src;
uint32_t dwRop3;
const char *dib;
int size = U_WMRDIBBITBLT_get(contents, &Dst, &cwh, &Src, &dwRop3, &dib);
if(size > 0){
printf(" Rop3:%8.8X\n", dwRop3 );
printf(" Src X,Y:{%d,%d}\n", Src.x, Src.x );
printf(" W,H:%d,%d\n", cwh.x, cwh.y );
printf(" Dst X,Y:{%d,%d}\n", Dst.x, Dst.y );
if(dib){ printf(" DIB:"); dibheader_print(dib, dib+size); printf("\n"); }
else { printf(" DIB: none\n"); }
}
}