summaryrefslogtreecommitdiff
path: root/xc/programs/Xserver/PEX5/ddpex/mi/level2/miOCs.c
blob: 75c195bb59ef384f3836902346809daaaf8364df (plain)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
/* $XConsortium: miOCs.c,v 5.6 94/04/17 20:37:14 hersh Exp $ */
/*

Copyright (c) 1989, 1990, 1991  X Consortium

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

Except as contained in this notice, the name of the X Consortium shall
not be used in advertising or otherwise to promote the sale, use or
other dealings in this Software without prior written authorization
from the X Consortium.


Copyright 1989, 1990, 1991 by Sun Microsystems, Inc. 
All Rights Reserved

Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Sun Microsystems
not be used in advertising or publicity pertaining to distribution
of the software without specific, written prior permission.

SUN MICROSYSTEMS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
SHALL SUN MICROSYSTEMS BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.

*/

#include "miLUT.h"
#include "misc.h"
#include "miscstruct.h"
#include "PEXErr.h"
#include "PEXprotost.h"
#include "ddpex2.h"
#include "miRender.h"
#include "miStruct.h"
#include "extnsionst.h"
#include "gcstruct.h"
#include "miLight.h"


/* Level II Output Command Attributes */

/*
 * Marker type
 */
ddpex2rtn
miMarkerType(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexMarkerType *pMT = (pexMarkerType *)(pOC+1);

    pddc->Dynamic->pPCAttr->markerType = pMT->markerType;
    /* Update DDC rendering attributes if not bundled */
    if ((pddc->Dynamic->pPCAttr->asfs & PEXMarkerTypeAsf) != PEXBundled)
	pddc->Static.attrs->markerType = pMT->markerType;

    return(Success);
}

/*
 * Marker scale
 */
ddpex2rtn
miMarkerScale(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexMarkerScale *pMS = (pexMarkerScale *)(pOC+1);

    pddc->Dynamic->pPCAttr->markerScale = pMS->scale;
    /* Update DDC rendering attributes if not bundled */
    if ((pddc->Dynamic->pPCAttr->asfs & PEXMarkerScaleAsf) != PEXBundled)
	pddc->Static.attrs->markerScale = pMS->scale;

    return(Success);
}

/*
 * Marker Bundle Index
 */
ddpex2rtn
miMarkerBundleIndex(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexMarkerBundleIndex *pMBI = (pexMarkerBundleIndex *)(pOC+1);
    ddBitmask    tables, namesets, attrs;

    if (pddc->Dynamic->pPCAttr->markerIndex != pMBI->index) {
	pddc->Dynamic->pPCAttr->markerIndex = pMBI->index;

	namesets = attrs = 0;
	tables = PEXDynMarkerBundle;
	ValidateDDContextAttrs(pRend, pddc, tables, namesets, attrs);
    }
    return(Success);
}

/*
 * Text Font Index
 */
ddpex2rtn
miTextFontIndex(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexTextFontIndex *pMBI = (pexTextFontIndex *)(pOC+1);
    pddc->Dynamic->pPCAttr->textFont = pMBI->index;
    /* Update DDC rendering attributes if not bundled */
    if ((pddc->Dynamic->pPCAttr->asfs & PEXTextFontIndexAsf) != PEXBundled)
	pddc->Static.attrs->textFont = pMBI->index;
    return(Success);
}

/*
 * Text Precision
 */
ddpex2rtn
miTextPrecision(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexTextPrecision *pMBI = (pexTextPrecision *)(pOC+1);
    pddc->Dynamic->pPCAttr->textPrecision = pMBI->precision;
    /* Update DDC rendering attributes if not bundled */
    if ((pddc->Dynamic->pPCAttr->asfs & PEXTextPrecAsf) != PEXBundled)
	pddc->Static.attrs->textPrecision = pMBI->precision;
    return(Success);
}

/*
 * Character Expansion
 */
ddpex2rtn
miCharExpansion(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexCharExpansion *pMBI = (pexCharExpansion *)(pOC+1);
    pddc->Dynamic->pPCAttr->charExpansion = pMBI->expansion;
    /* Update DDC rendering attributes if not bundled */
    if ((pddc->Dynamic->pPCAttr->asfs & PEXCharExpansionAsf) != PEXBundled)
	pddc->Static.attrs->charExpansion = pMBI->expansion;
    return(Success);
}

/*
 * Character Spacing
 */
ddpex2rtn
miCharSpacing(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexCharSpacing *pMBI = (pexCharSpacing *)(pOC+1);
    pddc->Dynamic->pPCAttr->charSpacing = pMBI->spacing;
    /* Update DDC rendering attributes if not bundled */
    if ((pddc->Dynamic->pPCAttr->asfs & PEXCharSpacingAsf) != PEXBundled)
	pddc->Static.attrs->charSpacing = pMBI->spacing;
    return(Success);
}

/*
 * Character Height
 */
ddpex2rtn
miCharHeight(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexCharHeight *pMBI = (pexCharHeight *)(pOC+1);
    pddc->Dynamic->pPCAttr->charHeight = pMBI->height;
    pddc->Static.attrs->charHeight = pMBI->height;
    return(Success);
}

/*
 * Character Up Vector
 */
ddpex2rtn
miCharUpVector(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexCharUpVector *pMBI = (pexCharUpVector *)(pOC+1);
    pddc->Dynamic->pPCAttr->charUp.x = pMBI->up.x;
    pddc->Dynamic->pPCAttr->charUp.y = pMBI->up.y;
    pddc->Static.attrs->charUp = pddc->Dynamic->pPCAttr->charUp;
    return(Success);
}

/*
 * Text Path
 */
ddpex2rtn
miTextPath(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexTextPath *pMBI = (pexTextPath *)(pOC+1);
    pddc->Dynamic->pPCAttr->textPath = pMBI->path;
    pddc->Static.attrs->textPath = pMBI->path;
    return(Success);
}

/*
 * Text Alignment
 */
ddpex2rtn
miTextAlignment(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexTextAlignment *pMBI = (pexTextAlignment *)(pOC+1);
    pddc->Dynamic->pPCAttr->textAlignment.vertical =
					    (ddUSHORT) pMBI->alignment.vertical;
     pddc->Dynamic->pPCAttr->textAlignment.horizontal =
					   (ddUSHORT) pMBI->alignment.horizontal;
     pddc->Static.attrs->textAlignment = 
				    pddc->Dynamic->pPCAttr->textAlignment;

    return(Success);
}

