/usr/include/rasterlite2/rl2graphics.h is in librasterlite2-dev 1.0.0~rc0+devel1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | /*
rl2graphics.h -- RasterLite2 common graphics support
version 2.0, 2013 September 29
Author: Sandro Furieri a.furieri@lqt.it
------------------------------------------------------------------------------
Version: MPL 1.1/GPL 2.0/LGPL 2.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is the RasterLite2 library
The Initial Developer of the Original Code is Alessandro Furieri
Portions created by the Initial Developer are Copyright (C) 2013
the Initial Developer. All Rights Reserved.
Contributor(s):
Alternatively, the contents of this file may be used under the terms of
either the GNU General Public License Version 2 or later (the "GPL"), or
the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
in which case the provisions of the GPL or the LGPL are applicable instead
of those above. If you wish to allow use of your version of this file only
under the terms of either the GPL or the LGPL, and not to allow others to
use your version of this file under the terms of the MPL, indicate your
decision by deleting the provisions above and replace them with the notice
and other provisions required by the GPL or the LGPL. If you do not delete
the provisions above, a recipient may use your version of this file under
the terms of any one of the MPL, the GPL or the LGPL.
*/
/**
\file rl2graphics.h
Graphics (Cairo) support
*/
#ifndef _RL2GRAPHICS_H
#ifndef DOXYGEN_SHOULD_SKIP_THIS
#define _RL2GRAPHICS_H
#endif
#ifdef __cplusplus
extern "C"
{
#endif
#define RL2_FONTSTYLE_NORMAL 5101
#define RL2_FONTSTYLE_ITALIC 5102
#define RL2_FONTSTYLE_OBLIQUE 5103
#define RL2_FONTWEIGHT_NORMAL 5201
#define RL2_FONTWEIGHT_BOLD 5202
#define RL2_CLEAR_PATH 5100
#define RL2_PRESERVE_PATH 5101
#define RL2_PEN_CAP_BUTT 5210
#define RL2_PEN_CAP_ROUND 5211
#define RL2_PEN_CAP_SQUARE 5212
#define RL2_PEN_JOIN_MITER 5261
#define RL2_PEN_JOIN_ROUND 5262
#define RL2_PEN_JOIN_BEVEL 5263
typedef struct rl2_graphics_context rl2GraphicsContext;
typedef rl2GraphicsContext *rl2GraphicsContextPtr;
typedef struct rl2_graphics_pattern rl2GraphicsPattern;
typedef rl2GraphicsPattern *rl2GraphicsPatternPtr;
typedef struct rl2_graphics_font rl2GraphicsFont;
typedef rl2GraphicsFont *rl2GraphicsFontPtr;
typedef struct rl2_graphics_bitmap rl2GraphicsBitmap;
typedef rl2GraphicsBitmap *rl2GraphicsBitmapPtr;
/**
Creates a generic Graphics Context
\param width canvass width (in pixels)
\param height canvass height (in pixels)
\return the pointer to the corresponding Graphics Context object: NULL on failure
\sa rl2_graph_destroy_context, rl2_graph_create_svg_context,
rl2_graph_create_pdf_context, rl2_graph_create_mem_pdf_context
\note you are responsible to destroy (before or after) any Graphics Context
returned by rl2_graph_create_context() by invoking rl2_graph_destroy_context().
*/
RL2_DECLARE rl2GraphicsContextPtr rl2_graph_create_context (int width,
int height);
/**
Destroys a Graphics Context object freeing any allocated resource
\param handle the pointer to a valid Graphics Context returned by a previous call
to rl2_graph_create_context()
\sa rl2_graph_create_context
*/
RL2_DECLARE void rl2_graph_destroy_context (rl2GraphicsContextPtr context);
/**
Creates an SVG Graphics Context
\param path pathname of the target SVG output file
\param width canvass width (in pixels)
\param height canvass height (in pixels)
\return the pointer to the corresponding Graphics Context object: NULL on failure
\sa rl2_graph_create_context, rl2_graph_destroy_context, rl2_graph_create_pdf_context,
rl2_graph_create_mem_pdf_context
\note you are responsible to destroy (before or after) any SVG Graphics Context
returned by rl2_graph_create_svg_context() by invoking rl2_graph_destroy_context().
*/
RL2_DECLARE rl2GraphicsContextPtr rl2_graph_create_svg_context (const char
*path,
int width,
int height);
/**
Creates a PDF Graphics Context
\param path pathname of the target PDF output file
\param dpi the PDF printing resolution measured in DPI
\param page_width total page width (in inches) including any margin
\param page_height total page height (in inches) including any margin
\param margin_width horizontal margin width (in inches)
\param margin_height vertical margin height (in inches)
\return the pointer to the corresponding Graphics Context object: NULL on failure
\sa rl2_graph_create_context, rl2_graph_create_svg_context, rl2_graph_create_mem_pdf_context,
rl2_graph_destroy_context
\note you are responsible to destroy (before or after) any PDF Graphics Context
returned by rl2_graph_create_pdf_context() by invoking rl2_graph_destroy_context().
*/
RL2_DECLARE rl2GraphicsContextPtr rl2_graph_create_pdf_context (const char
*path,
int dpi,
double
page_width,
double
page_height,
double
margin_width,
double
margin_height);
/**
Creates an in-memory PDF Graphics Context
\param mem handle to an in-memory PDF target create by rl2_create_mem_pdf_target()
\param dpi the PDF printing resolution measured in DPI
\param page_width total page width (in inches) including any margin
\param page_height total page height (in inches) including any margin
\param margin_width horizontal margin width (in inches)
\param margin_height vertical margin height (in inches)
\return the pointer to the corresponding Graphics Context object: NULL on failure
\sa rl2_graph_create_context, rl2_graph_create_svg_context, rl2_graph_create_pdf_context,
rl2_graph_destroy_context, rl2_create_mem_pdf_target
\note you are responsible to destroy (before or after) any PDF Graphics Context
returned by rl2_graph_create_mem_pdf_context() by invoking rl2_graph_destroy_context().
*/
RL2_DECLARE rl2GraphicsContextPtr
rl2_graph_create_mem_pdf_context (rl2MemPdfPtr pdf, int dpi,
double page_width, double page_height,
double margin_width,
double margin_height);
/**
Create an in-memory PDF target
\return the handle to an initially empty in-memory PDF target: NULL on failure
\sa rl2_graph_create_mem_pdf_context, rl2_destroy_mem_pdf_target,
rl2_get_mem_pdf_buffer
\note you are responsible to destroy (before or after) any in-memory PDF target
returned by rl2_create_mem_pdf_target() by invoking rl2_destroy_mem_pdf_target().
*/
RL2_DECLARE rl2MemPdfPtr rl2_create_mem_pdf_target (void);
/**
Destroys an in-memory PDF target freeing any allocated resource
\param handle the pointer to a valid in-memory PDF target returned by a previous call
to rl2_create_mem_pdf_target()
\sa rl2_create_mem_pdf_target, rl2_destroy_mem_pdf_target
*/
RL2_DECLARE void rl2_destroy_mem_pdf_target (rl2MemPdfPtr target);
/**
Transfers the ownership of the memory buffer contained into a in-memory PDF target
\param handle the pointer to a valid in-memory PDF target returned by a previous call
to rl2_create_mem_pdf_target()
\param buffer on completion this variable will point to the a memory block
containing the PDF document (may be NULL if any error occurred).
\param size on completion this variable will contain the size (in bytes)
of the memory block containing the PDF document.
\return RL2_OK on success; RL2_ERROR if any error is encountered (this
including referencing an empty in-memory PDF target).
\sa rl2_create_mem_pdf_target
\note after invoking rl2_get_mem_pdf_buffer() the in-memory PDF target
will be reset to its initial empty state-
*/
RL2_DECLARE int rl2_get_mem_pdf_buffer (rl2MemPdfPtr target,
unsigned char **buffer, int *size);
/**
Selects the currently set Pen for a Graphics Context (solid style)
\param context the pointer to a valid Graphics Context returned by a previous call
to rl2_graph_create_context(), rl2_graph_create_svg_context() or
rl2_graph_create_pdf_context()
\param red Pen color: red component.
\param green Pen color: green component.
\param blue Pen color: blue component.
\param alpha Pen transparency (0 full transparent; 255 full opaque).
\param width Pen width
\param line_cap one of RL2_PEN_CAP_BUTT, RL2_PEN_CAP_ROUND or RL2_PEN_CAP_SQUARE
\param line_join one of RL2_PEN_JOIN_MITER, RL2_PEN_JOIN_MITER or RL2_PEN_JOIN_BEVEL
\return 0 (false) on error, any other value on success.
\sa rl2_graph_create_context, rl2_graph_create_svg_context,
rl2_graph_create_pdf_context, rl2_graph_set_dashed_pen,
rl2_graph_set_linear_gradient_solid_pen, rl2_graph_set_linear_gradient_dashed_pen,
rl2_graph_set_pattern_solid_pen, rl2_graph_set_pattern_dashed_pen,
rl2_graph_set_brush, rl2_graph_set_font
*/
RL2_DECLARE int rl2_graph_set_solid_pen (rl2GraphicsContextPtr context,
unsigned char red,
unsigned char green,
unsigned char blue,
unsigned char alpha, double width,
int line_cap, int line_join);
/**
Selects the currently set Pen for a Graphics Context (dashed style)
\param context the pointer to a valid Graphics Context returned by a previous call
to rl2_graph_create_context(), rl2_graph_create_svg_context() or
rl2_graph_create_pdf_context()
\param red Pen color: red component.
\param green Pen color: green component.
\param blue Pen color: blue component.
\param alpha Pen transparency (0 full transparent; 255 full opaque).
\param width Pen width
\param line_cap one of RL2_PEN_CAP_BUTT, RL2_PEN_CAP_ROUND or RL2_PEN_CAP_SQUARE
\param line_join one of RL2_PEN_JOIN_MITER, RL2_PEN_JOIN_MITER or RL2_PEN_JOIN_BEVEL
\param dash_count the total count of dash_list items
\param dash_list an array of dash items
\param dash_offset start offset
\return 0 (false) on error, any other value on success.
\sa rl2_graph_create_context, rl2_graph_create_svg_context,
rl2_graph_create_pdf_context, rl2_graph_set_solid_pen,
rl2_graph_set_linear_gradient_solid_pen, rl2_graph_set_linear_gradient_dashed_pen,
rl2_graph_set_pattern_solid_pen, rl2_graph_set_pattern_dashed_pen,
rl2_graph_set_brush, rl2_graph_set_font
*/
RL2_DECLARE int rl2_graph_set_dashed_pen (rl2GraphicsContextPtr context,
unsigned char red,
unsigned char green,
unsigned char blue,
unsigned char alpha, double width,
int line_cap, int line_join,
int dash_count,
double dash_list[],
double dash_offset);
/**
Selects the currently set Linear Gradient Pen for a Graphics Context (solid style)
\param context the pointer to a valid Graphics Context returned by a previous call
to rl2_graph_create_context(), rl2_graph_create_svg_context() or
rl2_graph_create_pdf_context()
\param x start point (X coord, in pixels) of the Gradient.
\param y start point (Y coord, in pixels) of the Gradient.
\param width the Gradient width.
\param height the Gradient height.
\param red1 first Gradient color: red component.
\param green1 first Gradient color: green component.
\param blue1 first Gradient color: blue component.
\param alpha1 first Gradient color transparency (0 full transparent; 255 full opaque).
\param red2 second Gradient color: red component.
\param green2 second Gradient color: green component.
\param blue2 second Gradient color: blue component.
\param alpha2 second Gradient color transparency (0 full transparent; 255 full opaque).
\param width Pen width
\param line_cap one of RL2_PEN_CAP_BUTT, RL2_PEN_CAP_ROUND or RL2_PEN_CAP_SQUARE
\param line_join one of RL2_PEN_JOIN_MITER, RL2_PEN_JOIN_MITER or RL2_PEN_JOIN_BEVEL
\return 0 (false) on error, any other value on success.
\sa rl2_graph_create_context, rl2_graph_create_svg_context,
rl2_graph_create_pdf_context, rl2_graph_set_solid_brush,
rl2_graph_set_dashed_pen, rl2_graph_set_linear_gradient_dashed_pen,
rl2_graph_set_pattern_solid_pen, rl2_graph_set_pattern_dashed_pen,
rl2_graph_set_brush, rl2_graph_set_font
\note a Pen created by this function always is a Linear Gradient Pen.
*/
RL2_DECLARE int
rl2_graph_set_linear_gradient_solid_pen (rl2GraphicsContextPtr,
double x, double y,
double width, double height,
unsigned char red1,
unsigned char green1,
unsigned char blue1,
unsigned char alpha1,
unsigned char red2,
unsigned char green2,
unsigned char blue2,
unsigned char alpha2,
double pen_width, int line_cap,
int line_join);
/**
Selects the currently set Linear Gradient Pen for a Graphics Context (dashed style)
\param context the pointer to a valid Graphics Context returned by a previous call
to rl2_graph_create_context(), rl2_graph_create_svg_context() or
rl2_graph_create_pdf_context()
\param x start point (X coord, in pixels) of the Gradient.
\param y start point (Y coord, in pixels) of the Gradient.
\param width the Gradient width.
\param height the Gradient height.
\param red1 first Gradient color: red component.
\param green1 first Gradient color: green component.
\param blue1 first Gradient color: blue component.
\param alpha1 first Gradient color transparency (0 full transparent; 255 full opaque).
\param red2 second Gradient color: red component.
\param green2 second Gradient color: green component.
\param blue2 second Gradient color: blue component.
\param alpha2 second Gradient color transparency (0 full transparent; 255 full opaque).
\param width Pen width
\param line_cap one of RL2_PEN_CAP_BUTT, RL2_PEN_CAP_ROUND or RL2_PEN_CAP_SQUARE
\param line_join one of RL2_PEN_JOIN_MITER, RL2_PEN_JOIN_MITER or RL2_PEN_JOIN_BEVEL
\param dash_count the total count of dash_list items
\param dash_list an array of dash items
\param dash_offset start offset
\return 0 (false) on error, any other value on success.
\sa rl2_graph_create_context, rl2_graph_create_svg_context,
rl2_graph_create_pdf_context, rl2_graph_set_solid_pen,
rl2_graph_set_dashed_pen, rl2_graph_set_linear_gradient_solid_pen,
rl2_graph_set_pattern_solid_pen, rl2_graph_set_pattern_dashed_pen,
rl2_graph_set_brush, rl2_graph_set_font
\note a Pen created by this function always is a Linear Gradient Pen.
*/
RL2_DECLARE int
rl2_graph_set_linear_gradient_dashed_pen (rl2GraphicsContextPtr,
double x, double y,
double width, double height,
unsigned char red1,
unsigned char green1,
unsigned char blue1,
unsigned char alpha1,
unsigned char red2,
unsigned char green2,
unsigned char blue2,
unsigned char alpha2,
double pen_width,
int line_cap, int line_join,
int dash_count,
double dash_list[],
double offset);
/**
Selects the currently set Pattern Pen for a Graphics Context (solid style)
\param context the pointer to a valid Graphics Context returned by a previous call
to rl2_graph_create_context(), rl2_graph_create_svg_context() or
rl2_graph_create_pdf_context()
\param pattern the pointer to a valid Graphics Pattern returned by a previous
call to rl2_graph_create_pattern().
\param pen_width Pen width
\param line_cap one of RL2_PEN_CAP_BUTT, RL2_PEN_CAP_ROUND or RL2_PEN_CAP_SQUARE
\param line_join one of RL2_PEN_JOIN_MITER, RL2_PEN_JOIN_MITER or RL2_PEN_JOIN_BEVEL
\return 0 (false) on error, any other value on success.
\sa rl2_graph_create_context, rl2_graph_create_svg_context,
rl2_graph_create_pdf_context, rl2_graph_set_solid_pen, rl2_graph_set_dashed_pen,
rl2_graph_set_linear_gradient_solid_pen, rl2_graph_set_linear_gradient_dashed_pen,
rl2_graph_set_pattern_dashed_pen, rl2_graph_set_brush, rl2_graph_set_font,
rl2_create_pattern, rl2_graph_realease_pattern_pen
\note a Pen created by this function always is a Pattern Pen,
i.e. a Pen repeatedly using a small bitmap as a filling source.
*/
RL2_DECLARE int rl2_graph_set_pattern_solid_pen (rl2GraphicsContextPtr
context,
rl2GraphicsPatternPtr
pattern, double width,
int line_cap,
int line_join);
/**
Selects the currently set Pattern Pen for a Graphics Context (dashed style)
\param context the pointer to a valid Graphics Context returned by a previous call
to rl2_graph_create_context(), rl2_graph_create_svg_context() or
rl2_graph_create_pdf_context()
\param pattern the pointer to a valid Graphics Pattern returned by a previous
call to rl2_graph_create_pattern().
\param pen_width Pen width
\param line_cap one of RL2_PEN_CAP_BUTT, RL2_PEN_CAP_ROUND or RL2_PEN_CAP_SQUARE
\param line_join one of RL2_PEN_JOIN_MITER, RL2_PEN_JOIN_MITER or RL2_PEN_JOIN_BEVEL
\param dash_count the total count of dash_list items
\param dash_list an array of dash items
\param dash_offset start offset
\return 0 (false) on error, any other value on success.
\sa rl2_graph_create_context, rl2_graph_create_svg_context,
rl2_graph_create_pdf_context, rl2_graph_set_solid_pen, rl2_graph_set_dashed_pen,
rl2_graph_set_linear_gradient_solid_pen, rl2_graph_set_linear_gradient_dashed_pen,
rl2_graph_set_pattern_solid_pen, rl2_graph_set_brush, rl2_graph_set_font,
rl2_create_pattern, rl2_graph_realease_pattern_pen
\note a Pen created by this function always is a Pattern Pen,
i.e. a Pen repeatedly using a small bitmap as a filling source.
*/
RL2_DECLARE int rl2_graph_set_pattern_dashed_pen (rl2GraphicsContextPtr
context,
rl2GraphicsPatternPtr
pattern, double width,
int line_cap,
int line_join,
int dash_count,
double dash_list[],
double offset);
/**
Releases the currently set Pattern Pen (if any) from a Graphics Context
\param context the pointer to a valid Graphics Context returned by a previous call
to rl2_graph_create_context(), rl2_graph_create_svg_context() or
rl2_graph_create_pdf_context()
\return 0 (false) on error, any other value on success.
\sa rl2_graph_set_pattern_solid_pen, rl2_graph_set_pattern_dashed_pen
\note you should always release a Pattern Pen before attempting to
destroy the corresponding Pattern object.
*/
RL2_DECLARE int rl2_graph_release_pattern_pen (rl2GraphicsContextPtr
context);
/**
Selects the currently set Brush for a Graphics Context
\param context the pointer to a valid Graphics Context returned by a previous call
to rl2_graph_create_context(), rl2_graph_create_svg_context() or
rl2_graph_create_pdf_context()
\param red Brush color: red component.
\param green Brush color: green component.
\param blue Brush color: blue component.
\param alpha Brush transparency (0 full transparent; 255 full opaque).
\return 0 (false) on error, any other value on success.
\sa rl2_graph_create_context, rl2_graph_create_svg_context,
rl2_graph_create_pdf_context, rrl2_graph_set_solid_pen, rl2_graph_set_dashed_pen,
rl2_graph_set_linear_gradient_pen, rl2_graph_set_pattern_pen,
rl2_graph_set_linear_gradient_brush, rl2_graph_set_pattern_brush,
rl2_graph_set_font
\note a Brush created by this function always is a solid Brush, may be
supporting transparency.
*/
RL2_DECLARE int rl2_graph_set_brush (rl2GraphicsContextPtr context,
unsigned char red, unsigned char green,
unsigned char blue,
unsigned char alpha);
/**
Selects the currently set Brush for a Graphics Context
\param context the pointer to a valid Graphics Context returned by a previous call
to rl2_graph_create_context(), rl2_graph_create_svg_context() or
rl2_graph_create_pdf_context()
\param x start point (X coord, in pixels) of the Gradient.
\param y start point (Y coord, in pixels) of the Gradient.
\param width the Gradient width.
\param height the Gradient height.
\param red1 first Gradient color: red component.
\param green1 first Gradient color: green component.
\param blue1 first Gradient color: blue component.
\param alpha1 first Gradient color transparency (0 full transparent; 255 full opaque).
\param red2 second Gradient color: red component.
\param green2 second Gradient color: green component.
\param blue2 second Gradient color: blue component.
\param alpha2 second Gradient color transparency (0 full transparent; 255 full opaque).
\return 0 (false) on error, any other value on success.
\sa rl2_graph_create_context, rl2_graph_create_svg_context,
rl2_graph_create_pdf_context, rl2_graph_set_solid_pen, rl2_graph_set_dashed_pen,
rl2_graph_set_linear_gradient_pen, rl2_graph_set_pattern_pen,
rl2_graph_set_brush, rl2_graph_set_pattern_brush,
rl2_graph_set_font
\note a Brush created by this function always is a Linear Gradient Brush.
*/
RL2_DECLARE int rl2_graph_set_linear_gradient_brush (rl2GraphicsContextPtr,
double x, double y,
double width,
double height,
unsigned char red1,
unsigned char green1,
unsigned char blue1,
unsigned char alpha1,
unsigned char red2,
unsigned char green2,
unsigned char blue2,
unsigned char alpha2);
/**
Selects the currently set Brush for a Graphics Context
\param context the pointer to a valid Graphics Context returned by a previous call
to rl2_graph_create_context(), rl2_graph_create_svg_context() or
rl2_graph_create_pdf_context()
\param pattern the pointer to a valid Graphics Pattern returned by a previous
call to rl2_graph_create_pattern().
\return 0 (false) on error, any other value on success.
\sa rl2_graph_create_context, rl2_graph_create_svg_context,
rl2_graph_create_pdf_context, rl2_graph_set_solid_pen, rl2_graph_set_dashed_pen,
rl2_graph_set_brush, rl2_graph_set_linear_gradient_brush,
rl2_graph_set_font, rl2_create_pattern, rl2_graph_release_pattern_brush
\note a Brush created by this function always is a Pattern Brush,
i.e. a Brush repeatedly using a small bitmap as a filling source.
*/
RL2_DECLARE int rl2_graph_set_pattern_brush (rl2GraphicsContextPtr context,
rl2GraphicsPatternPtr pattern);
/**
Releases the currently set Pattern Brush (if any) from a Graphics Context
\param context the pointer to a valid Graphics Context returned by a previous call
to rl2_graph_create_context(), rl2_graph_create_svg_context() or
rl2_graph_create_pdf_context()
\return 0 (false) on error, any other value on success.
\sa rl2_graph_set_pattern_brush
\note you should always release a Pattern Brush before attempting to
destroy the corresponding Pattern object.
*/
RL2_DECLARE int rl2_graph_release_pattern_brush (rl2GraphicsContextPtr
context);
/**
Selects the currently set Font for a Graphics Context
\param context the pointer to a valid Graphics Context returned by a previous call
to rl2_graph_create_context(), rl2_graph_create_svg_context() or
rl2_graph_create_pdf_context()
\param font the pointer to a valid Graphics Font returned by a previous call
to rl2_create_font().
\return 0 (false) on error, any other value on success.
\sa rl2_graph_create_context, rl2_graph_create_svg_context,
rl2_graph_create_pdf_context, rl2_graph_set_solid_pen, rl2_graph_set_dashed_pen,
rl2_graph_set_brush, rl2_graph_set_linear_gradient_brush, rl2_graph_set_pattern_brush,
rl2_create_font
*/
RL2_DECLARE int rl2_graph_set_font (rl2GraphicsContextPtr context,
rl2GraphicsFontPtr font);
/**
Releases the currently set Font out from a Graphics Context
\param context the pointer to a valid Graphics Context returned by a previous call
to rl2_graph_create_context(), rl2_graph_create_svg_context() or
rl2_graph_create_pdf_context()
\return 0 (false) on error, any other value on success.
\sa rl2_graph_set_font, rl2_graph_destroy_font
\note you must always call rl2_graph_release_font() before attempting
to destroy a currently selected TrueType Font.
*/
RL2_DECLARE int rl2_graph_release_font (rl2GraphicsContextPtr context);
/**
Creates a Pattern Brush
\param rgbaArray pointer to an array of RGBA pixels representing the bitmap
supporting the Pattern Brush to be created.
\param width Pattern width (in pixels)
\param height Pattern height (in pixels)
\param extend if TRUE the pattern will be infinitely repeated
so to completely fill the plane
\return the pointer to the corresponding Pattern Brush object: NULL on failure
\sa rl2_graph_set_pattern_brush, rl2_graph_destroy_brush,
rl2_create_pattern_from_external_graphic, rl2_create_pattern_from_external_svg
\note you are responsible to destroy (before or after) any Pattern Brush
returned by rl2_graph_create_pattern() by invoking rl2_graph_destroy_pattern().
*/
RL2_DECLARE rl2GraphicsPatternPtr rl2_graph_create_pattern (unsigned char
*rgbaArray,
int width,
int height,
int extend);
/**
Creates a Pattern from an External Graphic resource (PNG, GIF, JPEG)
\param handle SQLite3 connection handle
\param xlink_href unique External Graphic identifier
\param extend if TRUE the pattern will be infinitely repeated
so to completely fill the plane
\return the pointer to the corresponding Pattern Brush object: NULL on failure
\sa rl2_graph_set_pattern_brush, rl2_graph_destroy_brush,
rl2_graph_create_pattern, rl2_create_pattern_from_external_svg,
rl2_graph_pattern_get_size
\note you are responsible to destroy (before or after) any Pattern Brush
returned by rl2_create_pattern_from_external_graphic() by invoking
rl2_graph_destroy_pattern().
*/
RL2_DECLARE rl2GraphicsPatternPtr
rl2_create_pattern_from_external_graphic (sqlite3 * handle,
const char *xlink_href,
int extend);
/**
Creates a Pattern from an External Graphic resource (SVG)
\param handle SQLite3 connection handle
\param xlink_href unique External Graphic identifier
\param size the scaled size of the SVG symbol
\return the pointer to the corresponding Pattern Brush object: NULL on failure
\sa rl2_graph_set_pattern_brush, rl2_graph_destroy_brush,
rl2_graph_create_pattern, rl2_create_pattern_from_external_graphic,
rl2_graph_pattern_get_size
\note you are responsible to destroy (before or after) any Pattern Brush
returned by rl2_create_pattern_from_external_graphic() by invoking
rl2_graph_destroy_pattern().
*/
RL2_DECLARE rl2GraphicsPatternPtr
rl2_create_pattern_from_external_svg (sqlite3 * handle,
const char *xlink_href,
double size);
/**
Destroys a Pattern Brush object freeing any allocated resource
\param pattern pointer to a valid Pattern object
\sa rl2_graph_create_pattern, rl2_create_pattern_from_external_graphic
\note you should always release a Pattern Pen or Pattern Brush from any
referencing Graphic Context before attempting to destroy the corresponding
Pattern object.
*/
RL2_DECLARE void rl2_graph_destroy_pattern (rl2GraphicsPatternPtr pattern);
/**
Retrieving the Dimensions from a Pattern Brush object
\param pattern pointer to a valid Pattern object
\param width on completion the variable referenced by this
pointer will contain the Pattern's Width (in pixels).
\param height on completion the variable referenced by this
pointer will contain the Pattern's Height (in pixels).
\return RL2_OK on success: RL2_ERROR on failure.
\sa rl2_graph_create_pattern, rl2_create_pattern_from_external_graphic
*/
RL2_DECLARE int rl2_graph_get_pattern_size (rl2GraphicsPatternPtr pattern,
unsigned int *width,
unsigned int *height);
/**
Recolors a Monochrome Pattern object
\param handle the pointer to a valid Pattern returned by a previous call
to rl2_graph_create_pattern() or rl2_create_pattern_from_external_graphic()
\param r the new Red component value to be set
\param g the new Green component value
\param b the new Blue component value
\return RL2_OK on success: RL2_ERROR on failure.
\sa rl2_graph_create_pattern, rl2_create_pattern_from_external_graphic,
rl2_graph_destroy_pattern, rl2_graph_pattern_transparency,
rl2_graph_draw_graphic_symbol
\note only a Monochrome Pattern can be succesfully recolored.
Completely transparent pixels will be ignored; all opaque pixels
should declare exactly the same color.
*/
RL2_DECLARE int rl2_graph_pattern_recolor (rl2GraphicsPatternPtr pattern,
unsigned char r, unsigned char g,
unsigned char b);
/**
Sets half-transparency for a Pattern object
\param handle the pointer to a valid Pattern returned by a previous call
to rl2_graph_create_pattern() or rl2_create_pattern_from_external_graphic()
\param alpha transparency (0 full transparent; 255 full opaque).
\return RL2_OK on success: RL2_ERROR on failure.
\sa rl2_graph_create_pattern, rl2_create_pattern_from_external_graphic,
rl2_graph_destroy_pattern, rl2_graph_pattern_recolor,
rl2_graph_draw_graphic_symbol
\note Completely transparent pixels will be always preserved as such;
all other pixels will assume the required transparency.
*/
RL2_DECLARE int rl2_graph_pattern_transparency (rl2GraphicsPatternPtr
pattern,
unsigned char alpha);
/**
Draws a Graphic Symbol into the Canvass
\param context the pointer to a valid Graphics Context (aka Canvass).
\param pattern the pointer to a valid Pattern returned by a previous call
\param width of the rendered image.
\param height of the rendered image.
\param x the X coordinate of the Anchor Point.
\param y the Y coordinate of the Anchor Point.
\param angle an angle (in decimal degrees) to rotate the image.
\param angle an angle (in decimal degrees) to rotate the image.
\param anchor_point_x relative X position of the Anchor Point
expressed as a percent position within the image bounding box
(expected to be a value between 0.0 and 1.0)
\param anchor_point_y relative Y position of the Anchor Point
expressed as a percent position within the image bounding box
(expected to be a value between 0.0 and 1.0)
\return 0 (false) on error, any other value on success.
\sa rl2_graph_create_pattern, rl2_create_pattern_from_external_graphic,
rl2_graph_destroy_pattern, rl2_graph_pattern_transparency,
rl2_graph_pattern_recolor, rl2_graph_draw_mark_symbol
*/
RL2_DECLARE int rl2_graph_draw_graphic_symbol (rl2GraphicsContextPtr
context,
rl2GraphicsPatternPtr
pattern, double width,
double height, double x,
double y, double angle,
double anchor_point_x,
double anchor_point_y);
/**
Draws a Mark Symbol into the Canvass
\param context the pointer to a valid Graphics Context (aka Canvass).
\param mark_type expected to be one between RL2_GRAPHIC_MARK_SQUARE,
RL2_GRAPHIC_MARK_CIRCLE, RL2_GRAPHIC_MARK_TRIANGLE,
RL2_GRAPHIC_MARK_STAR, RL2_GRAPHIC_MARK_CROSS and RL2_GRAPHIC_MARK_X
(default: RL2_GRAPHIC_MARK_SQUARE).
\param size the Mark Symbol size (in pixels).
\param x the X coordinate of the Anchor Point.
\param y the Y coordinate of the Anchor Point.
\param angle an angle (in decimal degrees) to rotate the image.
\param angle an angle (in decimal degrees) to rotate the image.
\param anchor_point_x relative X position of the Anchor Point
expressed as a percent position within the image bounding box
(expected to be a value between 0.0 and 1.0)
\param anchor_point_y relative Y position of the Anchor Point
expressed as a percent position within the image bounding box
(expected to be a value between 0.0 and 1.0)
\param fill if TRUE the Mark Symboll will be filled using the
currently set brush
\param stroke if TRUE the Mark Symboll will be stroked using
the currently set pen
\return 0 (false) on error, any other value on success.
\sa rl2_graph_draw_graphic_symbol
*/
RL2_DECLARE int rl2_graph_draw_mark_symbol (rl2GraphicsContextPtr
context, int mark_type,
double size,
double x, double y,
double angle,
double anchor_point_x,
double anchor_point_y, int fill,
int stroke);
/**
Creates a Graphics Font Object (CAIRO built-in "toy" fonts)
\param facename the font Facename. Expected to be one of "serif",
"sans-serif" or "monospace". a NULL facename will default to "monospace".
\param size the Graphics Font size (in points).
\param style one of RL2_FONTSTYLE_NORMAL, RL2_FONTSTYLE_ITALIC or
RL2_FONTSTYLE_OBLIQUE
\param weight one of RL2_FONTWEIGHT_NORMAL or RL2_FONTWEIGHT_BOLD
\return the pointer to the corresponding Font object: NULL on failure
\sa rl2_graph_set_font,
rl2_graph_destroy_font, rl2_graph_font_set_color,
rl2_graph_font_set_color, rl2_graph_font_set_halo
\note you are responsible to destroy (before or after) any Pattern Brush
returned by rl2_graph_create_toy_font() by invoking rl2_graph_destroy_font().
*/
RL2_DECLARE rl2GraphicsFontPtr rl2_graph_create_toy_font (const char
*facename,
double size,
int style,
int weight);
/**
Will retrieve a BLOB-encoded TrueType Font by its FaceName
\param handle SQLite3 connection handle
\param fontname name of the required font: e.g. "Roboto-BoldItalic"
\param font on completion this variable will point to the a memory block
containing the BLOB-encoded TrueType font (may be NULL if any error occurred).
\param font_sz on completion this variable will contain the size (in bytes)
of the memory block containing the BLOB-encoded TrueType font.
\return RL2_OK on success; RL2_ERROR if any error is encountered (this
including requesting a not existing TrueType font).
\note you are responsible to free (before or after) the BLOB-encode
font returned by rl2_get_TrueType_font()
*/
RL2_DECLARE int rl2_get_TrueType_font (sqlite3 * handle,
const char *facename,
unsigned char **font, int *font_sz);
/**
Creates a Graphics Font Object (TrueType fonts)
\param priv_data pointer to the opaque internal connection object
returned by a previous call to rl2_alloc_private()
\param ttf the TrueType font definition (internal BLOB format).
\param ttf_bytes length (in bytes) of the above TTF definition
\param size the Graphics Font size (in points).
\return the pointer to the corresponding Font object: NULL on failure
\sa rl2_graph_create_toy_font, rl2_get_TrueType_font,
rl2_search_TrueType_font, rl2_graph_set_font, rl2_graph_destroy_font,
rl2_graph_font_set_color, rl2_graph_font_set_color,
rl2_graph_font_set_halo
\note you are responsible to destroy (before or after) any TrueType
font returned by rl2_graph_create_TrueType_font() by invoking
rl2_graph_destroy_font().
*/
RL2_DECLARE rl2GraphicsFontPtr rl2_graph_create_TrueType_font (const void
*priv_data,
const
unsigned char
*ttf,
int
ttf_bytes,
double size);
/**
Searches and creates a Graphics Font Object (TrueType fonts)
\param handle SQLite3 connection handle
\param priv_data pointer to the opaque internal connection object
returned by a previous call to rl2_alloc_private()
\param fontname name of the required font: e.g. "Roboto-BoldItalic"
\param size the Graphics Font size (in points).
\return the pointer to the corresponding Font object: NULL on failure
\sa rl2_graph_create_toy_font, rl2_get_TrueType_font,
rl2_graph_create_TrueType_font, rl2_graph_set_font,
rl2_graph_destroy_font, rl2_graph_font_set_color,
rl2_graph_font_set_color, rl2_graph_font_set_halo
\note you are responsible to destroy (before or after) any TrueType
font returned by rl2_search_TrueType_font() by invoking
rl2_graph_destroy_font().
*/
RL2_DECLARE rl2GraphicsFontPtr rl2_search_TrueType_font (sqlite3 * handle,
const void
*priv_data,
const char
*facename,
double size);
/**
Destroys a Graphics Font object freeing any allocated resource
\param handle the pointer to a valid Font returned by a previous call
to rl2_graph_create_toy_font() or rl2_graph_create_TrueType_font()
\sa rl2_graph_create_toy_font, rl2_graph_create_TrueType_font
\note you must always call rl2_graph_release_font() before attempting
to destroy the currently selected font if it is of the TrueType class.
*/
RL2_DECLARE void rl2_graph_destroy_font (rl2GraphicsFontPtr font);
/**
Selects the currently set Color for a Graphics Font
\param font the pointer to a valid Graphics Font returned by a previous call
to rl2_graph_create_toy_font() or rl2_graph_create_TrueType_font()
\param red Font color: red component.
\param green Font color: green component.
\param blue Font color: blue component.
\param alpha Font transparency (0 full transparent; 255 full opaque).
\return 0 (false) on error, any other value on success.
\sa rl2_graph_create_toy_font, rl2_graph_create_TrueType_font,
rl2_graph_font_set_halo, rl2_graph_set_font
*/
RL2_DECLARE int rl2_graph_font_set_color (rl2GraphicsFontPtr font,
unsigned char red,
unsigned char green,
unsigned char blue,
unsigned char alpha);
/**
Selects the currently set Halo for a Graphics Font
\param font the pointer to a valid Graphics Font returned by a previous call
to rl2_graph_create_toy_font() or rl2_graph_create_TrueType_font()
\param radius the Halo Radius (in points); declaring a zero or negative value
will remove the Halo from the Font.
\param red Halo color: red component.
\param green Halo color: green component.
\param blue Halo color: blue component.
\param alpha Halo transparency (0 full transparent; 255 full opaque).
\return 0 (false) on error, any other value on success.
\sa rl2_graph_create_toy_font, rl2_graph_create_TrueType_font,
rl2_graph_font_set_color, rl2_graph_set_font
*/
RL2_DECLARE int rl2_graph_font_set_halo (rl2GraphicsFontPtr font,
double radius,
unsigned char red,
unsigned char green,
unsigned char blue,
unsigned char alpha);
/**
Creates a Graphics Bitmap
\param rgbaArray pointer to an array of RGBA pixels representing the bitmap.
\param width Bitmap width (in pixels)
\param height Bitmap height (in pixels)
\return the pointer to the corresponding Graphics Bitmap object: NULL on failure
\sa rl2_graph_destroy_bitmap
\note you are responsible to destroy (before or after) any Graphics Bitmap
returned by rl2_graph_create_bitmap() by invoking rl2_graph_destroy_bitmap().
*/
RL2_DECLARE rl2GraphicsBitmapPtr rl2_graph_create_bitmap (unsigned char
*rgbaArray,
int width,
int height);
/**
Destroys a Graphics Bitmap object freeing any allocated resource
\param handle the pointer to a valid Font returned by a previous call
to rl2_graph_create_bitmap()
\sa rl2_graph_create_bitmap
*/
RL2_DECLARE void rl2_graph_destroy_bitmap (rl2GraphicsBitmapPtr bitmap);
/**
Drawing a Rectangle into a canvass
\param context the pointer to a valid Graphics Context (aka Canvass).
\param x the X coordinate of the top left corner of the rectangle.
\param y the Y coordinate of the top left corner of the rectangle.
\param width the width of the rectangle.
\param height the height of the rectangle.
\return 0 (false) on error, any other value on success.
\sa rl2_graph_set_solid_pen, rl2_graph_set_dashed_pen, rl2_graph_set_brush,
rl2_graph, draw_rectangle, rl2_graph_draw_ellipse, rl2_graph_draw_circle_sector,
rl2_graph_stroke_line, rl2_graph_fill_path, rl2_graph_stroke_path
\note the rectangle will be stroked using the current Pen and will
be filled using the current Brush.
*/
RL2_DECLARE int rl2_graph_draw_rectangle (rl2GraphicsContextPtr context,
double x, double y, double width,
double height);
/**
Drawing a Rectangle with rounded corners into a canvass
\param context the pointer to a valid Graphics Context (aka Canvass).
\param x the X coordinate of the top left corner of the rectangle.
\param y the Y coordinate of the top left corner of the rectangle.
\param width the width of the rectangle.
\param height the height of the rectangle.
\param radius used for rounded corners.
\return 0 (false) on error, any other value on success.
\sa rl2_graph_set_solid_pen, rl2_graph_set_dashed_pen, rl2_graph_set_brush,
rl2_draw_rectangle, rl2_graph_draw_ellipse, rl2_graph_draw_circle_sector,
rl2_graph_stroke_line, rl2_graph_fill_path, rl2_graph_stroke_path
\note the rectangle will be stroked using the current Pen and will
be filled using the current Brush.
*/
RL2_DECLARE int rl2_graph_draw_rounded_rectangle (rl2GraphicsContextPtr
context, double x,
double y, double width,
double height,
double radius);
/**
Drawing an Ellipse into a canvass
\param context the pointer to a valid Graphics Context (aka Canvass).
\param x the X coordinate of the top left corner of the rectangle
into which the ellipse is inscribed.
\param y the Y coordinate of the top left corner of the rectangle.
\param width the width of the rectangle.
\param height the height of the rectangle.
\return 0 (false) on error, any other value on success.
\sa rl2_graph_set_solid_pen, rl2_graph_set_dashed_pen, rl2_graph_set_brush,
rl2_draw_rectangle, rl2_graph_draw_rounded_rectangle, rl2_graph_draw_circle_sector,
rl2_graph_stroke_line, rl2_graph_fill_path, rl2_graph_stroke_path
\note the ellipse will be stroked using the current Pen and will
be filled using the current Brush.
*/
RL2_DECLARE int rl2_graph_draw_ellipse (rl2GraphicsContextPtr context,
double x, double y, double width,
double height);
/**
Drawing a Circular Sector into a canvass
\param context the pointer to a valid Graphics Context (aka Canvass).
\param center_x the X coordinate of the circle's centre.
\param center_y the Y coordinate of the circle's centre.
\param radius the circle's radius.
\param from_angle the angle (in degrees) at wich the sector starts.
\param to_angle the angle (in degrees) at wich the sector ends.
\return 0 (false) on error, any other value on success.
\sa rl2_graph_set_solid_pen, rl2_graph_set_dashed_pen, rl2_graph_set_brush,
rl2_draw_rectangle, rl2_graph_draw_rounded_rectangle, rl2_graph_draw_ellipse,
rl2_graph_stroke_line, rl2_graph_fill_path, rl2_graph_stroke_path
\note the Sector will be stroked using the current Pen and will
be filled using the current Brush.
*/
RL2_DECLARE int rl2_graph_draw_circle_sector (rl2GraphicsContextPtr context,
double center_x,
double center_y,
double radius,
double from_angle,
double to_angle);
/**
Drawing a straight Line into a canvass
\param context the pointer to a valid Graphics Context (aka Canvass).
\param x0 the X coordinate of the first point.
\param y0 the Y coordinate of the first point.
\param x1 the X coordinate of the second point.
\param y1 the Y coordinate of the second point.
\return 0 (false) on error, any other value on success.
\sa rl2_graph_set_solid_pen, rl2_graph_set_dashed_pen, rl2_graph_set_brush,
rl2_draw_rectangle, rl2_graph_draw_rounded_rectangle, rl2_graph_draw_ellipse,
rl2_graph_draw_circular_sector, rl2_graph_fill_path, rl2_graph_stroke_path
\note the Sector will be stroked using the current Pen and will
be filled using the current Brush.
*/
RL2_DECLARE int rl2_graph_stroke_line (rl2GraphicsContextPtr context,
double x0, double y0, double x1,
double y1);
/**
Begins a new SubPath
\param context the pointer to a valid Graphics Context (aka Canvass).
\param x the X coordinate of the point.
\param y the Y coordinate of the point.
\return 0 (false) on error, any other value on success.
\sa rl2_graph_add_line_to_path,
rl2_graph_close_subpath, rl2_graph_fill_path, rl2_graph_stroke_path
*/
RL2_DECLARE int rl2_graph_move_to_point (rl2GraphicsContextPtr context,
double x, double y);
/**
Add a line into the current SubPath
\param context the pointer to a valid Graphics Context (aka Canvass).
\param x the X coordinate of the destination point.
\param y the Y coordinate of the destination point.
\return 0 (false) on error, any other value on success.
\sa rl2_graph_set_brush, rl2_graph_move_to_point,
rl2_graph_close_subpath, rl2_graph_fill_path, rl2_graph_stroke_path
*/
RL2_DECLARE int rl2_graph_add_line_to_path (rl2GraphicsContextPtr context,
double x, double y);
/**
Terminates the current SubPath
\param context the pointer to a valid Graphics Context (aka Canvass).
\return 0 (false) on error, any other value on success.
\sa rl2_graph_set_brush, rl2_graph_move_to_point,
rl2_graph_add_line_to_path, rl2_graph_fill_path, rl2_graph_stroke_path
*/
RL2_DECLARE int rl2_graph_close_subpath (rl2GraphicsContextPtr context);
/**
Fills the current Path using the currently set Brush
\param context the pointer to a valid Graphics Context (aka Canvass).
\param preserve if true the current Path will be preserved into the
current Canvass, otherwise it will be definitely removed.
\return 0 (false) on error, any other value on success.
\sa rl2_graph_set_brush, rl2_graph_move_to_point,
rl2_graph_add_line_to_path, rl2_graph_close_subpath, rl2_graph_stroke_path
*/
RL2_DECLARE int rl2_graph_fill_path (rl2GraphicsContextPtr context,
int preserve);
/**
Strokes the current Path using the currently set Pen
\param context the pointer to a valid Graphics Context (aka Canvass).
\param preserve if true the current Path will be preserved into the
current Canvass, otherwise it will be definitely removed.
\return 0 (false) on error, any other value on success.
\sa rl2_graph_set_solid_pen, rl2_graph_set_dashed_pen, rl2_graph_move_to_point,
rl2_graph_add_line_to_path, rl2_graph_close_subpath, rl2_graph_fill_path
*/
RL2_DECLARE int rl2_graph_stroke_path (rl2GraphicsContextPtr context,
int preserve);
/**
Draws a text into the Canvass using the currently set Font
\param context the pointer to a valid Graphics Context (aka Canvass).
\param text string to be printed into the canvass.
\param x the X coordinate of the top left corner of the text.
\param y the Y coordinate of the top left corner of the text.
\param angle an angle (in decimal degrees) to rotate the text.
\param anchor_point_x relative X position of the Anchor Point
expressed as a percent position within the text bounding box
(expected to be a value between 0.0 and 1.0)
\param anchor_point_y relative Y position of the Anchor Point
expressed as a percent position within the text bounding box
(expected to be a value between 0.0 and 1.0)
\return 0 (false) on error, any other value on success.
\sa rl2_graph_set_font, rl2_graph_get_text_extent,
rl2_graph_draw_warped_text
*/
RL2_DECLARE int rl2_graph_draw_text (rl2GraphicsContextPtr context,
const char *text, double x, double y,
double angle,
double anchor_point_x,
double anchor_point_y);
/**
Draws a text warped along a curve using the currently set Font
\param handle connection handle
\param context the pointer to a valid Graphics Context (aka Canvass).
\param text string to be printed into the canvass.
\param points number of item in both X and Y arrays
\param x array of X coordinates.
\param y array of Y coordinates; both X and Y arrays represent
the curve modelling the text to be warped.
\param initial_gap white space to be preserved before printing
the first label occurrence.
\param gap distance separating two cosecutive label occurrences.
(both initial_gap and gap are only meaningfull in the repeated case).
\param repeated if TRUE the text (aka label) will be repeated
as many times as allowed by the modelling curve lenght.
If FALSE the text (aka label) will be printed only once near
the mid-point of the modelling curve.
\return 0 (false) on error, any other value on success.
\sa rl2_graph_set_font, rl2_graph_draw_text
\note if the modelling curve length is shorter than the text
(aka label) length then no output at all will be printed.
*/
RL2_DECLARE int rl2_graph_draw_warped_text (sqlite3 * handle,
rl2GraphicsContextPtr context,
const char *text, int points,
double *x, double *y,
double initial_gap, double gap,
int repeated);
/**
Computes the extent corresponding to a text into the Canvass using the currently set Font
\param context the pointer to a valid Graphics Context (aka Canvass).
\param text string to be printed into the canvass.
\param pre_x on completion this variable will contain the horizontal
spacing before the text.
\param pre_y on completion this variable will contain the vertical
spacing before the text.
\param width on completion this variable will contain the width of
the printed text.
\param width on completion this variable will contain the height of
the printed text.
\param post_x on completion this variable will contain the horizontal
spacing after the text.
\param post_y on completion this variable will contain the vertical
spacing after the text.
\return 0 (false) on error, any other value on success.
\sa rl2_graph_set_font, rl2_graph_get_text_extent
*/
RL2_DECLARE int rl2_graph_get_text_extent (rl2GraphicsContextPtr context,
const char *text, double *pre_x,
double *pre_y, double *width,
double *height, double *post_x,
double *post_y);
/**
Draws a Bitmap into the Canvass
\param context the pointer to a valid Graphics Context (aka Canvass).
\param bitmap the pointer to a valid Graphics Bitmap to be rendered.
\param x the X coordinate of the image's left upper corner.
\param y the Y coordinate of the image's left upper corner.
\return 0 (false) on error, any other value on success.
\sa rl2_graph_create_bitmap, rl2_graph_destroy_bitmap,
rl2_graph_draw_rescaled_bitmap, rl2_graph_draw_graphic_symbol,
rl2_graph_draw_mark_symbol
*/
RL2_DECLARE int rl2_graph_draw_bitmap (rl2GraphicsContextPtr context,
rl2GraphicsBitmapPtr bitmap,
double x, double y);
/**
Draws a Rescaled Bitmap into the Canvass
\param context the pointer to a valid Graphics Context (aka Canvass).
\param bitmap the pointer to a valid Graphics Bitmap to be rendered.
\param scale_x the Scale Factor for X axis.
\param scale_y the Scale Factor for Y axis.
\param x the X coordinate of the image's left upper corner.
\param y the Y coordinate of the image's left upper corner.
\return 0 (false) on error, any other value on success.
\sa rl2_graph_create_bitmap, rl2_graph_destroy_bitmap,
rl2_graph_draw_bitmap, rl2_graph_draw_graphic_symbol,
rl2_graph_draw_mark_symbol
*/
RL2_DECLARE int rl2_graph_draw_rescaled_bitmap (rl2GraphicsContextPtr
context,
rl2GraphicsBitmapPtr bitmap,
double scale_x,
double scale_y, double x,
double y);
/**
Creates an RGB Array corresponding to the current Canvass
\param context the pointer to a valid Graphics Context (aka Canvass).
\return the pointer to the RGB Array: NULL on failure.
\sa rl2_graph_get_context_alpha_array
\note you are responsible to destroy (before or after) any RGB Array
returned by rl2_graph_get_context_rgb_array() by invoking free().
*/
RL2_DECLARE unsigned char
*rl2_graph_get_context_rgb_array (rl2GraphicsContextPtr context);
/**
Creates an Array of Alpha values corresponding to the current Canvass
\param context the pointer to a valid Graphics Context (aka Canvass).
\param half_transparent after successful completion this variable will
ontain 1 or 0, accordingly to the presence of half-transparencies
strictly requiring an alpha band.
\return the pointer to the Array of Alpha Values: NULL on failure.
\sa rl2_graph_get_context_rgb_array
\note you are responsible to destroy (before or after) any RGB Array
returned by rl2_graph_get_context_alpha_array() by invoking free().
*/
RL2_DECLARE unsigned char
*rl2_graph_get_context_alpha_array (rl2GraphicsContextPtr context,
int *half_transparent);
#ifdef __cplusplus
}
#endif
#endif /* _RL2GPAPHICS_H */
|