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
|
/*
* Data structures for 2d toolkit
*
* Copyright (c) Criterion Software Limited
*/
/***************************************************************************
* *
* Module : rt2d.h *
* *
* Purpose : *
* *
**************************************************************************/
#ifndef RT2D_H
#define RT2D_H
/**
* \defgroup rt2d Rt2d
* \ingroup 2dtools
*
* 2D Rendering Toolkit for RenderWare.
*/
/**
* \defgroup rt2ddatatypes Data Types
* \ingroup rt2d
*
* Basic Data Types
*/
/**
* \defgroup rt2dsub Rt2d
* \ingroup rt2d
*
* Rt2d functions
*/
/**
* \defgroup rt2dbrush Rt2dBrush
* \ingroup rt2d
*
* Brush functions
*/
/**
* \defgroup rt2dctm Rt2dCTM
* \ingroup rt2d
*
* Current Transformation Matrix (CTM)
*/
/**
* \defgroup rt2ddevice Rt2dDevice
* \ingroup rt2d
*
* Camera device functions
*/
/**
* \defgroup rt2dfont Rt2dFont
* \ingroup rt2d
*
* Font functions
*/
/**
* \defgroup rt2dobject Rt2dObject
* \ingroup rt2d
*
* Objects
*/
/**
* \defgroup rt2dobjectstring Rt2dObjectString
* \ingroup rt2d
*
* String functions
*/
/**
* \defgroup rt2dpath Rt2dPath
* \ingroup rt2d
*
* Path functions
*/
/**
* \defgroup rt2dpickregion Rt2dPickRegion
* \ingroup rt2d
*
* Pick regions
*/
/**
* \defgroup rt2dscene Rt2dScene
* \ingroup rt2d
*
* Scenes
*/
/**
* \defgroup rt2dshape Rt2dShape
* \ingroup rt2d
*
* Shapes
*/
/**
* \defgroup rt2drwv2d RwV2d
* \ingroup rt2d
*
* Rt2d plugin directly extends the Core Library's RwV2d API functions.
*/
/****************************************************************************
Includes
*/
#include "rpworld.h"
#include "rt2d.rpe" /* automatically generated header file */
/****************************************************************************
Defines
*/
#define Rt2dBrushSetWidthMacro(_brush, _width) \
( ( (_brush)->halfwidth = ((_width) * 0.5f) ), (_brush) )
#define Rt2dBrushGetWidthMacro(_brush) \
( (_brush)->halfwidth * 2.0f )
#define Rt2dCTMReadMacro(_result) \
(RwMatrixCopy((_result), _rt2dCTMGet()), (_result))
#if defined (GCN_DRVMODEL_H)
#define VERTEXCACHESIZE 64
#else
#define VERTEXCACHESIZE 256
#endif
/****************************************************************************
Global Types
*/
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
/*
* rt2dShadeParameters
* typedef for a structure describing Shade Parameters
*/
typedef struct rt2dShadeParameters rt2dShadeParameters;
/*
*
* rt2dShadeParameters
* describes Shade Parameters
*/
#if (!defined(DOXYGEN))
struct rt2dShadeParameters
{
RwRGBAReal col; /* col */
RwV2d uv; /* uv */
};
#endif /* (!defined(DOXYGEN)) */
/**
* \ingroup rt2ddatatypes
* \struct Rt2dBrush
* Brush object.
* This should be considered an opaque type.
* Use Rt2dBrush API functions to access.
*/
typedef struct Rt2dBrush Rt2dBrush;
/*
* Rt2dBrush
* structure describing a Brush
*/
#if (!defined(DOXYGEN))
struct Rt2dBrush
{
rt2dShadeParameters top;
rt2dShadeParameters dtop;
rt2dShadeParameters bottom;
rt2dShadeParameters dbottom;
RwRGBA colorCache;
RwInt32 flag;
RwTexture *texture;
RpMaterial *material;
RwReal halfwidth;
RwInt32 refCount;
};
#endif /* (!defined(DOXYGEN)) */
/**
* \ingroup rt2ddatatypes
* \struct Rt2dPath
* Path object.
* This should be considered an opaque type.
* Use Rt2dPath API functions to access.
*/
typedef struct Rt2dPath Rt2dPath;
/**
* \ingroup rt2ddatatypes
* \struct Rt2dFont
* Font object.
* This should be considered an opaque type.
* Use Rt2dFont API functions to access.
*/
typedef struct Rt2dFont Rt2dFont;
/*
* typedef used for referencing a spot in a font dictionary
*/
typedef struct _rt2dFontDictionaryNode _rt2dFontDictionaryNode;
typedef struct Rt2dBBox Rt2dBBox;
/**
* \ingroup rt2ddatatypes
* \struct Rt2dBBox
* structure describing a Bounding Box
*/
struct Rt2dBBox
{
RwReal x; /**< x-coordinate of lower-left corner */
RwReal y; /**< y-coordinate of lower-left corner */
RwReal w; /**< Width */
RwReal h; /**< Height */
};
/**
* \ingroup rt2ddatatypes
* \struct Rt2dObject
* Structure describing a 2d Object
* This should be considered an opaque type.
* Use Rt2dObject, Rt2dScene, Rt2dShape, Rt2dPickRegion or Rt2dObjectString
* API functions to access.
*/
typedef struct Rt2dObject Rt2dObject;
/*
* typedef for a structure describing a scene of shapes (opaque)
*/
typedef struct _rt2dScene _rt2dScene;
/*
* typedef for a structure describing the depth of an object
*/
typedef struct _rt2dDepthOfObject _rt2dDepthOfObject;
#if (!defined(DOXYGEN))
/*
* typedef for a structure describing the depth of an object
*/
struct _rt2dDepthOfObject
{
Rt2dObject *object;
RwInt32 depth;
};
/*
* structure describing a scene of shapes
*/
struct _rt2dScene
{
RwSList *objects; /* collection of objects in scene */
RwInt32 objectCount; /* number of objects */
RwSList *depths; /* depths for depthsort */
RwBool isDirtyDepths; /* depthsort needs updating */
};
#endif /* (!defined(DOXYGEN)) */
/*
* typedef for a structure describing a shape (opaque)
*/
typedef struct _rt2dShape _rt2dShape;
#if (!defined(DOXYGEN))
typedef struct _rt2dShapeRep _rt2dShapeRep;
struct _rt2dShapeRep
{
RwSList *nodes; /* individual stroked/filled regions of the shape */
RwUInt32 refCount; /* number of shapes referencing this rep */
RpGeometry *geometry; /* Shareable geometry */
};
extern _rt2dShapeRep *
_rt2dShapeRepCreate();
extern RwBool
_rt2dShapeRepDestroy(_rt2dShapeRep *);
extern RwUInt32
_rt2dShapeRepAddRef(_rt2dShapeRep *);
typedef struct _rt2dSceneResourcePool _rt2dSceneResourcePool;
struct _rt2dSceneResourcePool
{
_rt2dShapeRep **shapeReps;
RwUInt32 numShapeReps;
};
extern RwBool
_rt2dSceneResourcePoolFindShapeRep(const _rt2dSceneResourcePool * pool,
const _rt2dShapeRep * rep, RwInt32 * npIndex);
struct _rt2dShape
{
_rt2dShapeRep *rep;
RwRGBA *colorCache; /* Shape's color cache */
RpAtomic *atomic; /* Atomic repn */
};
/*
* typedef for a structure describing a pick region that can be tested for point inclusion (opaque)
*/
typedef struct _rt2dPickRegion _rt2dPickRegion;
/*
* structure describing a pick region that can be tested for point inclusion
*/
struct _rt2dPickRegion
{
Rt2dPath *path; /* path that defines region for testing */
Rt2dBBox bbox; /* bounding box of path */
RwMatrix transformation;
/* ivnert transformation used to place the pick region */
};
/*
* structure describing a renderable text string
*/
struct _rt2dObjectString
{
RwChar *textString; /* Text string to be rendered */
Rt2dBrush *brush; /* Brush to be used to draw text */
RwInt32 maxLength; /* Maximum string length before reallocation, excluding null */
RwReal height; /* Font rendering Height */
_rt2dFontDictionaryNode *font; /* Dictionary node identifying font to be used */
};
#endif /* (!defined(DOXYGEN)) */
/*
* typedef for a renderable string
*/
typedef struct _rt2dObjectString _rt2dObjectString;
/**
* \ingroup rt2ddatatypes
* \ref Rt2dObjectTypeEnum
* enumeration describing types of Rt2dObject
*/
enum Rt2dObjectTypeEnum {
rt2DOBJECTTYPEOBJECT=0, /**<An untyped (yet) object */
rt2DOBJECTTYPESCENE, /**<Container of objects */
rt2DOBJECTTYPESHAPE, /**<Shape object */
rt2DOBJECTTYPEPICKREGION, /**<Pick region object */
rt2DOBJECTTYPEOBJECTSTRING, /**<Text string object */
rt2DOBJECTTYPEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT /* Ensures sizeof(enum) == sizeof(RwInt32)) */
};
typedef union _rt2dObjectdata _rt2dObjectdata;
#if (!defined(DOXYGEN))
union _rt2dObjectdata
{
_rt2dShape shape;
_rt2dScene scene;
_rt2dPickRegion pickRegion;
_rt2dObjectString objectString;
};
/*
* A base structure for forming a hierarchy of 2D shapes
*/
#define Rt2dObjectIsLocked 0x00000001
#define Rt2dObjectDirtyLTM 0x00000002
#define Rt2dObjectVisible 0x00000004
#define Rt2dObjectDirtyColor 0x00000008
#define Rt2dObjectStringGotNoFonts 0x01000000
struct Rt2dObject
{
RwInt32 type; /* tag identifying type of object */
RwInt32 depth; /* z-order of object under parent */
RwInt32 flag; /* ... */
RwMatrix MTM; /* local transformation matrix for object */
RwMatrix LTM; /* global transformation matrix for object */
RwRGBAReal colorMult; /* color multiply applied to object */
RwRGBAReal colorOffs; /* color offset applied to object */
_rt2dObjectdata data;
};
#endif /* (!defined(DOXYGEN)) */
/**
* \ingroup rt2ddatatypes
* \ref Rt2dObjectCallBack
* typedef for a callback on an object in a collection
*
* \param object is a specific object
* \param parent is the containing scene
* \param data is user data
*
* \return return value is ignored
*/
typedef Rt2dObject *(* Rt2dObjectCallBack)(Rt2dObject *object, Rt2dObject *parent, void *data);
/**
* \ingroup rt2ddatatypes
* \ref Rt2dFontCallBackRead
* Rt2dFontCallBackRead represents the function used by Rt2dFontRead to read
* the specified font from a disk file. This function should return a
* pointer to the font to indicate success. The returned font is owned by
* the Rt2d internal font dictionary, and is destroyed on calling
* \ref Rt2dClose
*
* \param name is the name of the font to read
*
* \return return the font if successful, NULL otherwise
*
* \see Rt2dFontSetReadCallBack
* \see Rt2dFontGetReadCallBack
*/
typedef Rt2dFont*(* Rt2dFontCallBackRead)(const RwChar *name);
/**
* \ingroup rt2ddatatypes
* \ref Rt2dJustificationType
* enumeration describing Justification
*/
enum Rt2dJustificationType
{
rt2dJUSTIFYLEFT, /**<Left-justification */
rt2dJUSTIFYCENTER, /**<Center-justification */
rt2dJUSTIFYRIGHT, /**<Right-justification */
rt2DJUSTIFICATIONTYPEFORCEENUMSIZEINT = RWFORCEENUMSIZEINT /* Ensures sizeof(enum) == sizeof(RwInt32)) */
};
/*
* Rt2dObjectEnum
* typedef for a enumeration describing an object type enclosed by Rt2dObject
*/
typedef enum Rt2dJustificationType Rt2dJustificationType;
/**
* \ingroup rt2ddatatypes
* \ref Rt2dShapeNodeFlag
* Passed to \ref Rt2dShapeAddNode, these flags specify
* the type and properties of the path.
*/
enum Rt2dShapeNodeFlag
{
rt2dSHAPENODEFLAGNONE = 0x0000,
rt2dSHAPENODEFLAGSOLID = 0x0001, /**< Shape's node is a solid, not outline */
rt2dSHAPENODEFLAGFORCEENUMSIZEINT = RWFORCEENUMSIZEINT /* Ensure sizeof(enum) == sizeof(RwInt32) */
};
#if (! ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) ))
#define Rt2dBrushSetWidth(_brush, _width) \
Rt2dBrushSetWidthMacro(_brush, _width)
#define Rt2dBrushGetWidth(_brush) \
Rt2dBrushGetWidthMacro(_brush)
#define Rt2dCTMRead(_result) \
Rt2dCTMReadMacro(_result)
#endif /* (! ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) )) */
/****************************************************************************
Function prototypes
*/
extern void
Rt2dBrushSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc );
extern void
Rt2dFontSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc );
extern void
Rt2dFontDictNodeSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc );
extern void
Rt2dObjectSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc );
extern void
Rt2dPathSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc );
/*
* INITIALIZE
*/
extern void
Rt2dOpen(RwCamera *cam);
extern void
Rt2dClose(void);
extern void
Rt2dTriVertSetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc );
extern void
Rt2dTriPolySetFreeListCreateParams( RwInt32 blockSize, RwInt32 numBlocksToPrealloc );
/*
* PATHS
*/
extern Rt2dPath *
Rt2dPathCreate(void);
extern RwBool
Rt2dPathDestroy(Rt2dPath *path);
extern Rt2dPath *
Rt2dPathLock(Rt2dPath *path);
extern Rt2dPath *
Rt2dPathUnlock(Rt2dPath *path);
extern RwBool
Rt2dPathIsLocked(Rt2dPath *path);
extern RwUInt32
Rt2dPathStreamGetSize(Rt2dPath *path);
extern Rt2dPath *
Rt2dPathStreamWrite(Rt2dPath *path, RwStream *stream);
extern Rt2dPath *
Rt2dPathStreamRead(RwStream *stream);
extern Rt2dPath *
Rt2dPathEmpty(Rt2dPath *path);
extern Rt2dPath *
Rt2dPathCopy(Rt2dPath *dst, const Rt2dPath *src);
extern Rt2dPath *
Rt2dPathInset(Rt2dPath *path, RwReal inset);
extern Rt2dPath *
Rt2dPathMoveto(Rt2dPath *path, RwReal x, RwReal y);
extern Rt2dPath *
Rt2dPathLineto(Rt2dPath *path, RwReal x, RwReal y);
extern Rt2dPath *
Rt2dPathRLineto(Rt2dPath *path, RwReal x, RwReal y);
extern Rt2dPath *
Rt2dPathCurveto(Rt2dPath *path, RwReal x1, RwReal y1, RwReal x2, RwReal y2, RwReal x3, RwReal y3);
extern Rt2dPath *
Rt2dPathRCurveto(Rt2dPath *path, RwReal x1, RwReal y1, RwReal x2, RwReal y2, RwReal x3, RwReal y3);
extern Rt2dPath *
Rt2dPathClose(Rt2dPath *path);
extern Rt2dPath *
Rt2dPathRect(Rt2dPath *path, RwReal x, RwReal y, RwReal w, RwReal h);
extern Rt2dPath *
Rt2dPathRoundRect(Rt2dPath *path, RwReal x, RwReal y, RwReal w, RwReal h, RwReal radius);
extern Rt2dPath *
Rt2dPathOval(Rt2dPath *path, RwReal x, RwReal y, RwReal w, RwReal h);
extern Rt2dPath *
Rt2dPathFlatten(Rt2dPath *path);
extern const Rt2dPath *
Rt2dPathGetBBox(const Rt2dPath *path, Rt2dBBox *bbox);
extern Rt2dPath *
Rt2dPathCreateMorphResultPath(Rt2dPath *path);
extern Rt2dPath *
Rt2dPathMorph(Rt2dPath *result, Rt2dPath *source, Rt2dPath *destination, RwReal alpha);
/*
* BRUSHES
*/
extern Rt2dBrush *
Rt2dBrushCreate(void);
extern RwBool
Rt2dBrushDestroy(Rt2dBrush * brush);
extern Rt2dBrush *
Rt2dBrushSetRGBA(Rt2dBrush *brush, RwRGBA * col0, RwRGBA * col1, RwRGBA * col2, RwRGBA * col3);
extern Rt2dBrush *
Rt2dBrushSetUV(Rt2dBrush *brush, RwV2d *uv0, RwV2d *uv1, RwV2d *uv2, RwV2d *uv3);
extern Rt2dBrush *
Rt2dBrushSetTexture(Rt2dBrush* brush, RwTexture* texture);
extern RwUInt32
Rt2dBrushStreamGetSize(Rt2dBrush *brush);
extern Rt2dBrush *
Rt2dBrushStreamWrite(Rt2dBrush *brush, RwStream *stream);
extern Rt2dBrush *
Rt2dBrushStreamRead(RwStream *stream);
/*
* FONTS
*/
extern const RwChar *
Rt2dFontSetPath(const RwChar *path);
extern Rt2dFont *
Rt2dFontRead(const RwChar *name);
extern RwBool
Rt2dFontSetReadCallBack(Rt2dFontCallBackRead fpCallBack);
extern Rt2dFontCallBackRead
Rt2dFontGetReadCallBack (void);
extern RwUInt32
_rt2dFontStreamGetSize(Rt2dFont *font);
extern Rt2dFont *
_rt2dFontStreamWrite(Rt2dFont *font, RwStream *stream);
extern Rt2dFont *
_rt2dFontStreamRead(RwStream *stream);
extern RwBool
Rt2dFontDestroy(Rt2dFont *font);
extern RwReal
Rt2dFontGetHeight(Rt2dFont *font);
extern RwReal
Rt2dFontGetStringWidth(Rt2dFont *font, const RwChar *string, RwReal height);
extern Rt2dFont *
Rt2dFontShow(Rt2dFont *font, const RwChar *string, RwReal height, RwV2d *anchor, Rt2dBrush *brush);
extern Rt2dFont *
Rt2dFontFlow(Rt2dFont* font, RwChar* string, RwReal height, Rt2dBBox* bbox, Rt2dJustificationType format, Rt2dBrush* brush);
extern Rt2dFont *
Rt2dFontSetIntergapSpacing(Rt2dFont *font, RwReal gap);
extern RwBool
Rt2dFontCacheFlush(void);
/*
* FILLING
*/
extern Rt2dPath *
Rt2dPathFill(Rt2dPath *path, Rt2dBrush *brush);
/*
* STROKING
*/
extern Rt2dPath *
Rt2dPathStroke(Rt2dPath *path, Rt2dBrush *brush);
/*
* TRANSFORMS
*/
extern RwBool
Rt2dCTMPush(void);
extern RwBool
Rt2dCTMPop(void);
extern RwBool
Rt2dCTMSetIdentity(void);
extern RwBool
Rt2dCTMScale(RwReal x, RwReal y);
extern RwBool
Rt2dCTMTranslate(RwReal x, RwReal y);
extern RwBool
Rt2dCTMRotate(RwReal theta);
extern RwBool
RwV2dIsInPath(RwV2d *point, Rt2dPath *path);
extern RwV2d *
RwV2dInvertTransform(RwV2d *pointOut, RwV2d *pointIn);
/*
* DEVICE SETTINGS
*/
extern RwBool
Rt2dDeviceSetCamera(RwCamera *cam);
extern RwCamera *
Rt2dDeviceGetCamera(void);
extern RwBool
Rt2dDeviceGetStep(RwV2d *xstep, RwV2d *ystep, RwV2d *origin);
extern RwBool
Rt2dDeviceSetMetric(RwReal x, RwReal y, RwReal w, RwReal h);
extern RwBool
Rt2dDeviceGetMetric(RwReal *x, RwReal *y, RwReal *w, RwReal *h);
extern RwBool
Rt2dDeviceSetFlat(RwReal r);
extern RwBool
Rt2dDeviceGetClippath(Rt2dPath *path);
extern RwBool
Rt2dVisible(RwReal x, RwReal y, RwReal w, RwReal h);
extern RwBool
Rt2dDeviceSetLayerDepth(RwReal depth);
extern RwBool
Rt2dSetPipelineFlags(RwUInt32 flags);
/*
* HIERARCHICAL SCENE FUNCTIONS - OBJECT MANIPULATION
*/
extern Rt2dObject *
Rt2dObjectSetVisible(Rt2dObject *object,RwBool visible);
extern RwBool
Rt2dObjectIsVisible(Rt2dObject *object);
extern void
Rt2dObjectMTMChanged(Rt2dObject *object);
extern RwMatrix *
Rt2dObjectGetLTM(Rt2dObject *object);
extern RwMatrix *
Rt2dObjectGetMTM(Rt2dObject *object);
extern Rt2dObject *
Rt2dObjectSetMTM(Rt2dObject *object, RwMatrix *mtm);
extern void
Rt2dObjectApplyCTM(Rt2dObject *object);
extern Rt2dObject *
Rt2dObjectMTMSetIdentity(Rt2dObject *object);
extern Rt2dObject *
Rt2dObjectMTMScale(Rt2dObject *object, RwReal x, RwReal y);
extern Rt2dObject *
Rt2dObjectMTMTranslate(Rt2dObject *object, RwReal x, RwReal y);
extern Rt2dObject *
Rt2dObjectMTMRotate(Rt2dObject *object, RwReal theta);
extern RwRGBAReal *
Rt2dObjectGetColorMultiplier(Rt2dObject *object);
extern Rt2dObject *
Rt2dObjectSetColorMultiplier(Rt2dObject *object, RwRGBAReal *multCol);
extern RwRGBAReal *
Rt2dObjectGetColorOffset(Rt2dObject *object);
extern Rt2dObject *
Rt2dObjectSetColorOffset(Rt2dObject *object, RwRGBAReal *oofsCol);
extern RwInt32
Rt2dObjectGetObjectType(Rt2dObject *object);
extern RwInt32
Rt2dObjectGetDepth(Rt2dObject *object);
extern Rt2dObject *
Rt2dObjectSetDepth(Rt2dObject *object, RwInt32 depth);
extern RwBool
Rt2dObjectIsScene(Rt2dObject *object);
extern RwBool
Rt2dObjectIsShape(Rt2dObject *object);
extern RwBool
Rt2dObjectIsPickRegion(Rt2dObject *object);
extern RwBool
Rt2dObjectIsObjectString(Rt2dObject *object);
extern Rt2dObject *
Rt2dObjectCopy(Rt2dObject *dst, Rt2dObject *src);
/* in-place dst version, destruction not req */
extern Rt2dObject *
_rt2dObjectCopy(Rt2dObject *dst, Rt2dObject *src);
/*
* HIERARCHICAL SCENE FUNCTIONS - SCENE
*/
extern Rt2dObject *
Rt2dSceneCreate(void);
extern RwBool
Rt2dSceneDestroy(Rt2dObject *scene);
extern Rt2dObject *
Rt2dSceneLock(Rt2dObject *object);
extern Rt2dObject *
Rt2dSceneUnlock(Rt2dObject *object);
extern RwInt32
Rt2dSceneGetChildCount(Rt2dObject *scene);
extern Rt2dObject *
Rt2dSceneGetChildByIndex(Rt2dObject *scene, RwInt32 index);
extern RwV2d
Rt2dSceneGetCoordFromScreen(Rt2dObject *scene,RwV2d screenCoord );
extern Rt2dObject *
Rt2dSceneAddChild(Rt2dObject *scene, Rt2dObject *object);
/* Those are keeped for compatiblity with the present code */
extern Rt2dObject *
Rt2dSceneGetNewChildScene(Rt2dObject *object);
extern Rt2dObject *
Rt2dSceneGetNewChildShape(Rt2dObject *object);
extern Rt2dObject *
Rt2dSceneGetNewChildPickRegion(Rt2dObject *object);
extern Rt2dObject *
Rt2dSceneGetNewChildObjectString(Rt2dObject *object, const RwChar *text,
const RwChar *font);
extern Rt2dObject *
Rt2dSceneStreamWrite(Rt2dObject *shape, RwStream *stream);
extern RwUInt32
Rt2dSceneStreamGetSize(Rt2dObject *scene);
extern Rt2dObject *
Rt2dSceneStreamRead(RwStream *stream);
extern Rt2dObject *
Rt2dSceneRender(Rt2dObject *object);
extern Rt2dObject *
Rt2dSceneForAllChildren(Rt2dObject *scene, Rt2dObjectCallBack callback, void *pData );
extern Rt2dObject *
Rt2dSceneSetDepthDirty(Rt2dObject *scene);
extern Rt2dObject *
Rt2dSceneUpdateLTM(Rt2dObject *scene);
/*
* HIERARCHICAL SCENE FUNCTIONS - SHAPE
*/
extern Rt2dObject *
Rt2dShapeCreate(void);
extern RwBool
Rt2dShapeDestroy(Rt2dObject * shape);
extern Rt2dObject *
Rt2dShapeAddNode(Rt2dObject *shape, RwUInt32 flag, Rt2dPath *path, Rt2dBrush *brush );
extern RwInt32
Rt2dShapeGetNodeCount(Rt2dObject *shape);
extern Rt2dObject *
Rt2dShapeStreamWrite(Rt2dObject *shape, RwStream *stream);
extern RwUInt32
Rt2dShapeStreamGetSize(Rt2dObject *shape);
extern Rt2dObject *
Rt2dShapeStreamRead(RwStream *stream);
extern Rt2dObject *
Rt2dShapeRender(Rt2dObject *object);
extern Rt2dObject *
Rt2dShapeMorph(Rt2dObject *result,
Rt2dObject *source,
Rt2dObject *destination,
RwReal alpha);
extern Rt2dObject *
Rt2dShapeLock(Rt2dObject * shape);
extern Rt2dObject *
Rt2dShapeUnlock(Rt2dObject * shape);
/*
* HIERARCHICAL SCENE FUNCTIONS - PICK REGION
*/
extern Rt2dObject *
Rt2dPickRegionCreate(void);
extern RwBool
Rt2dPickRegionDestroy(Rt2dObject *pickRegion);
extern Rt2dPath *
Rt2dPickRegionGetPath(Rt2dObject *pickRegion);
extern RwBool
Rt2dPickRegionIsPointIn(Rt2dObject *pickRegion, RwV2d *point);
extern Rt2dObject *
Rt2dPickRegionStreamWrite(Rt2dObject *pickRegion, RwStream *stream);
extern RwUInt32
Rt2dPickRegionStreamGetSize(Rt2dObject *pickRegion);
extern Rt2dObject *
Rt2dPickRegionStreamRead(RwStream *stream);
/*
* HIERARCHICAL SCENE FUNCTIONS - TEXT STRINGS
*/
extern Rt2dObject *
Rt2dObjectStringCreate(const RwChar *textString, const RwChar *font);
extern RwBool
Rt2dObjectStringDestroy(Rt2dObject *object);
extern Rt2dBrush *
Rt2dObjectStringGetBrush(Rt2dObject *object);
extern RwChar *
Rt2dObjectStringGetText(Rt2dObject *object);
extern RwChar *
Rt2dObjectStringGetFont(Rt2dObject *object);
extern RwReal
Rt2dObjectStringGetHeight(Rt2dObject *object);
extern Rt2dObject *
Rt2dObjectStringSetBrush(Rt2dObject *object, Rt2dBrush *);
extern Rt2dObject *
Rt2dObjectStringSetText(Rt2dObject *object, const RwChar *text);
extern Rt2dObject *
Rt2dObjectStringSetFont(Rt2dObject *object, const RwChar *font);
extern Rt2dObject *
Rt2dObjectStringSetHeight(Rt2dObject *object, const RwReal height);
extern Rt2dObject *
Rt2dObjectStringStreamRead(RwStream *stream);
extern Rt2dObject *
Rt2dObjectStringStreamWrite(Rt2dObject *object, RwStream *stream);
extern RwUInt32
Rt2dObjectStringStreamGetSize(Rt2dObject *object);
extern Rt2dObject *
Rt2dObjectStringRender(Rt2dObject *object);
/*
* SPI for macros
*/
extern RwBool
_rt2dCTMPush(RwMatrix *matrix);
extern RwBool
_rt2dCTMSet(RwMatrix *matrix);
extern RwMatrix *
_rt2dCTMGet(void);
extern RwMatrix *
_rt2dCTMGetDirect(void);
#if ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) )
extern Rt2dBrush *
Rt2dBrushSetWidth(Rt2dBrush *brush, RwReal width);
extern RwReal
Rt2dBrushGetWidth(Rt2dBrush * brush);
extern RwMatrix *
Rt2dCTMRead(RwMatrix * result);
#endif /* ( defined(RWDEBUG) || defined(RWSUPPRESSINLINE) ) */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#define Rt2dFontStreamGetSize(_font) \
_rt2dFontStreamGetSize(_font)
#define Rt2dFontStreamWrite(_font,_stream) \
_rt2dFontStreamWrite(_font,_stream)
#define Rt2dFontStreamRead(_stream) \
_rt2dFontStreamRead(_stream)
#endif /* RT2D_H */
|