/*
 * Annotation Text Height
 */
ddpex2rtn
miAtextHeight(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexAtextHeight *pMBI = (pexAtextHeight *)(pOC+1);
    pddc->Dynamic->pPCAttr->atextHeight = pMBI->height;
    pddc->Static.attrs->atextHeight = pMBI->height;
    return(Success);
}

/*
 * Annotation Text Up Vector
 */
ddpex2rtn
miAtextUpVector(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexAtextUpVector *pMBI = (pexAtextUpVector *)(pOC+1);
    pddc->Dynamic->pPCAttr->atextUp.x = pMBI->up.x;
    pddc->Dynamic->pPCAttr->atextUp.y = pMBI->up.y;
    pddc->Static.attrs->atextUp = pddc->Dynamic->pPCAttr->atextUp;
    return(Success);
}

/*
 * Annotation Text Path
 */
ddpex2rtn
miAtextPath(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexAtextPath *pMBI = (pexAtextPath *)(pOC+1);
    pddc->Dynamic->pPCAttr->atextPath = pMBI->path;
    pddc->Static.attrs->atextPath = pMBI->path;
    return(Success);
}

/*
 * Annotation Text Alignment
 */
ddpex2rtn
miAtextAlignment(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexAtextAlignment *pMBI = (pexAtextAlignment *)(pOC+1);
    pddc->Dynamic->pPCAttr->atextAlignment.vertical =
					    (ddUSHORT) pMBI->alignment.vertical;
    pddc->Dynamic->pPCAttr->atextAlignment.horizontal =
					   (ddUSHORT) pMBI->alignment.horizontal;
    pddc->Static.attrs->atextAlignment = 
					pddc->Dynamic->pPCAttr->atextAlignment;
    return(Success);
}

/*
 * Annotation Text Style
 */
ddpex2rtn
miAtextStyle(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexAtextStyle *pMT = (pexAtextStyle *)(pOC+1);
    pddc->Dynamic->pPCAttr->atextStyle = pMT->style;
    pddc->Static.attrs->atextStyle = pMT->style;
    return(Success);
}

/*
 * Text Bundle Index
 */
ddpex2rtn
miTextBundleIndex(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexTextBundleIndex *pTBI = (pexTextBundleIndex *)(pOC+1);
    ddBitmask    tables, namesets, attrs;

    if (pddc->Dynamic->pPCAttr->textIndex != pTBI->index) {
	pddc->Dynamic->pPCAttr->textIndex = pTBI->index;

	namesets = attrs = 0;
	tables = PEXDynTextBundle;
	ValidateDDContextAttrs(pRend, pddc, tables, namesets, attrs);
    }
    return(Success);
}

/*
 * Line type (Dashing style)
 */
ddpex2rtn
miLineType(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexLineType *pLT = (pexLineType *)(pOC+1);
    pddc->Dynamic->pPCAttr->lineType = pLT->lineType;
    /* Update DDC rendering attributes if not bundled */
    if ((pddc->Dynamic->pPCAttr->asfs & PEXLineTypeAsf) != PEXBundled) {
	pddc->Static.attrs->lineType = pLT->lineType;
	pddc->Static.misc.flags |= POLYLINEGCFLAG;
    }
    return(Success);
}


/*
 * Line Width 
 */
ddpex2rtn
miLineWidth(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexLineWidth *pLW = (pexLineWidth *)(pOC+1);
    pddc->Dynamic->pPCAttr->lineWidth = pLW->width;
    /* Update DDC rendering attributes if not bundled */
    if ((pddc->Dynamic->pPCAttr->asfs & PEXLineWidthAsf) != PEXBundled) {
	pddc->Static.attrs->lineWidth = pLW->width;
	pddc->Static.misc.flags |= POLYLINEGCFLAG;
    }
    return(Success);
}

/*
 * Line Bundle Index
 */
ddpex2rtn
miLineBundleIndex(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexLineBundleIndex *pLBI = (pexLineBundleIndex *)(pOC+1);
    ddBitmask    tables, namesets, attrs;

    if (pddc->Dynamic->pPCAttr->lineIndex != pLBI->index) {
	pddc->Dynamic->pPCAttr->lineIndex = pLBI->index;

	namesets = attrs = 0;
	tables = PEXDynLineBundle;
	ValidateDDContextAttrs(pRend, pddc, tables, namesets, attrs);
    }
    return(Success);
}

/*
 * curve approximation method
 */
ddpex2rtn
miCurveApproximation(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexCurveApproximation *pCA = (pexCurveApproximation *)(pOC+1);
    pddc->Dynamic->pPCAttr->curveApprox.approxMethod = pCA->approx.approxMethod;
    pddc->Dynamic->pPCAttr->curveApprox.tolerance = pCA->approx.tolerance;
    /* Update DDC rendering attributes if not bundled */
    if ((pddc->Dynamic->pPCAttr->asfs & PEXLineWidthAsf) != PEXBundled)
	pddc->Static.attrs->curveApprox=pddc->Dynamic->pPCAttr->curveApprox;

    return(Success);
}


/*
 * Surface interior style
 */
ddpex2rtn
miInteriorStyle(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexInteriorStyle *pIS = (pexInteriorStyle *)(pOC+1);
    pddc->Dynamic->pPCAttr->intStyle = pIS->interiorStyle;
    /* Update DDC rendering attributes if not bundled */
    if ((pddc->Dynamic->pPCAttr->asfs & PEXInteriorStyleAsf) != PEXBundled) {
	pddc->Static.attrs->intStyle = pIS->interiorStyle;
	pddc->Static.misc.flags |= FILLAREAGCFLAG;
    }
    return(Success);
}

/*
 * Depth Cue Bundle Index
 */
ddpex2rtn
miDepthCueIndex(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexDepthCueIndex *pDCI = (pexDepthCueIndex *)(pOC+1);
    ddBitmask    tables, namesets, attrs;

    pddc->Dynamic->pPCAttr->depthCueIndex = pDCI->index;

    /* Mark as invalid cc version of depth cue entry in dd context */
    pddc->Static.misc.flags |= CC_DCUEVERSION;

    namesets = attrs = 0;
    tables = PEXDynDepthCueTableContents;
    ValidateDDContextAttrs(pRend, pddc, tables, namesets, attrs);

    return(Success);
}

/*
 * Interior Bundle Index
 */
