summaryrefslogtreecommitdiff
path: root/support/dktools/dk4graa.h
blob: d4e542c03a40553f107ba0c8b5d990053e8a5eae (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
/*
Copyright (C) 2018-2020, Dirk Krause
SPDX-License-Identifier: BSD-3-Clause
*/

/*
	WARNING: This file was generated by the dkct program (see
	http://dktools.sourceforge.net/ for details).
	Changes you make here will be lost if dkct is run again!
	You should modify the original source and run dkct on it.
	Original source: dk4graa.ctr
*/

#ifndef DK4GRAA_H_INCLUDED
/** Avoid multiple inclusions. */
#define DK4GRAA_H_INCLUDED 1


#line 9 "dk4graa.ctr"

/**	@file	dk4graa.h	Graphics output (PS/EPS/PDF/PGF),  application support.
*/


#ifndef	DK4CONF_H_INCLUDED
#if DK4_BUILDING_DKTOOLS4
#include "dk4conf.h"
#else
#include <dktools-4/dk4conf.h>
#endif
#endif

#ifndef	DK4GRA_H_INCLUDED
#if DK4_BUILDING_DKTOOLS4
#include "dk4gra.h"
#else
#include <dktools-4/dk4gra.h>
#endif
#endif

#ifndef	DK4APP_H_INCLUDED
#if DK4_BUILDING_DKTOOLS4
#include "dk4app.h"
#else
#include <dktools-4/dk4app.h>
#endif
#endif


#ifdef	__cplusplus
extern "C" {
#endif

/**	Open output structure to create a PDF file.
	@param	fn		File name for output file, NULL for standard output.
	@param	w		Image width in bp.
	@param	h		Image height in bp.
	@param	docfl	Document flag set.
	@param	app		Application structure for diagnostics, may be NULL.
	@return	Valid pointer to new structure on success, NULL on error.
*/

dk4_gra_t *
dk4gra_app_open_pdf(
	const dkChar	*fn,
	size_t			 w,
	size_t			 h,
	int				 docfl,
	dk4_app_t		*app
);


/**	Open output structure to create a PS or EPS file.
	@param	fn		File name for output file, NULL for standard output.
	@param	w		Image width in bp.
	@param	h		Image height in bp.
	@param	docfl	Flag set, or combination of:
					- DK4_GRA_DOC_FLAG_PS2<br>
					  to produce PS level 2 instead of level 3,
					- DK4_GRA_DOC_FLAG_EPS<br>
					  to produce EPS instead of PS,
					- DK4_GRA_DOC_FLAG_PS_DSC<br>
					  to write document structuring comments.
	@param	app		Application structure for diagnostics, may be NULL.
	@return	Valid pointer to new structure on success, NULL on error.
*/

dk4_gra_t *
dk4gra_app_open_ps(
	const dkChar	*fn,
	size_t			 w,
	size_t			 h,
	int				 docfl,
	dk4_app_t		*app
);


/**	Open output structure to create a PGF file.
	@param	fn		File name for output file, NULL for standard output.
	@param	w		Image width in bp.
	@param	h		Image height in bp.
	@param	docfl	Document flag set.
	@param	sa		Flag: Produce standalone TeX file.
	@param	app	Application structure for diagnostics, may be NULL.
	@return	Valid pointer to new structure on success, NULL on error.
*/

dk4_gra_t *
dk4gra_app_open_pgf(
	const dkChar	*fn,
	size_t			 w,
	size_t			 h,
	int				 docfl,
	int				 sa,
	dk4_app_t		*app
);


/**	Write output file and close output structure.
	@param	gra		Output structure.
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_write_and_close(
	dk4_gra_t		*gra,
	int				*backptr,
	dk4_app_t		*app
);


/**	Write output file and close output structure.
	@param	fout	Output file already opened.
	@param	gra		Output structure.
	@param	app		Application structure for diagnostics, may be NULL.
	@param	backptr	Address of success variable to reset on errors.
*/
void
dk4gra_app_write_file_and_close(
	FILE			*fout,
	dk4_gra_t		*gra,
	int				*backptr,
	dk4_app_t		*app
);


/**	Set color space conversion context.
	@param	gra		Output structure.
	@param	ctx		Color space conversion context to copy.
	@param	backptr	Application structure for diagnostics, may be NULL.
	@param	app		Application structure for diagnostics, may be NULL.
*/
void
dk4gra_app_set_color_conversion(
	dk4_gra_t				*gra,
	dk4_cs_conv_ctx_t const	*ctx,
	int						*backptr,
	dk4_app_t				*app
);


/**	Start new page.
	Default flags are used for the page:
	- The clip path is set to the image dimensions.
	- Background is filled white.
	- For PDF the contents stream is compressed.
	To start a new page with different setup, use dk4gra_page_with_flags()
	instead and specify flags.
	@param	gra		Output structure.
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_page(
	dk4_gra_t		*gra,
	int				*backptr,
	dk4_app_t		*app
);


/**	Start new page with non-default setup.
	@param	gra		Output structure.
	@param	flags	Or-combined flags:
					- DK4_GRA_PAGE_FLAG_NO_CLIP<br>
					  to avoid setting the clip path at start of page,
					- DK4_GRA_PAGE_FLAG_NO_BG<br>
					  to avoid white background filling,
					- DK4_GRA_PAGE_FLAG_NOT_COMPRESSED<br>
					  to avoid compression of page content stream in PDF.
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_page_with_flags(
	dk4_gra_t		*gra,
	int				 flags,
	int				*backptr,
	dk4_app_t		*app
);


/**	Set flag for simplified gsave/grestore handling.
	Set this flag, if you use gsave and grestore only when dealing
	with clip path for pattern filling.
	@param	gra	Output structure.
	@param	val	New flag value.
	@param	app	Application structure for diagnostics, may be NULL.
*/
void
dk4gra_app_set_gs_for_pattern_only(
	dk4_gra_t		*gra,
	int				 val,
	dk4_app_t		*app
);


/**	Save current graphics state (especially clip path).
	@param	gra		Output structure.
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_gsave(
	dk4_gra_t		*gra,
	int				*backptr,
	dk4_app_t		*app
);


/**	Restore graphics state (especially clip path).
	@param	gra		Output structure.
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_grestore(
	dk4_gra_t		*gra,
	int				*backptr,
	dk4_app_t		*app
);



/**	Set line width.
	@param	gra		Output structure.
	@param	lw		Line width in bp.
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_set_line_width(
	dk4_gra_t		*gra,
	double			 lw,
	int				*backptr,
	dk4_app_t		*app
);


/**	Set line style.
	@param	gra		Output structure.
	@param	ls		Line style.
	@param	sv		Style value (dash length in bp).
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_set_line_style(
	dk4_gra_t		*gra,
	dk4_gra_ls_t	 ls,
	double			 sv,
	int				*backptr,
	dk4_app_t		*app
);


/**	Set line cap.
	@param	gra		Output structure.
	@param	lc		Line cap type.
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_set_line_cap(
	dk4_gra_t		*gra,
	dk4_gra_lc_t	 lc,
	int				*backptr,
	dk4_app_t		*app
);


/**	Set line join.
	@param	gra		Output structure.
	@param	lj		Line join type.
	@param	ml		Miter limit, only used if lj is DK4_GRA_LJ_MITERED.
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_set_line_join(
	dk4_gra_t		*gra,
	dk4_gra_lj_t	 lj,
	double			 ml,
	int				*backptr,
	dk4_app_t		*app
);


/**	Set fill color to gray.
	@param	gra		Output structure.
	@param	g		Gray value in interval 0 to 1.
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_set_fill_gray(
	dk4_gra_t		*gra,
	double			 g,
	int				*backptr,
	dk4_app_t		*app
);


/**	Set fill color to RGB.
	@param	gra		Output structure.
	@param	r		Red value in interval 0 to 1.
	@param	g		Green value in interval 0 to 1.
	@param	b		Blue value in interval 0 to 1.
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_set_fill_rgb(
	dk4_gra_t		*gra,
	double			 r,
	double			 g,
	double			 b,
	int				*backptr,
	dk4_app_t		*app
);


/**	Set fill color to CMYK.
	@param	gra		Output structure.
	@param	c		Cyan value in interval 0 to 1.
	@param	m		Magenta value in interval 0 to 1.
	@param	y		Yellow value in interval 0 to 1.
	@param	k		Black value in interval 0 to 1.
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_set_fill_cmyk(
	dk4_gra_t		*gra,
	double			 c,
	double			 m,
	double			 y,
	double			 k,
	int				*backptr,
	dk4_app_t		*app
);


/**	Set stroke color to gray.
	@param	gra		Output structure.
	@param	g		Gray value in interval 0 to 1.
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_set_stroke_gray(
	dk4_gra_t		*gra,
	double			 g,
	int				*backptr,
	dk4_app_t		*app
);


/**	Set stroke color to RGB.
	@param	gra		Output structure.
	@param	r		Red value in interval 0 to 1.
	@param	g		Green value in interval 0 to 1.
	@param	b		Blue value in interval 0 to 1.
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_set_stroke_rgb(
	dk4_gra_t		*gra,
	double			 r,
	double			 g,
	double			 b,
	int				*backptr,
	dk4_app_t		*app
);


/**	Set stroke color to CMYK.
	@param	gra		Output structure.
	@param	c		Cyan value in interval 0 to 1.
	@param	m		Magenta value in interval 0 to 1.
	@param	y		Yellow value in interval 0 to 1.
	@param	k		Black value in interval 0 to 1.
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_set_stroke_cmyk(
	dk4_gra_t		*gra,
	double			 c,
	double			 m,
	double			 y,
	double			 k,
	int				*backptr,
	dk4_app_t		*app
);



/**	Prepare output structure for a fill operation.
	Use this function before you start to construct a path you plan to fill.
	@param	gra		Output structure.
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_prepare_fill(
	dk4_gra_t	*gra,
	int			*backptr,
	dk4_app_t	*app
);


/**	Prepare output structure for a stroke operation.
	Use this function before you start to construct a path you plan to stroke.
	@param	gra		Output structure.
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_prepare_stroke(
	dk4_gra_t	*gra,
	int			*backptr,
	dk4_app_t	*app
);


/**	Prepare output structure for a combined fill and stroke operation.
	Use this function before you start to construct a path you plan to
	fill and stroke.
	@param	gra		Output structure.
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_prepare_fill_and_stroke(
	dk4_gra_t	*gra,
	int			*backptr,
	dk4_app_t	*app
);



/**	Fill current path.
	Note: Use dk4gra_prepare_fill() before you start to construct a path
	you plan to fill.
	The value of the even-odd-rule flag is used to choose either
	even-odd-rule or nonzero-winding-rule, the dk4gra_set_eorule() function
	can be used to set the flag.
	@param	gra		Output structure.
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_fill(
	dk4_gra_t		*gra,
	int				*backptr,
	dk4_app_t		*app
);


/**	Stroke current path.
	Note: Use dk4gra_app_prepare_stroke() before you start to construct a path
	you plan to stroke.
	@param	gra		Output structure.
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_stroke(
	dk4_gra_t		*gra,
	int				*backptr,
	dk4_app_t		*app
);


/**	Fill and stroke current path.
	Note: Use dk4gra_app_prepare_fill_and_stroke() before you start to construct
	a path you plan to fill and stroke.
	The value of the even-odd-rule flag is used to choose either
	even-odd-rule or nonzero-winding-rule, the dk4gra_app_set_eorule() function
	can be used to set the flag.
	@param	gra		Output structure.
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_fill_and_stroke(
	dk4_gra_t		*gra,
	int				*backptr,
	dk4_app_t		*app
);


/**	Use current path for clipping.
	The value of the even-odd-rule flag is used to choose either
	even-odd-rule or nonzero-winding-rule, the dk4gra_app_set_eorule() function
	can be used to set the flag.
	@param	gra		Output structure.
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_clip(
	dk4_gra_t		*gra,
	int				*backptr,
	dk4_app_t		*app
);


/**	Pattern a region (clipping should be set to the path).
	@param	gra		Output structure.
	@param	xl		Left y coordinate.
	@param	xr		Right x coordinate.
	@param	yb		Bottom y coordinate.
	@param	yt		Top y coordinate.
	@param	pn		Pattern number.
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_pattern(
	dk4_gra_t			*gra,
	double				 xl,
	double				 xr,
	double				 yb,
	double				 yt,
	dk4_gra_pattern_t	 pn,
	int					*backptr,
	dk4_app_t			*app
);



/**	Start a new path and move to first point.
	@param	gra		Output structure.
	@param	x		X coordinate of start point.
	@param	y		Y coordinate of start point.
	@param	bbptr	Bounding box, may be NULL.
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_newpath_moveto(
	dk4_gra_t		*gra,
	double			 x,
	double			 y,
	dk4_bb_t		*bbptr,
	int				*backptr,
	dk4_app_t		*app
);


/**	Add line from current point to new point to path.
	@param	gra		Output structure.
	@param	x		X coordinate of new point.
	@param	y		Y coordinate of new point.
	@param	bbptr	Bounding box, may be NULL.
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_lineto(
	dk4_gra_t		*gra,
	double			 x,
	double			 y,
	dk4_bb_t		*bbptr,
	int				*backptr,
	dk4_app_t		*app
);


/**	Add Bezier curve segment from current point to new point in path.
	@param	gra		Output structure.
	@param	xc1		X coordinate of first control point.
	@param	yc1		Y coordinate of first control point.
	@param	xc2		X coordinate of second control point.
	@param	yc2		Y coordinate of second control point.
	@param	x		X coordinate of new point.
	@param	y		Y coordinate of new point.
	@param	bbptr	Bounding box, may be NULL.
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_curveto(
	dk4_gra_t		*gra,
	double			 xc1,
	double			 yc1,
	double			 xc2,
	double			 yc2,
	double			 x,
	double			 y,
	dk4_bb_t		*bbptr,
	int				*backptr,
	dk4_app_t		*app
);


/**	Close current path.
	@param	gra		Output structure.
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_closepath(
	dk4_gra_t		*gra,
	int				*backptr,
	dk4_app_t		*app
);


/**	Create path for a circle.
	@param	gra		Output structure.
	@param	xc		Center point x coordinate.
	@param	yc		Center point y coordinate.
	@param	r		Radius.
	@param	bbptr	Bounding box, may be NULL.
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_circle(
	dk4_gra_t		*gra,
	double			 xc,
	double			 yc,
	double			 r,
	dk4_bb_t		*bbptr,
	int				*backptr,
	dk4_app_t		*app
);


/**	Create path for rectangle parallel to axes, optionally with
	rounded corners.
	@param	gra		Output structure.
	@param	xl		Left x coordinate.
	@param	xr		Right x coordinate.
	@param	yb		Bottom y coordinate.
	@param	yt		Top y coordinate.
	@param	r		Corner radius, maximum is a half of the smaller side length.
					Use negative values to avoid rounded corners.
	@param	bbptr	Bounding box, may be NULL.
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_rectangle(
	dk4_gra_t		*gra,
	double			 xl,
	double			 xr,
	double			 yb,
	double			 yt,
	double			 r,
	dk4_bb_t		*bbptr,
	int				*backptr,
	dk4_app_t		*app
);


/**	Add path for an arc.
	@param	gra		Output structure.
	@param	xc		Center point x coordinate.
	@param	yc		Center point y coordinate.
	@param	ra		Radius.
	@param	start	Start angle in degree.
	@param	end		End angle in degree.
	@param	cl		Flag: Draw closed arc (piece of cake) instead of simple arc.
	@param	bbptr	Bounding box, may be NULL.
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_arc(
	dk4_gra_t		*gra,
	double			 xc,
	double			 yc,
	double			 ra,
	double			 start,
	double			 end,
	int				 cl,
	dk4_bb_t		*bbptr,
	int				*backptr,
	dk4_app_t		*app
);


/**	Create path for an ellipse.
	@param	gra		Output structure.
	@param	xc		Center point x coordinate.
	@param	yc		Center point y coordinate.
	@param	rx		Radius in x direction.
	@param	ry		Radius in y direction.
	@param	rot		Rotation counterclockwise in degree.
	@param	bbptr	Bounding box, may be NULL.
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_ellipse(
	dk4_gra_t		*gra,
	double			 xc,
	double			 yc,
	double			 rx,
	double			 ry,
	double			 rot,
	dk4_bb_t		*bbptr,
	int				*backptr,
	dk4_app_t		*app
);


/**	Add simple (non-special) text to PGF graphics.
	The text is shown in the current fill color (non-stroking color)
	unless colspec is used to specify a color.
	@param	gra		Output structure, must be initialized for PGF.
	@param	x		X coordinate.
	@param	y		Y coordinate.
	@param	rot		Rotation counterclockwise in degree.
	@param	txt		Text to show.
	@param	colspec	Color specification, may be NULL to use fill color.
	@param	ie		Text encoding, only used for char text.
	@param	ha		Horizontal alignment.
	@param	va		Vertical alignment.
	@param	fno		Font number.
	@param	fsz		Font size in pt.
	@param	fex		Flag: Use exact font (1) or similar font (0).
	@param	uc2l	UC to LaTeX conversion structure.
	@param	flags	Text flags DK4_GRA_TEXT_FLAG_xxx, can be or-combined.
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_pgf_simple_text(
	dk4_gra_t			*gra,
	double				 x,
	double				 y,
	double				 rot,
	const dkChar		*txt,
	const char			*colspec,
	int					 ie,
	dk4_text_align_h_t	 ha,
	dk4_text_align_v_t	 va,
	int					 fno,
	double				 fsz,
	dk4_gra_tf_t		 fex,
	dk4_uc2l_t			*uc2l,
	int					 flags,
	int					*backptr,
	dk4_app_t			*app
);


/**	Add special text to PGF graphics.
	The text is shown in the current fill color (non-stroking color)
	unless colspec is used to specify a color.
	@param	gra		Output structure, must be initialized for PGF.
	@param	x		X coordinate.
	@param	y		Y coordinate.
	@param	rot		Rotation counterclockwise in degree.
	@param	txt		Text to show.
	@param	colspec	Color specification, may be NULL.
	@param	ha		Horizontal alignment.
	@param	va		Vertical alignment.
	@param	fno		Font number.
	@param	fsz		Font size in pt.
	@param	fex		Flag: Use exact font.
	@param	flags	Text flags DK4_GRA_TEXT_FLAG_xxx, can be or-combined.
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_pgf_special_text(
	dk4_gra_t			*gra,
	double				 x,
	double				 y,
	double				 rot,
	const char			*txt,
	const char			*colspec,
	dk4_text_align_h_t	 ha,
	dk4_text_align_v_t	 va,
	int					 fno,
	double				 fsz,
	dk4_gra_tf_t		 fex,
	int					 flags,
	int					*backptr,
	dk4_app_t			*app
);


/**	Add bitmap image with coordinate transformations already calculated.
	@param	gra		Output structure.
	@param	cotra	Array containing coordinate transformations.
	@param	bif		Bitmap image file.
	@param	fn		Image file name.
	@param	fno		Frame number. The frame number given here is used
	by the PDF output driver only. You must call
	dk4bif_set_current_frame() on the bitmap image file before calling
	this function.
	@param	ifl		Image flags.
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_bif_cotra_image(
	dk4_gra_t			*gra,
	double				*cotra,
	dk4_bif_t			*bif,
	const dkChar		*fn,
	size_t				 fno,
	int					 ifl,
	int					*backptr,
	dk4_app_t			*app
);


/**	Add bitmap image XFig style.
	@param	gra		Output structure.
	@param	xl		Left x coordinate.
	@param	xr		Right x coordinate.
	@param	yb		Bottom y coordinate.
	@param	yt		Top y coordinate.
	@param	bif		Bitmap image file.
	@param	fn		Image file name.
	@param	fno		Frame number (0 for first frame).
	@param	pos		Image positioning:
	- 0 not rotated, not flipped,
	- 1 rotated 90 degree counterclockwise, not flipped,
	- 2 rotated 180 degree counterclockwise, not flipped,
	- 3 rotated 270 degree counterclockwise, not flipped,
	- 4 not rotated, flipped,
	- 5 rotated 90 degree counterclockwise, flipped,
	- 6 rotated 180 degree counterclockwise, flipped,
	- 7 rotated 270 degree counterclockwise, flipped.
	@param	ifl		Image flags.
	@param	bbptr	Bounding box, may be NULL.
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_bif_fig_image(
	dk4_gra_t			*gra,
	double				 xl,
	double				 xr,
	double				 yb,
	double				 yt,
	dk4_bif_t			*bif,
	const dkChar		*fn,
	size_t				 fno,
	int					 pos,
	int					 ifl,
	dk4_bb_t			*bbptr,
	int					*backptr,
	dk4_app_t			*app
);


/**	Add bitmap image.
	@param	gra		Output structure.
	@param	xl		Left x coordinate.
	@param	xr		Right x coordinate.
	@param	yb		Bottom y coordinate.
	@param	yt		Top y coordinate.
	@param	bif		Bitmap image file data.
	@param	fn		Image file name.
	@param	fno		Frame number (0 for first frame).
	@param	ifl		Image flags.
	@param	bbptr	Bounding box, may be NULL.
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_bif_image(
	dk4_gra_t			*gra,
	double				 xl,
	double				 xr,
	double				 yb,
	double				 yt,
	dk4_bif_t			*bif,
	const dkChar		*fn,
	size_t				 fno,
	int					 ifl,
	dk4_bb_t			*bbptr,
	int					*backptr,
	dk4_app_t			*app
);


/**	Add bitmap image.
	@param	gra		Output structure.
	@param	xl		Left x coordinate.
	@param	xr		Right x coordinate.
	@param	yb		Bottom y coordinate.
	@param	yt		Top y coordinate.
	@param	fn		Image file name.
	@param	fno		Frame number (0 for first frame).
	@param	ctx		Bitmap image conversion context, may be NULL.
	@param	ifl		Image flags.
	@param	bbptr	Bounding box, may be NULL.
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_image(
	dk4_gra_t			*gra,
	double				 xl,
	double				 xr,
	double				 yb,
	double				 yt,
	const dkChar		*fn,
	size_t				 fno,
	dk4_cs_conv_ctx_t	*ctx,
	int					 ifl,
	dk4_bb_t			*bbptr,
	int					*backptr,
	dk4_app_t			*app
);


/**	Add bitmap image XFig style.
	@param	gra		Output structure.
	@param	xl		Left x coordinate.
	@param	xr		Right x coordinate.
	@param	yb		Bottom y coordinate.
	@param	yt		Top y coordinate.
	@param	fn		Image file name.
	@param	fno		Frame number (0 for first frame).
	@param	ctx		Bitmap image conversion context, may be NULL.
	@param	pos		Image positioning:
	- 0 not rotated, not flipped,
	- 1 rotated 90 degree counterclockwise, not flipped,
	- 2 rotated 180 degree counterclockwise, not flipped,
	- 3 rotated 270 degree counterclockwise, not flipped,
	- 4 not rotated, flipped,
	- 5 rotated 90 degree counterclockwise, flipped,
	- 6 rotated 180 degree counterclockwise, flipped,
	- 7 rotated 270 degree counterclockwise, flipped.
	@param	ifl		Image flags.
	@param	bbptr	Bounding box, may be NULL.
	@param	backptr	Address of success variable to reset on errors.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_fig_image(
	dk4_gra_t			*gra,
	double				 xl,
	double				 xr,
	double				 yb,
	double				 yt,
	const dkChar		*fn,
	size_t				 fno,
	dk4_cs_conv_ctx_t	*ctx,
	int					 pos,
	int					 ifl,
	dk4_bb_t			*bbptr,
	int					*backptr,
	dk4_app_t			*app
);


/**	Set the font size for the documentclass line.
	@param	gra		Output structure, must be initialized for PGF.
	@param	fs		Font size in pt.
	@param	backptr	Address of success variable to reset on error.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_pgf_doc_font_size(
	dk4_gra_t			*gra,
	double				 fs,
	int					*backptr,
	dk4_app_t			*app
);


/**	Add a preamble line.
	For font setup and package setup the lines added by this function
	replace the default contents.
	For other setup the lines added by this function are appended
	after the default contents.
	@param	gra		Output structure, must be initialized for PGF.
	@param	line	Line text without trailing newline.
	@param	tp		Line type: DK4_GRA_PREAMBLE_FONT, DK4_GRA_PREAMBLE_PACKAGE,
					or DK4_GRA_PREAMBLE_OTHER.
	@param	backptr	Address of success variable to reset on error.
	@param	app		Application structure for diagnostics, may be NULL.
*/

void
dk4gra_app_pgf_doc_preamble_line(
	dk4_gra_t	*gra,
	const char	*line,
	int			 tp,
	int			*backptr,
	dk4_app_t	*app
);


#ifdef	__cplusplus
}
#endif

/* vim: set ai sw=4 ts=4 : */

#endif