-
Notifications
You must be signed in to change notification settings - Fork 3
/
uwmf_endian.c
1774 lines (1472 loc) · 64.2 KB
/
uwmf_endian.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_endian.c
@brief Functions for converting WMF records between Big Endian and Little Endian byte orders.
*/
/*
File: uwmf_endian.c
Version: 0.1.5
Date: 28-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() */
#include <string.h>
#include "uwmf.h"
#include "uwmf_endian.h"
// hide almost everything in this file from Doxygen
//! \cond
/* Prototypes for functions used here and defined in uemf_endian.c, but which are not supposed
to be used in end user code. */
void U_swap2(void *ul, unsigned int count);
void U_swap4(void *ul, unsigned int count);
void bitmapinfo_swap(char *Bmi);
/* **********************************************************************************************
These functions Swap standard objects used in the WMR records.
The low level ones do not append EOL.
*********************************************************************************************** */
/**
\brief Swap U_BITMAP16 object
\param b U_BITMAP16 object
*/
void bitmap16_swap(
char *b
){
U_swap2(b,4); /* Type, Width, Height, WidthBytes */
/* Planes and BitsPixel are bytes, so no swap needed */
/* Bits[] pixel data should already be in order */
}
/**
\brief Swap 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_swap(
char *b,
int torev
){
int Style;
if(torev){ Style = *(uint16_t *)(b + offsetof(U_BRUSH,Style)); }
U_swap2(b + offsetof(U_BRUSH,Style),1);
if(!torev){ Style = *(uint16_t *)(b + offsetof(U_BRUSH,Style)); }
/* Color is already in the right order */
switch(Style){
case U_BS_SOLID:
/* no/ignored data field */
break;
case U_BS_NULL:
/* no/ignored data field */
break;
case U_BS_PATTERN:
bitmap16_swap(b + offsetof(U_BRUSH,Data));
break;
case U_BS_DIBPATTERNPT:
bitmapinfo_swap(b + offsetof(U_BRUSH,Data));
break;
case U_BS_HATCHED:
/* no/ignored data field */
break;
}
}
/**
\brief Swap a U_FONT object from pointer.
\param lf U_FONT object
*/
void font_swap(
char *f
){
U_swap2(f + offsetof(U_FONT,Height),5); /*Height, Width, Escapement, Orientation, Weight */
/* Other fields are single bytes */
}
/**
\brief Swap a pointer to a U_PALETTE object.
\param lp Pointer to a U_PALETTE object.
*/
void palette_swap(
char *p
){
U_swap2(p + offsetof(U_PALETTE,Start),2); /* Start, NumEntries*/
/* PalEntries[1] is byte ordered, so no need to swap */
}
/**
\brief Swap a U_PEN object.
\param p U_PEN object
*/
void pen_swap(
char *p
){
U_swap2(p + offsetof(U_PEN,Style),3); /* Style,Widthw[0],Widthw[1] */
/* Color already in order */
}
/* there are no
void rect16_ltrb_swap()
void rect16_brtl_swap()
because rectangles are swapped using U_swap2 as an array of 4 int16 values.
*/
/**
\brief Swap U_REGION object
\param rect U_REGION object
\param torev
PARTIAL IMPLEMENTATION
*/
void region_swap(
char *reg,
int torev
){
int Size;
if(torev){ Size = *(int16_t *)(reg + offsetof(U_REGION,Size)); }
U_swap2(reg,10); /* ignore1 through sRrect*/
if(!torev){ Size = *(int16_t *)(reg + offsetof(U_REGION,Size)); }
U_swap2(reg + U_SIZE_REGION, (Size - U_SIZE_REGION)/2); /* aScans */
}
/**
\brief Swap U_BITMAPCOREHEADER object
\param ch U_BITMAPCOREHEADER object
*/
void bitmapcoreheader_swap(
char *ch
){
U_swap4(ch + offsetof(U_BITMAPCOREHEADER,Size_4), 1); /* Size_4, may not be aligned */
U_swap2(ch + offsetof(U_BITMAPCOREHEADER,Width),4); /* Width, Height, Planes, BitCount, */
}
/** LogBrushW Object WMF PDF 2.2.2.10
\brief Swap a U_WLOGBRUSH object.
\param lb U_WLOGBRUSH 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_swap(
char *lb
){
U_swap2(lb + offsetof(U_WLOGBRUSH,Style),1);
/* Color is already in order */
U_swap2(lb + offsetof(U_WLOGBRUSH,Hatch),1);
}
/**
\brief Swap U_POLYPOLY object from pointer
\param pp PU_POLYPOLY object
*/
void polypolygon_swap(
char *pp,
int torev
){
int i,totPoints;
uint16_t nPolys;
uint16_t *aPolyCounts;
if(torev){ nPolys = *(uint16_t *)(pp + offsetof(U_POLYPOLYGON, nPolys)); }
U_swap2(pp + offsetof(U_POLYPOLYGON, nPolys),1);
if(!torev){ nPolys = *(uint16_t *)(pp + offsetof(U_POLYPOLYGON, nPolys)); }
aPolyCounts = (uint16_t *)(pp + offsetof(U_POLYPOLYGON, aPolyCounts));
if(torev){
for(totPoints=0,i=0;i<nPolys; i++){ totPoints += aPolyCounts[i]; }
}
U_swap2(aPolyCounts,nPolys);
if(!torev){
for(totPoints=0,i=0;i<nPolys; i++){ totPoints += aPolyCounts[i]; }
}
U_swap2(&(aPolyCounts[nPolys]),2*totPoints); /* 2 coords/ point */
}
/**
\brief Swap U_SCAN object
\param pp U_SCAN object
*/
void scan_swap(
char *sc,
int torev
){
int count;
if(torev){ count = *(uint16_t *)sc; }
U_swap2(sc,3); /*count, top, bottom */
if(!torev){ count = *(uint16_t *)sc; }
U_swap2(sc + offsetof(U_SCAN,ScanLines),count);
}
/**
\brief Swap a summary of a DIB header
A DIB header in an WMF may be either a BitmapCoreHeader or BitmapInfoHeader.
\param dh void pointer to DIB header
*/
void dibheader_swap(
char *dh,
int torev
){
int Size;
memcpy(&Size, dh, 4); /* may not be aligned */
if(!torev)U_swap4(&Size,1);
if(Size == 0xC){
bitmapcoreheader_swap(dh);
}
else {
bitmapinfo_swap(dh);
}
}
/**
\brief Swap WMF header object
\param head uint8_t pointer to header
\returns size of entire header structure
If the header is preceded by a placeable struture, Swap that as well.
*/
int wmfheader_swap(
char *contents,
int torev
){
uint32_t Key,Size16w;
int size=0;
Key=*(uint32_t *)(contents + offsetof(U_WMRPLACEABLE,Key));
if(!torev)U_swap4(&Key,1);
if(Key == 0x9AC6CDD7){
U_swap4(contents + offsetof(U_WMRPLACEABLE,Key ),1);
U_swap2(contents + offsetof(U_WMRPLACEABLE,HWmf ),1);
U_swap2(contents + offsetof(U_WMRPLACEABLE,Dst ),4);
U_swap2(contents + offsetof(U_WMRPLACEABLE,Inch ),1);
U_swap4(contents + offsetof(U_WMRPLACEABLE,Reserved),1);
U_swap2(contents + offsetof(U_WMRPLACEABLE,Checksum),1);
contents += U_SIZE_WMRPLACEABLE;
size += U_SIZE_WMRPLACEABLE;
}
if(torev){ Size16w = *(uint16_t *)(contents + offsetof(U_WMRHEADER,Size16w)); }
U_swap2(contents + offsetof(U_WMRHEADER,Size16w),2);/* Size16w, Version */
if(!torev){ Size16w = *(uint16_t *)(contents + offsetof(U_WMRHEADER,Size16w)); }
U_swap4(contents + offsetof(U_WMRHEADER,Sizew ),1);/* Sizew */
U_swap2(contents + offsetof(U_WMRHEADER,nObjects),1);/* nObjects */
U_swap4(contents + offsetof(U_WMRHEADER,maxSize ),1);/* maxSize */
U_swap2(contents + offsetof(U_WMRHEADER,nMembers),1);/* nMembers */
size += 2*Size16w;
return(size);
}
/* **********************************************************************************************
These functions contain shared code used by various U_WMR*_Swap 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.
*********************************************************************************************** */
/* Size16 EVERY record type should call this, directly or indirectly*/
void U_WMRCORE_SIZE16_swap(char *record, int torev){
UNUSED_PARAMETER(torev);
U_swap4(record, 1); /* Size16_4 is at offset 0 in U_METARECORD */
}
/* Size16, move to data, Single 32bit followed by array of N16 U_POINT16 */
void U_WMRCORE_U32_N16_swap(char *record, int N16, int torev){
int off=U_SIZE_METARECORD;
U_WMRCORE_SIZE16_swap(record, torev);
U_swap4(record + off, 1); off+=4;
U_swap2(record + off, N16);
}
/* Single 16bit nPoints followed by array of nPoints U_POINT16 */
void U_WMRCORE_U16_N16_swap(char *record, int torev){
int nPoints;
U_WMRCORE_SIZE16_swap(record, torev);
if(torev){ nPoints = *(uint16_t *)(record + offsetof(U_WMRPOLYGON,nPoints)); }
U_swap2(record + offsetof(U_WMRPOLYGON,nPoints), 1);
if(!torev){ nPoints = *(uint16_t *)(record + offsetof(U_WMRPOLYGON,nPoints)); }
U_swap2(record + offsetof(U_WMRPOLYGON,aPoints), 2*nPoints);
}
/* all records that specify palette objects */
void U_WMRCORE_PALETTE_swap(char *record, int torev){
UNUSED_PARAMETER(torev);
U_WMRCORE_SIZE16_swap(record, torev);
palette_swap(record + offsetof(U_WMRANIMATEPALETTE,Palette));
}
/* all records that have N int16 values, unconditionally swapped */
void U_WMRCORE_N16_swap(char *record, int N16, int torev){
U_WMRCORE_SIZE16_swap(record, torev);
U_swap2(record+U_SIZE_METARECORD, N16);
}
/* like floodfill */
void U_WMRCORE_U16_CR_2U16_swap(char *record, int torev){
int off = U_SIZE_METARECORD;
U_WMRCORE_SIZE16_swap(record, torev);
U_swap2(record+off, 1); off += 2 + sizeof(U_COLORREF);
U_swap2(record+off, 2);
}
/* **********************************************************************************************
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_EMR_* index number.
*********************************************************************************************** */
/**
\brief Swap a pointer to a U_WMR_whatever record which has not been implemented.
\param name name of this type of record
\param contents pointer to a buffer holding all EMR records
\param recnum number of this record in contents
\param off offset to this record in contents
*/
void U_WMRNOTIMPLEMENTED_swap(char *record, int torev){
U_WMRCORE_SIZE16_swap(record, torev);
}
void U_WMREOF_swap(char *record, int torev){
U_WMRCORE_SIZE16_swap(record, torev);
}
void U_WMRSETBKCOLOR_swap(char *record, int torev){
U_WMRCORE_SIZE16_swap(record, torev);
}
void U_WMRSETBKMODE_swap(char *record, int torev){
U_WMRCORE_N16_swap(record,1,torev);
}
void U_WMRSETMAPMODE_swap(char *record, int torev){
U_WMRCORE_N16_swap(record,1,torev);
}
void U_WMRSETROP2_swap(char *record, int torev){
U_WMRCORE_N16_swap(record,1,torev);
}
void U_WMRSETRELABS_swap(char *record, int torev){
U_WMRCORE_SIZE16_swap(record, torev);
}
void U_WMRSETPOLYFILLMODE_swap(char *record, int torev){
U_WMRCORE_N16_swap(record,1,torev);
}
void U_WMRSETSTRETCHBLTMODE_swap(char *record, int torev){
U_WMRCORE_N16_swap(record,1,torev);
}
void U_WMRSETTEXTCHAREXTRA_swap(char *record, int torev){
U_WMRCORE_N16_swap(record,1,torev);
}
void U_WMRSETTEXTCOLOR_swap(char *record, int torev){
U_WMRCORE_SIZE16_swap(record, torev);
}
void U_WMRSETTEXTJUSTIFICATION_swap(char *record, int torev){
U_WMRCORE_N16_swap(record,2,torev);
}
void U_WMRSETWINDOWORG_swap(char *record, int torev){
U_WMRCORE_N16_swap(record,2,torev);
}
void U_WMRSETWINDOWEXT_swap(char *record, int torev){
U_WMRCORE_N16_swap(record,2,torev);
}
void U_WMRSETVIEWPORTORG_swap(char *record, int torev){
U_WMRCORE_N16_swap(record,2,torev);
}
void U_WMRSETVIEWPORTEXT_swap(char *record, int torev){
U_WMRCORE_N16_swap(record,2,torev);
}
void U_WMROFFSETWINDOWORG_swap(char *record, int torev){
U_WMRCORE_N16_swap(record,2,torev);
}
void U_WMRSCALEWINDOWEXT_swap(char *record, int torev){
U_WMRCORE_N16_swap(record,4,torev);
}
void U_WMROFFSETVIEWPORTORG_swap(char *record, int torev){
U_WMRCORE_N16_swap(record,2,torev);
}
void U_WMRSCALEVIEWPORTEXT_swap(char *record, int torev){
U_WMRCORE_N16_swap(record,4,torev);
}
void U_WMRLINETO_swap(char *record, int torev){
U_WMRCORE_N16_swap(record,2,torev);
}
void U_WMRMOVETO_swap(char *record, int torev){
U_WMRCORE_N16_swap(record,2,torev);
}
void U_WMREXCLUDECLIPRECT_swap(char *record, int torev){
U_WMRCORE_N16_swap(record,4,torev);
}
void U_WMRINTERSECTCLIPRECT_swap(char *record, int torev){
U_WMRCORE_N16_swap(record,4,torev);
}
void U_WMRARC_swap(char *record, int torev){
U_WMRCORE_N16_swap(record, 8, torev);
}
void U_WMRELLIPSE_swap(char *record, int torev){
U_WMRCORE_N16_swap(record,4,torev);
}
void U_WMRFLOODFILL_swap(char *record, int torev){
U_WMRCORE_U16_CR_2U16_swap(record, torev);
}
void U_WMRPIE_swap(char *record, int torev){
U_WMRCORE_N16_swap(record, 8, torev);
}
void U_WMRRECTANGLE_swap(char *record, int torev){
U_WMRCORE_N16_swap(record,4,torev);
}
void U_WMRROUNDRECT_swap(char *record, int torev){
U_WMRCORE_N16_swap(record,6,torev);
}
void U_WMRPATBLT_swap(char *record, int torev){
U_WMRCORE_U32_N16_swap(record,4,torev);
}
void U_WMRSAVEDC_swap(char *record, int torev){
U_WMRCORE_SIZE16_swap(record, torev);
}
void U_WMRSETPIXEL_swap(char *record, int torev){
int off = U_SIZE_METARECORD + sizeof(U_COLORREF);
U_WMRCORE_SIZE16_swap(record, torev);
U_swap2(record+off, 2);
}
void U_WMROFFSETCLIPRGN_swap(char *record, int torev){
U_WMRCORE_N16_swap(record,2,torev);
}
void U_WMRTEXTOUT_swap(char *record, int torev){
int L2;
if(torev){ L2 = *(int16_t *)(record + U_SIZE_METARECORD); } /* Length field */
U_WMRCORE_N16_swap(record,1,torev); /* Length */
if(!torev){ L2 = *(int16_t *)(record + U_SIZE_METARECORD); } /* Length field */
/* string is in bytes, do not swap that */
U_swap2(record + U_SIZE_WMRTEXTOUT + L2, 2); /* y,x */
}
void U_WMRBITBLT_swap(char *record, int torev){
uint32_t Size16;
uint8_t xb;
memcpy(&Size16, record + offsetof(U_METARECORD,Size16_4), 4);
if(!torev)U_swap4(&Size16,1);
xb = *(uint8_t *)(record + offsetof(U_METARECORD,xb));
if(U_TEST_NOPX2(Size16,xb)){ /* no bitmap */
U_WMRCORE_U32_N16_swap(record,7,torev);
}
else { /* yes bitmap */
U_WMRCORE_U32_N16_swap(record,6,torev);
bitmap16_swap(record + offsetof(U_WMRBITBLT_PX,bitmap));
}
}
void U_WMRSTRETCHBLT_swap(char *record, int torev){
uint32_t Size16;
uint8_t xb;
memcpy(&Size16, record + offsetof(U_METARECORD,Size16_4), 4);
if(!torev)U_swap4(&Size16,1);
xb = *(uint8_t *)(record + offsetof(U_METARECORD,xb));
if(U_TEST_NOPX2(Size16,xb)){ /* no bitmap */
U_WMRCORE_U32_N16_swap(record,9,torev);
}
else { /* yes bitmap */
U_WMRCORE_U32_N16_swap(record,8,torev);
bitmap16_swap(record + offsetof(U_WMRSTRETCHBLT_PX,bitmap));
}
}
void U_WMRPOLYGON_swap(char *record, int torev){
U_WMRCORE_U16_N16_swap(record, torev);
}
void U_WMRPOLYLINE_swap(char *record, int torev){
U_WMRCORE_U16_N16_swap(record, torev);
}
void U_WMRESCAPE_swap(char *record, int torev){
uint16_t eFunc;
if(torev){ eFunc = *(uint16_t *)(record + offsetof(U_WMRESCAPE,eFunc)); }
U_WMRCORE_N16_swap(record,2,torev);
if(!torev){ eFunc = *(uint16_t *)(record + offsetof(U_WMRESCAPE,eFunc)); }
/* Handle data swapping for three types only, anything else end user code must handle */
if((eFunc == U_MFE_SETLINECAP) || (eFunc == U_MFE_SETLINEJOIN) || (eFunc == U_MFE_SETMITERLIMIT)){
U_swap4(record + offsetof(U_WMRESCAPE, Data),1);
}
}
void U_WMRRESTOREDC_swap(char *record, int torev){
U_WMRCORE_SIZE16_swap(record, torev);
}
void U_WMRFILLREGION_swap(char *record, int torev){
U_WMRCORE_N16_swap(record,2,torev);
}
void U_WMRFRAMEREGION_swap(char *record, int torev){
U_WMRCORE_N16_swap(record,4,torev);
}
void U_WMRINVERTREGION_swap(char *record, int torev){
U_WMRCORE_N16_swap(record,1,torev);
}
void U_WMRPAINTREGION_swap(char *record, int torev){
U_WMRCORE_N16_swap(record,1,torev);
}
void U_WMRSELECTCLIPREGION_swap(char *record, int torev){
U_WMRCORE_N16_swap(record,1,torev);
}
void U_WMRSELECTOBJECT_swap(char *record, int torev){
U_WMRCORE_N16_swap(record,1,torev);
}
void U_WMRSETTEXTALIGN_swap(char *record, int torev){
U_WMRCORE_N16_swap(record,1,torev);
}
void U_WMRDRAWTEXT_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMRCHORD_swap(char *record, int torev){
U_WMRCORE_N16_swap(record, 8, torev);
}
void U_WMRSETMAPPERFLAGS_swap(char *record, int torev){
U_WMRCORE_N16_swap(record,1,torev);
}
void U_WMREXTTEXTOUT_swap(char *record, int torev){
int off,Length,Len2,Opts;
U_swap4(record + offsetof(U_WMREXTTEXTOUT,Size16_4),1);
if(torev){
Length = *(int16_t *)( record + offsetof(U_WMREXTTEXTOUT,Length));
Opts = *(uint16_t *)(record + offsetof(U_WMREXTTEXTOUT,Opts));
}
U_swap2(record + offsetof(U_WMREXTTEXTOUT,y), 4); /* y,x,Length,Opts*/
if(!torev){
Length = *(int16_t *)( record + offsetof(U_WMREXTTEXTOUT,Length));
Opts = *(uint16_t *)(record + offsetof(U_WMREXTTEXTOUT,Opts));
}
off = U_SIZE_WMREXTTEXTOUT;
if(Opts & (U_ETO_OPAQUE | U_ETO_CLIPPED)){
U_swap2(record + off,4); off += 8;
}
Len2 = (Length & 1 ? Length + 1 : Length);
off += Len2; /* no need to swap string, it is a byte array */
U_swap2(record+off,Length); /* swap the dx array */
}
void U_WMRSETDIBTODEV_swap(char *record, int torev){
U_WMRCORE_N16_swap(record, 9, torev);
dibheader_swap(record + offsetof(U_WMRSETDIBTODEV,dib), torev);
}
void U_WMRSELECTPALETTE_swap(char *record, int torev){
U_WMRCORE_N16_swap(record,1,torev);
}
void U_WMRREALIZEPALETTE_swap(char *record, int torev){
U_WMRCORE_SIZE16_swap(record, torev);
}
void U_WMRANIMATEPALETTE_swap(char *record, int torev){
U_WMRCORE_PALETTE_swap(record, torev);
}
void U_WMRSETPALENTRIES_swap(char *record, int torev){
U_WMRCORE_PALETTE_swap(record, torev);
}
void U_WMRPOLYPOLYGON_swap(char *record, int torev){
U_WMRCORE_SIZE16_swap(record, torev);
polypolygon_swap(record + offsetof(U_WMRPOLYPOLYGON,PPolygon), torev);
}
void U_WMRRESIZEPALETTE_swap(char *record, int torev){
U_WMRCORE_N16_swap(record,1,torev);
}
void U_WMR3A_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR3B_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR3C_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR3D_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR3E_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR3F_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMRDIBBITBLT_swap(char *record, int torev){
uint32_t Size16;
uint8_t xb;
memcpy(&Size16, record + offsetof(U_METARECORD,Size16_4), 4);
if(!torev)U_swap4(&Size16,1);
xb = *(uint8_t *)(record + offsetof(U_METARECORD,xb));
if(U_TEST_NOPX2(Size16,xb)){ /* no bitmap */
U_WMRCORE_U32_N16_swap(record,7,torev);
}
else { /* yes bitmap */
U_WMRCORE_U32_N16_swap(record,6,torev);
dibheader_swap(record + offsetof(U_WMRDIBBITBLT_PX,dib), torev);
}
}
void U_WMRDIBSTRETCHBLT_swap(char *record, int torev){
uint32_t Size16;
uint8_t xb;
memcpy(&Size16, record + offsetof(U_METARECORD,Size16_4), 4);
if(!torev)U_swap4(&Size16,1);
xb = *(uint8_t *)(record + offsetof(U_METARECORD,xb));
if(U_TEST_NOPX2(Size16,xb)){ /* no bitmap */
U_WMRCORE_U32_N16_swap(record,9,torev);
}
else { /* yes bitmap */
U_WMRCORE_U32_N16_swap(record,8,torev);
dibheader_swap(record + offsetof(U_WMRDIBSTRETCHBLT_PX,dib), torev);
}
}
void U_WMRDIBCREATEPATTERNBRUSH_swap(char *record, int torev){
int Style;
if(torev){ Style = *(uint16_t *)(record + offsetof(U_WMRDIBCREATEPATTERNBRUSH,Style)); }
U_WMRCORE_N16_swap(record,2,torev); /* Style and cUsage */
if(!torev){ Style = *(uint16_t *)(record + offsetof(U_WMRDIBCREATEPATTERNBRUSH,Style)); }
if(Style == U_BS_PATTERN){
bitmap16_swap(record + offsetof(U_WMRDIBCREATEPATTERNBRUSH,Src));
}
else {
dibheader_swap(record + offsetof(U_WMRDIBCREATEPATTERNBRUSH,Src), torev);
}
}
void U_WMRSTRETCHDIB_swap(char *record, int torev){
UNUSED_PARAMETER(torev);
U_WMRCORE_U32_N16_swap(record,9,torev);
dibheader_swap(record + offsetof(U_WMRSTRETCHDIB,dib), torev);
}
void U_WMR44_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR45_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR46_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR47_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMREXTFLOODFILL_swap(char *record, int torev){
U_WMRCORE_U16_CR_2U16_swap(record, torev);
}
void U_WMR49_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR4A_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR4B_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR4C_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR4D_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR4E_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR4F_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR50_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR51_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR52_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR53_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR54_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR55_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR56_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR57_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR58_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR59_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR5A_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR5B_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR5C_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR5D_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR5E_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR5F_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR60_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR61_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR62_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR63_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR64_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR65_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR66_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR67_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR68_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR69_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR6A_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR6B_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR6C_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR6D_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR6E_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR6F_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR70_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR71_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR72_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR73_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR74_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR75_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR76_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR77_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR78_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR79_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR7A_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR7B_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR7C_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR7D_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR7E_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR7F_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR80_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR81_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR82_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR83_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR84_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR85_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR86_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR87_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR88_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR89_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR8A_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR8B_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR8C_swap(char *record, int torev){
U_WMRNOTIMPLEMENTED_swap(record, torev);
}
void U_WMR8D_swap(char *record, int torev){