ddpex2rtn
miInteriorBundleIndex(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexInteriorBundleIndex *pIBI = (pexInteriorBundleIndex *)(pOC+1);
    ddBitmask    tables, namesets, attrs;

    if (pddc->Dynamic->pPCAttr->intIndex != pIBI->index) {
	pddc->Dynamic->pPCAttr->intIndex = pIBI->index;

	namesets = attrs = 0;
	tables = PEXDynInteriorBundle;
	ValidateDDContextAttrs(pRend, pddc, tables, namesets, attrs);
    }
    return(Success);
}

/*
 * Surface reflection attributes
 */
ddpex2rtn
miSurfaceReflAttr(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexSurfaceReflAttr *pSRA = (pexSurfaceReflAttr *)(pOC+1);
    ddColourSpecifier *pSC = 
		    (ddColourSpecifier *)&pSRA->reflectionAttr.specularColour;

    pddc->Dynamic->pPCAttr->reflAttr.ambient =
					(ddFLOAT)pSRA->reflectionAttr.ambient;
    pddc->Dynamic->pPCAttr->reflAttr.diffuse =
					(ddFLOAT)pSRA->reflectionAttr.diffuse;
    pddc->Dynamic->pPCAttr->reflAttr.specular =
					(ddFLOAT)pSRA->reflectionAttr.specular;
    pddc->Dynamic->pPCAttr->reflAttr.specularConc =
				    (ddFLOAT)pSRA->reflectionAttr.specularConc;
    pddc->Dynamic->pPCAttr->reflAttr.transmission =
				    (ddFLOAT)pSRA->reflectionAttr.transmission;

    switch (pddc->Dynamic->pPCAttr->reflAttr.specularColour.colourType = 
		pSC->colourType) {
	case PEXIndexedColour:
	    pddc->Dynamic->pPCAttr->reflAttr.specularColour.colour.indexed = 
							    pSC->colour.indexed;
	    break;
	case PEXRgbFloatColour:
	case PEXCieFloatColour:
	case PEXHsvFloatColour:
	case PEXHlsFloatColour:
	    pddc->Dynamic->pPCAttr->reflAttr.specularColour.colour.rgbFloat = 
							    pSC->colour.rgbFloat;
	    break;
	case PEXRgb8Colour:
	    pddc->Dynamic->pPCAttr->reflAttr.specularColour.colour.rgb8 = 
								pSC->colour.rgb8;
	    break;
	case PEXRgb16Colour:
	    pddc->Dynamic->pPCAttr->reflAttr.specularColour.colour.rgb16 = 
							    pSC->colour.rgb16;
	    break;
    }

    /* Update DDC rendering attributes if not bundled */
    if((pddc->Dynamic->pPCAttr->asfs & PEXReflectionAttrAsf) != PEXBundled)
       pddc->Static.attrs->reflAttr = pddc->Dynamic->pPCAttr->reflAttr;

    return(Success);
}
/*
 * Surface reflection model
 */
ddpex2rtn
miSurfaceReflModel(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexSurfaceReflModel *pSRM = (pexSurfaceReflModel *)(pOC+1);
    pddc->Dynamic->pPCAttr->reflModel = pSRM->reflectionModel;
    /* Update DDC rendering attributes if not bundled */
    if((pddc->Dynamic->pPCAttr->asfs & PEXReflectionModelAsf)!=PEXBundled)
	pddc->Static.attrs->reflModel = pSRM->reflectionModel;
    return(Success);
}

/*
 * Surface interpolation scheme
 */
ddpex2rtn
miSurfaceInterp(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexSurfaceInterp *pSI = (pexSurfaceInterp *)(pOC+1);
    pddc->Dynamic->pPCAttr->surfInterp = pSI->surfaceInterp;
    /* Update DDC rendering attributes if not bundled */
    if ((pddc->Dynamic->pPCAttr->asfs & PEXSurfaceInterpAsf) != PEXBundled)
	pddc->Static.attrs->surfInterp = pSI->surfaceInterp;
    return(Success);
}

/* 
 * Surface approximation criteria
 */
ddpex2rtn
miSurfaceApproximation(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexSurfaceApproximation *pSA = (pexSurfaceApproximation *)(pOC+1);
    pddc->Dynamic->pPCAttr->surfApprox.approxMethod = pSA->approx.approxMethod;
    pddc->Dynamic->pPCAttr->surfApprox.uTolerance = pSA->approx.uTolerance;
    pddc->Dynamic->pPCAttr->surfApprox.vTolerance = pSA->approx.vTolerance;
    /* Update DDC rendering attributes if not bundled */
    if ((pddc->Dynamic->pPCAttr->asfs & PEXSurfaceApproxAsf) != PEXBundled)
	pddc->Static.attrs->surfApprox = pddc->Dynamic->pPCAttr->surfApprox;
    return(Success);
}

/* 
 * Cull back or front facing facets.
 */
ddpex2rtn
miCullingMode(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexCullingMode *pCM = (pexCullingMode *)(pOC+1);
    pddc->Dynamic->pPCAttr->cullMode = pCM->cullMode;
    return(Success);
}

/*
 * Surface edge flag (enable/disable dispaly of fill area edges)
 */
ddpex2rtn
miSurfaceEdgeFlag(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexSurfaceEdgeFlag *pSEF = (pexSurfaceEdgeFlag *)(pOC+1);
    pddc->Dynamic->pPCAttr->edges = pSEF->onoff;
    /*set the dd context edge visibility flag if not a bundled attribute*/
    if((pddc->Dynamic->pPCAttr->asfs & PEXSurfaceEdgesAsf) != PEXBundled) {
	pddc->Static.attrs->edges = pSEF->onoff;
	pddc->Static.misc.flags |= EDGEGCFLAG;
    }
    return(Success);
}
/*
 * Surface edge type (Dashing style)
 */
ddpex2rtn
miSurfaceEdgeType(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexSurfaceEdgeType *pSET = (pexSurfaceEdgeType *)(pOC+1);
    pddc->Dynamic->pPCAttr->edgeType = pSET->edgeType;
    /* Update DDC rendering attributes if not bundled */
    if ((pddc->Dynamic->pPCAttr->asfs & PEXSurfaceEdgeTypeAsf)!=PEXBundled) {
	pddc->Static.attrs->edgeType = pSET->edgeType;
	pddc->Static.misc.flags |= EDGEGCFLAG;
    }
    return(Success);
}


/*
 * Surface edge Width 
 */
ddpex2rtn
miSurfaceEdgeWidth(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexSurfaceEdgeWidth *pSEW = (pexSurfaceEdgeWidth *)(pOC+1);
    pddc->Dynamic->pPCAttr->edgeWidth = pSEW->width;
    /* Update DDC rendering attributes if not bundled */
    if((pddc->Dynamic->pPCAttr->asfs & PEXSurfaceEdgeWidthAsf)!=PEXBundled) {
	pddc->Static.attrs->edgeWidth = pSEW->width;
	pddc->Static.misc.flags |= EDGEGCFLAG;
    }
    return(Success);
}
/*
 * Surface edge Bundle Index
 */
ddpex2rtn
miEdgeBundleIndex(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexEdgeBundleIndex    *pEBI = (pexEdgeBundleIndex *)(pOC+1);
    ddBitmask    tables, namesets, attrs;

    if (pddc->Dynamic->pPCAttr->edgeIndex != pEBI->index) {
	pddc->Dynamic->pPCAttr->edgeIndex = pEBI->index;

	namesets = attrs = 0;
	tables = PEXDynEdgeBundle;
	ValidateDDContextAttrs(pRend, pddc, tables, namesets, attrs);
    }
    return(Success);
}

/*
 * Set ASF values
 */
ddpex2rtn
miSetAsfValues(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexSetAsfValues    *pSAV = (pexSetAsfValues *)(pOC+1);
    ddBitmask	tables, namesets, attrs;

    if (pSAV->source == PEXBundled) { /* Note that PEXBundled == 0 */
	pddc->Dynamic->pPCAttr->asfs &= ~(pSAV->attribute);

    } else {
	pddc->Dynamic->pPCAttr->asfs |= pSAV->attribute;

    }

    /* changing the table behaves the same as changing 
     * the asf, so use that for ValidateDDContext
     */
    tables = namesets = attrs = 0;
    if (pSAV->attribute & ( PEXMarkerTypeAsf | 
			    PEXMarkerScaleAsf | 
			    PEXMarkerColourAsf))
	tables |= PEXDynMarkerBundle;
     if (pSAV->attribute & (PEXTextFontIndexAsf | 
			    PEXTextPrecAsf | 
			    PEXCharExpansionAsf | 
			    PEXCharSpacingAsf | 
			    PEXTextColourAsf))
	tables |= PEXDynTextBundle;
     if (pSAV->attribute & (PEXLineTypeAsf | 
			    PEXLineWidthAsf | 
			    PEXLineColourAsf |
			    PEXCurveApproxAsf |
			    PEXPolylineInterpAsf))
	tables |= PEXDynLineBundle;
     if (pSAV->attribute & (PEXInteriorStyleAsf |
			    PEXInteriorStyleIndexAsf |
			    PEXSurfaceColourAsf |
			    PEXSurfaceInterpAsf |
			    PEXReflectionModelAsf |
			    PEXReflectionAttrAsf |
			    PEXBfInteriorStyleAsf |
			    PEXBfInteriorStyleIndexAsf |
			    PEXBfSurfaceColourAsf |
			    PEXBfSurfaceInterpAsf |
			    PEXBfReflectionModelAsf |
			    PEXBfReflectionAttrAsf |
			    PEXSurfaceApproxAsf))
	tables |= PEXDynInteriorBundle;
    if (pSAV->attribute & ( PEXSurfaceEdgeTypeAsf | 
			    PEXSurfaceEdgeWidthAsf | 
			    PEXSurfaceEdgeColourAsf |
			    PEXSurfaceEdgesAsf ))
	tables |= PEXDynEdgeBundle;

    /* Re-initialize the dd context rendering attributes */
    ValidateDDContextAttrs(pRend, pddc, tables, namesets, attrs);

    return(Success);
}

/*
 * Local transformations
 */
ddpex2rtn
miLocalTransform(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexLocalTransform *pLT = (pexLocalTransform *)(pOC+1);

    switch (pLT->compType) {
	case PEXPreConcatenate:
	    miMatMult(	pddc->Dynamic->pPCAttr->localMat,
			pLT->matrix, pddc->Dynamic->pPCAttr->localMat);
	    break;
	case PEXPostConcatenate:
	    miMatMult(	pddc->Dynamic->pPCAttr->localMat,
			pddc->Dynamic->pPCAttr->localMat, pLT->matrix);
	    break;
	case PEXReplace:
	    memcpy( (char *)(pddc->Dynamic->pPCAttr->localMat),
		   (char *)(pLT->matrix),
                   16*sizeof(ddFLOAT));
	    break;
    }

    /* Update composite transforms */
    /* First, composite [CMM] */
    miMatMult(	pddc->Dynamic->mc_to_wc_xform,
		pddc->Dynamic->pPCAttr->localMat,
		pddc->Dynamic->pPCAttr->globalMat);

    /* Next, composite [VCM] next */
     miMatMult(	pddc->Dynamic->mc_to_cc_xform,
		pddc->Dynamic->mc_to_wc_xform, 
		pddc->Dynamic->wc_to_cc_xform);

    /* Lastly, Compute the composite mc -> dc transform */
    miMatMult(	pddc->Dynamic->mc_to_dc_xform,
		pddc->Dynamic->mc_to_cc_xform,
		pddc->Dynamic->cc_to_dc_xform);

    /* Mark as invalid appropriate inverse transforms in dd context */
    pddc->Static.misc.flags |= (INVTRMCTOWCXFRMFLAG | INVTRWCTOCCXFRMFLAG);

    return(Success);
}

ddpex2rtn
miLocalTransform2D(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexLocalTransform2D *pLT = (pexLocalTransform2D *)(pOC+1);
    ddFLOAT	     *s, *d;
    ddFLOAT	     temp[4][4];

    /*
     * 2D -> 3D transform as follows:
     *
     *    a d g	 a d 0 g
     *    b e h	 b e 0 h
     *    c f i	 0 0 1 0
     *		 c f 0 i
     *
     */
    s = (ddFLOAT *)pLT->matrix3X3;
    d = (ddFLOAT *)temp;

    *d++ = *s++;    /* [0][0] */ 
    *d++ = *s++;    /* [0][1] */ 
    *d++ = 0.0;    /* [0][2] */
    *d++ = *s++;    /* [0][3] */
    *d++ = *s++;    /* [1][0] */
    *d++ = *s++;    /* [1][1] */
    *d++ = 0.0;    /* [1][2] */
    *d++ = *s++;    /* [1][3] */
    *d++ = 0.0;    /* [2][0] */
    *d++ = 0.0;    /* [2][1] */
    *d++ = 1.0;    /* [2][2] */
    *d++ = 0.0;    /* [2][3] */
    *d++ = *s++;    /* [3][0] */
    *d++ = *s++;    /* [3][0] */
    *d++ = 0.0;    /* [3][0] */
    *d++ = *s++;    /* [3][0] */

    switch (pLT->compType) {
	case PEXPreConcatenate:
	    miMatMult(	pddc->Dynamic->pPCAttr->localMat,
			temp, pddc->Dynamic->pPCAttr->localMat);
	    break;
	case PEXPostConcatenate:
	    miMatMult(	pddc->Dynamic->pPCAttr->localMat,
			pddc->Dynamic->pPCAttr->localMat, temp);
	    break;
	case PEXReplace:
	    memcpy( (char *)(pddc->Dynamic->pPCAttr->localMat), (char *)temp,  
		    16*sizeof(ddFLOAT));
	    break;
    }

    /* Update composite transforms */
    /* First, composite [CMM] */
    miMatMult(	pddc->Dynamic->mc_to_wc_xform,
		pddc->Dynamic->pPCAttr->localMat,
		pddc->Dynamic->pPCAttr->globalMat);

    /* Next, composite [VCM] next */
    miMatMult(	pddc->Dynamic->mc_to_cc_xform,
		pddc->Dynamic->mc_to_wc_xform, 
		pddc->Dynamic->wc_to_cc_xform);

    /* Lastly, Compute the composite mc -> dc transform */
    miMatMult(	pddc->Dynamic->mc_to_dc_xform,
		pddc->Dynamic->mc_to_cc_xform,
		pddc->Dynamic->cc_to_dc_xform);

    /* Mark as invalid appropriate inverse transforms in dd context */
    pddc->Static.misc.flags |= (INVTRMCTOWCXFRMFLAG | INVTRWCTOCCXFRMFLAG);

    return(Success);
}


/*
 * Global transformations
 */
ddpex2rtn
miGlobalTransform(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexGlobalTransform *pGT = (pexGlobalTransform *)(pOC+1);

    memcpy( (char *)(pddc->Dynamic->pPCAttr->globalMat), (char *)(pGT->matrix), 
	    16 * sizeof(ddFLOAT));

    /* Update composite transforms */
    /* First, composite [CMM] */
    miMatMult(	pddc->Dynamic->mc_to_wc_xform,
		pddc->Dynamic->pPCAttr->localMat,
		pddc->Dynamic->pPCAttr->globalMat);

    /* Next, composite [VCM] next */
    miMatMult(	pddc->Dynamic->mc_to_cc_xform,
		pddc->Dynamic->mc_to_wc_xform, 
		pddc->Dynamic->wc_to_cc_xform);

    /* Lastly, Compute the composite mc -> dc transform */
    miMatMult(	pddc->Dynamic->mc_to_dc_xform,
		pddc->Dynamic->mc_to_cc_xform,
		pddc->Dynamic->cc_to_dc_xform);
     
    /* Mark as invalid appropriate inverse transforms in dd context */
    pddc->Static.misc.flags |= (INVTRMCTOWCXFRMFLAG | INVTRWCTOCCXFRMFLAG);

    return(Success);
}

ddpex2rtn
miGlobalTransform2D(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexGlobalTransform2D *pGT = (pexGlobalTransform2D *)(pOC+1);
    ddFLOAT	      *s, *d;

    /*
     * 2D -> 3D transform as follows:
     *
     *    a d g	 a d 0 g
     *    b e h	 b e 0 h
     *    c f i	 0 0 1 0
     *		 c f 0 i
     *
     */
    s = (ddFLOAT *)pGT->matrix3X3;
    d = (ddFLOAT *)pddc->Dynamic->pPCAttr->globalMat;

    *d++ = *s++;    /* [0][0] */
    *d++ = *s++;    /* [0][1] */
    *d++ = 0.0;    /* [0][2] */
    *d++ = *s++;    /* [0][3] */
    *d++ = *s++;    /* [1][0] */
    *d++ = *s++;    /* [1][1] */
    *d++ = 0.0;    /* [1][2] */
    *d++ = *s++;    /* [1][3] */
    *d++ = 0.0;    /* [2][0] */
    *d++ = 0.0;    /* [2][1] */
    *d++ = 1.0;    /* [2][2] */
    *d++ = 0.0;    /* [2][3] */
    *d++ = *s++;    /* [3][0] */
    *d++ = *s++;    /* [3][0] */
    *d++ = 0.0;    /* [3][0] */
    *d++ = *s++;    /* [3][0] */

    /* Update composite transforms */
    /* First, composite [CMM] */
    miMatMult(	pddc->Dynamic->mc_to_wc_xform,
		pddc->Dynamic->pPCAttr->localMat,
		pddc->Dynamic->pPCAttr->globalMat);

    /* Next, composite [VCM] next */
    miMatMult(	pddc->Dynamic->mc_to_cc_xform,
		pddc->Dynamic->mc_to_wc_xform, 
		pddc->Dynamic->wc_to_cc_xform);

   /* Lastly, Compute the composite mc -> dc transform */
    miMatMult(	pddc->Dynamic->mc_to_dc_xform,
		pddc->Dynamic->mc_to_cc_xform,
		pddc->Dynamic->cc_to_dc_xform);

    /* Mark as invalid appropriate inverse transforms in dd context */
    pddc->Static.misc.flags |= (INVTRMCTOWCXFRMFLAG | INVTRWCTOCCXFRMFLAG);

    return(Success);
}

ddpex2rtn
miModelClip(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexModelClip *pMC = (pexModelClip *)(pOC+1);
    pddc->Dynamic->pPCAttr->modelClip = pMC->onoff;

    return(Success);
}



ddpex2rtn
miViewIndex(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexViewIndex    *pVI = (pexViewIndex *)(pOC+1);

    /* first, make sure this is a new index */
    if (pddc->Dynamic->pPCAttr->viewIndex == pVI->index) return(Success);

    /* Copy new index into ddContext */
    pddc->Dynamic->pPCAttr->viewIndex = pVI->index;

    /* Now, update internal transform cache to reflect new index */
    miBldCC_xform(pRend, pddc);

    return(Success);
}



ddpex2rtn
miPickId(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexPickId    *pPI = (pexPickId *)(pOC+1);

    pddc->Dynamic->pPCAttr->pickId = pPI->pickId;
    return(Success);
}


ddpex2rtn
miColourApproxIndex(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexColourApproxIndex    *pCAI = (pexColourApproxIndex *)(pOC+1);
    pddc->Dynamic->pPCAttr->colourApproxIndex = pCAI->index;
    return(Success);
}


ddpex2rtn
miRenderingColourModel(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexRenderingColourModel    *pRCM = (pexRenderingColourModel *)(pOC+1);
    pddc->Dynamic->pPCAttr->rdrColourModel = pRCM->model;
    return(Success);
}


ddpex2rtn
miParaSurfCharacteristics(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    miPSurfaceCharsStruct *pPSC = (miPSurfaceCharsStruct *)(pOC+1);
    switch (pddc->Dynamic->pPCAttr->psc.type = pPSC->type) {
	case PEXPSCNone:
	case PEXPSCImpDep:
	    break;
	case PEXPSCIsoCurves:
	    pddc->Dynamic->pPCAttr->psc.data.isoCurves =  *pPSC->data.pIsoCurves;
	    break;
	case PEXPSCMcLevelCurves:
	    /* Note that level curves are not implemented */
	    pddc->Dynamic->pPCAttr->psc.data.mcLevelCurves = 
						    *pPSC->data.pMcLevelCurves;
	    break;
	case PEXPSCWcLevelCurves:
	    /* Note that level curves are not implemented */
	    pddc->Dynamic->pPCAttr->psc.data.wcLevelCurves = 
						    *pPSC->data.pWcLevelCurves;
	    break;
	default:
	    break;
    }
    return(Success);

}

ddpex2rtn
miAddToNameSet(pRend, pOC) /* and RemoveNameFromNameSet */
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    miDDContext    *pddc = (miDDContext *)(pRend->pDDContext);
    pexAddToNameSet *pANS = (pexAddToNameSet *)(pOC+1);
    ddULONG    *pName = (ddULONG *)(pANS + 1);
    register int num = (pANS->head.length) - 1;
    ddUSHORT    save_flags = pddc->Dynamic->filter_flags;
    ddBitmask   namesets;
    extern void    ValidateFilters();

    for (; num>0; num--, pName++)
	/* ignore values that are out of range */
	if ( MINS_VALID_NAME(*pName) ) {
	    if (pANS->head.elementType == PEXOCAddToNameSet) {
		MINS_ADD_TO_NAMESET(*pName, pddc->Dynamic->currentNames);
	    } else {
		MINS_REMOVE_FROM_NAMESET(*pName, pddc->Dynamic->currentNames);
	    }
	}	

    /* changing current namesset, so update all filters */
    namesets = PEXDynHighlightNameset |
               PEXDynInvisibilityNameset |
               PEXDynHighlightNamesetContents |
               PEXDynInvisibilityNamesetContents;


    ValidateFilters(pRend, pddc, namesets);

    return(Success);
}


ddpex2rtn
miExecuteStructure(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    extern void    execute_structure_OC();

    execute_structure_OC(pRend, (pexExecuteStructure *)(pOC+1));
    return(Success);
}


ddpex2rtn
miNoop(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
    return (Success);
}


ddpex2rtn
miUndefined(pRend, pOC)
    ddRendererPtr    pRend;
    miGenericStr    *pOC;
{
#ifdef PR_INFO
    ErrorF( "Attribute is not implemented\n");
#endif
    return (PEXNYI);
}



/*++
 |
 |  Function Name:    miLightStateOC
 |
 |  Function Description:
 |     Handles PEXOCLightState OC
 |
 |  Note(s):
 |
 --*/
ddpex2rtn
miLightStateOC(pRend, pOC)
/* in */
    ddRendererPtr       pRend;      /* renderer handle */
    miGenericStr       *pOC;      /* output command */
/* out */
{
    miDDContext		*pddc = (miDDContext *)(pRend->pDDContext);
    miLightStateStruct	*pLS = (miLightStateStruct *)(pOC+1);
    ddUSHORT		*ptr;
    int			i;

    /*
     * Merge in a new set of light source indices
     */
    if (pLS->enableList->numObj > 0)
	puMergeLists(	pddc->Dynamic->pPCAttr->lightState, pLS->enableList,
			pddc->Dynamic->pPCAttr->lightState);

    if (pLS->disableList->numObj > 0)
	for (i = pLS->disableList->numObj, 
	    ptr = (ddUSHORT *)pLS->disableList->pList;
	    i > 0; 
	    --i, ptr++)
	    puRemoveFromList(ptr, pddc->Dynamic->pPCAttr->lightState);

    return (Success);
}
 
/*++
 | 
 |  Function Name:     SetMCVolume 
 |
 |  Function Description:
 |       Handles Handles SetModelClipVolume and 
 |     SetModelClipVolume2D OCs
 |
 |  Note(s):    Although model clipping half spaces are	specified 
 |	in modelling space, the pipeline stores the current clipping 
 |	volume in world coordinates.  This is because the modelling
 |	transformation matrix can change independently of this particular 
 |	OC, and world coordinates are the the only common coordinates to 
 |	intersect.  HOWEVER, when model clipping is enabled, this
 |	intersect volume is transferred BACK to model space and stored 
 |	in pddc->Static->ms_MCV for the actual clipping. This is done 
 |	in order to "prune" out as many primitives as early as possible
 |	in the pipeline. 
 |
 |	Whenever the modelling transformation matrix is changed, or
 |	when a new renderer is created, the model space	version of 
 |	the model clipping volume is invalidated; the world 
 |	coordinate volume is the "reference." The validation flag is 
 |	the INVMCXFRMFLAG defined in ddpex/mi/include/miRender.h
 |
 --*/
ddpex2rtn
miSetMCVolume(pRend, pOC)
/* in */
    ddRendererPtr       pRend;    /* renderer handle */
    miGenericStr       *pOC;      /* output command */
/* out */
{
    miDDContext		*pddc = (miDDContext *)(pRend->pDDContext);
    miMCVolume_Struct	*OC_MCV = (miMCVolume_Struct *)(pOC+1);
    listofObj		*pc_MCV;
    ddHalfSpace		*OC_HS, tmp_HS;
    int			i, count;
    ddFLOAT		length;

    static  ddFLOAT	vect_xform[4][4];

  
    pc_MCV = pddc->Dynamic->pPCAttr->modelClipVolume;
    if (!(OC_MCV->operator == PEXModelClipIntersection)) pc_MCV->numObj = 0;     
    /* invalidate flag */
    pddc->Static.misc.flags |= MCVOLUMEFLAG;


		    /* overwrite list */
    OC_HS = (ddHalfSpace *)(OC_MCV->halfspaces->pList);
    count = OC_MCV->halfspaces->numObj;
    for(i = 0; i < count; i++) {	    

	/* transform ref point and vector to world coords */
	/* transform ref point */ 

	miTransformPoint(&OC_HS->orig_point, pddc->Dynamic->mc_to_wc_xform,
                         &tmp_HS.point);

	/* transform ref vector 
	 * Vectors are transformed using the inverse transpose 
	 */

	miMatCopy(pddc->Dynamic->mc_to_wc_xform,
		  vect_xform);

	miMatInverse(vect_xform);

	miMatTranspose(vect_xform);

        miTransformVector(&OC_HS->orig_vector, vect_xform, 
                         &tmp_HS.vector);

	puAddToList(&tmp_HS, 1, pc_MCV);
	OC_HS++;
    } 

    return(Success);
}
 
/*++
 |
 |  Function Name:     miRestoreMCV 
 |
 |  Function Description:
 |      Restores the model clipping volume to that of the
 |    parent, or nil if this is the first structure.  
 |
 |  Note(s):
 |
 --*/
ddpex2rtn
miRestoreMCV(pRend, pOC)
/* in */
    ddRendererPtr       pRend;    /* renderer handle */
    miGenericStr       *pOC;      /* output command */
{


    miDDContext *thispddc = (miDDContext *)(pRend->pDDContext);
    miDynamicDDContext *parentpddc = 
			(miDynamicDDContext *)(thispddc->Dynamic->next);

    if (!(thispddc->Dynamic->next)) /* First structure */
    thispddc->Dynamic->pPCAttr->modelClipVolume->numObj = 0;
    else {
        /* invalidate flag */
        thispddc->Static.misc.flags |= MCVOLUMEFLAG;
	if (puCopyList(parentpddc->pPCAttr->modelClipVolume,
		thispddc->Dynamic->pPCAttr->modelClipVolume ))	
			
	return (BadAlloc);
    }

    return(Success);
}

/*++
 |
 |  Function Name:    miMarkerColourOC
 |
 |  Function Description:
 |     Handles PEXOCMarkerColourIndex and PEXOCMarkerColour.
 |
 |  Note(s):
 |
 --*/
ddpex2rtn
miMarkerColourOC(pRend, pOC)
/* in */
    ddRendererPtr       pRend;      /* renderer handle */
    miGenericStr       *pOC;      /* output command */
/* out */
{
    ddpex3rtn		miConvertColor();

    miDDContext		*pddc = (miDDContext *)(pRend->pDDContext);
    miColourStruct	*pMC = (miColourStruct *)(pOC+1);
    

    switch (pddc->Dynamic->pPCAttr->markerColour.colourType = pMC->colourType)
      {
	case PEXIndexedColour:
	    pddc->Dynamic->pPCAttr->markerColour.colour.indexed = 
							*pMC->colour.pIndex;
	    break;

	case PEXRgbFloatColour:
	case PEXCieFloatColour:
	case PEXHsvFloatColour:
	case PEXHlsFloatColour:
	    pddc->Dynamic->pPCAttr->markerColour.colour.rgbFloat = 
						    *pMC->colour.pRgbFloat;
	    break;

	case PEXRgb8Colour:
	    pddc->Dynamic->pPCAttr->markerColour.colour.rgb8 = 
							*pMC->colour.pRgb8;
	    break;

	case PEXRgb16Colour:
	    pddc->Dynamic->pPCAttr->markerColour.colour.rgb16 = 
							*pMC->colour.pRgb16;
	    break;
    }

    if (!(MI_DDC_IS_HIGHLIGHT(pddc))) {
	if ((pddc->Dynamic->pPCAttr->asfs & PEXMarkerColourAsf) != PEXBundled) {
	    miConvertColor(pRend, 
			   &pddc->Dynamic->pPCAttr->markerColour,
			   pddc->Dynamic->pPCAttr->rdrColourModel,
			   &pddc->Static.attrs->markerColour);
	      pddc->Static.misc.flags |= MARKERGCFLAG;
        }
    }
    return(Success);
}


/*++
 |
 |  Function Name:    miTextColourOC
 |
 |  Function Description:
 |     Handles PEXOCTextColourIndex and PEXOCTextColour.
 |
 |  Note(s):
 |
 --*/
ddpex2rtn
miTextColourOC(pRend, pOC)
/* in */
    ddRendererPtr	pRend;      /* renderer handle */
    miGenericStr	*pOC;      /* output command */
/* out */
{
    ddpex3rtn		miConvertColor();
    miDDContext		*pddc = (miDDContext *)(pRend->pDDContext);
    miColourStruct	*pTC = (miColourStruct *)(pOC+1);

    switch (pddc->Dynamic->pPCAttr->textColour.colourType = pTC->colourType)
      {
	case PEXIndexedColour:
	    pddc->Dynamic->pPCAttr->textColour.colour.indexed = 
							*pTC->colour.pIndex;
	break;

	case PEXRgbFloatColour:
	case PEXCieFloatColour:
	case PEXHsvFloatColour:
	case PEXHlsFloatColour:
	    pddc->Dynamic->pPCAttr->textColour.colour.rgbFloat = 
							*pTC->colour.pRgbFloat;
	    break;

	case PEXRgb8Colour:
	    pddc->Dynamic->pPCAttr->textColour.colour.rgb8 = 
							    *pTC->colour.pRgb8;
	    break;
	case PEXRgb16Colour:
	    pddc->Dynamic->pPCAttr->textColour.colour.rgb16 = 
							    *pTC->colour.pRgb16;
	    break;
    }

    if (!(MI_DDC_IS_HIGHLIGHT(pddc))) {
	if ((pddc->Dynamic->pPCAttr->asfs & PEXTextColourAsf) != PEXBundled) {
	    miConvertColor(pRend, 
			   &pddc->Dynamic->pPCAttr->textColour,
			   pddc->Dynamic->pPCAttr->rdrColourModel,
			   &pddc->Static.attrs->textColour);
	      pddc->Static.misc.flags |= TEXTGCFLAG;
        }
    }
    return(Success);
}


/*++
 |
 |  Function Name:    miLineColourOC
 |
 |  Function Description:
 |     Handles PEXOCLineColourIndex and PEXOCLineColour.
 |
 |  Note(s):
 |
 --*/
ddpex2rtn
miLineColourOC(pRend, pOC)
/* in */
    ddRendererPtr	pRend;      /* renderer handle */
    miGenericStr	*pOC;      /* output command */
/* out */
{
    ddpex3rtn		miConvertColor();
    miDDContext		*pddc = (miDDContext *)(pRend->pDDContext);
    miColourStruct	*pLC = (miColourStruct *)(pOC+1);

    switch (pddc->Dynamic->pPCAttr->lineColour.colourType = pLC->colourType)
      {
	case PEXIndexedColour:
	    pddc->Dynamic->pPCAttr->lineColour.colour.indexed = 
							    *pLC->colour.pIndex;
	    break;

	case PEXRgbFloatColour:
	case PEXCieFloatColour:
	case PEXHsvFloatColour:
	case PEXHlsFloatColour:
	    pddc->Dynamic->pPCAttr->lineColour.colour.rgbFloat = 
							*pLC->colour.pRgbFloat;
	    break;

	case PEXRgb8Colour:
	    pddc->Dynamic->pPCAttr->lineColour.colour.rgb8 = *pLC->colour.pRgb8;
	    break;

	case PEXRgb16Colour:
	    pddc->Dynamic->pPCAttr->lineColour.colour.rgb16 = 
							    *pLC->colour.pRgb16;
	    break;
    }

    if (!(MI_DDC_IS_HIGHLIGHT(pddc))) {
	if ((pddc->Dynamic->pPCAttr->asfs & PEXLineColourAsf) != PEXBundled) {
	    miConvertColor(pRend, 
			   &pddc->Dynamic->pPCAttr->lineColour,
			   pddc->Dynamic->pPCAttr->rdrColourModel,
			   &pddc->Static.attrs->lineColour);
	      pddc->Static.misc.flags |= POLYLINEGCFLAG;
        }
    }
    return(Success);
}

/*++
 |
 |  Function Name:    miSurfaceColourOC
 |
 |  Function Description:
 |     Handles PEXOCSurfaceColourIndex and PEXOCSurfaceColour.
 |
 |  Note(s):
 |
 --*/
ddpex2rtn
miSurfaceColourOC(pRend, pOC)
/* in */
    ddRendererPtr	pRend;      /* renderer handle */
    miGenericStr	*pOC;      /* output command */
/* out */
{
    ddpex3rtn		miConvertColor();
    miDDContext		*pddc = (miDDContext *)(pRend->pDDContext);
    miColourStruct	*pSC = (miColourStruct *)(pOC+1);

    switch (pddc->Dynamic->pPCAttr->surfaceColour.colourType=pSC->colourType)
      {
	case PEXIndexedColour:
	    pddc->Dynamic->pPCAttr->surfaceColour.colour.indexed = 
							*pSC->colour.pIndex;
	    break;

	case PEXRgbFloatColour:
	case PEXCieFloatColour:
	case PEXHsvFloatColour:
	case PEXHlsFloatColour:
	    pddc->Dynamic->pPCAttr->surfaceColour.colour.rgbFloat = 
							*pSC->colour.pRgbFloat;
	    break;
	case PEXRgb8Colour:
	    pddc->Dynamic->pPCAttr->surfaceColour.colour.rgb8 = 
							*pSC->colour.pRgb8;
	    break;

	case PEXRgb16Colour:
	    pddc->Dynamic->pPCAttr->surfaceColour.colour.rgb16 = 
							*pSC->colour.pRgb16;
	    break;
      }

    if (!(MI_DDC_IS_HIGHLIGHT(pddc))) {
	if ((pddc->Dynamic->pPCAttr->asfs & PEXSurfaceColourAsf)!=PEXBundled) {
	    miConvertColor(pRend, 
			   &pddc->Dynamic->pPCAttr->surfaceColour,
			   pddc->Dynamic->pPCAttr->rdrColourModel,
			   &pddc->Static.attrs->surfaceColour);
	      pddc->Static.misc.flags |= FILLAREAGCFLAG;
        }
    }
    return(Success);
}

/*++
 |
 |  Function Name:    miEdgeColourOC
 |
 |  Function Description:
 |     Handles PEXOCSurfaceEdgeColourIndex and PEXOCSurfaceEdgeColour.
 |
 |  Note(s):
 |
 --*/
ddpex2rtn
miEdgeColourOC(pRend, pOC)
/* in */
    ddRendererPtr	pRend;      /* renderer handle */
    miGenericStr	*pOC;      /* output command */
/* out */
{
    ddpex3rtn		miConvertColor();
    miDDContext		*pddc = (miDDContext *)(pRend->pDDContext);
    miColourStruct	*pSEC = (miColourStruct *)(pOC+1);

    switch (pddc->Dynamic->pPCAttr->edgeColour.colourType = pSEC->colourType)
      {
	case PEXIndexedColour:
	    pddc->Dynamic->pPCAttr->edgeColour.colour.indexed = 
							*pSEC->colour.pIndex;
	    break;

	case PEXRgbFloatColour:
	case PEXCieFloatColour:
	case PEXHsvFloatColour:
	case PEXHlsFloatColour:
	    pddc->Dynamic->pPCAttr->edgeColour.colour.rgbFloat = 
							*pSEC->colour.pRgbFloat;
	    break;

	case PEXRgb8Colour:
	    pddc->Dynamic->pPCAttr->edgeColour.colour.rgb8 = *pSEC->colour.pRgb8;
	    break;
	case PEXRgb16Colour:
	    pddc->Dynamic->pPCAttr->edgeColour.colour.rgb16 = 
							*pSEC->colour.pRgb16;
	    break;
      }

    if (!(MI_DDC_IS_HIGHLIGHT(pddc))) {
	if ((pddc->Dynamic->pPCAttr->asfs &PEXSurfaceEdgeColourAsf)!=PEXBundled)
	  {
	    miConvertColor(pRend, 
			   &pddc->Dynamic->pPCAttr->edgeColour,
			   pddc->Dynamic->pPCAttr->rdrColourModel,
			   &pddc->Static.attrs->edgeColour);
	      pddc->Static.misc.flags |= EDGEGCFLAG;
          }
    }
    return(Success);
}