Changeset 499
- Timestamp:
- 05/01/08 11:02:48 (7 months ago)
- Files:
-
- trunk/src/cairo/Context.d (modified) (33 diffs)
- trunk/src/cairo/FontFace.d (modified) (1 diff)
- trunk/src/cairo/FontOption.d (modified) (2 diffs)
- trunk/src/cairo/ImageSurface.d (modified) (7 diffs)
- trunk/src/cairo/Pattern.d (modified) (3 diffs)
- trunk/src/cairo/PdfSurface.d (modified) (3 diffs)
- trunk/src/cairo/PostScriptSurface.d (modified) (4 diffs)
- trunk/src/cairo/ScaledFont.d (modified) (2 diffs)
- trunk/src/cairo/Status.d (modified) (3 diffs)
- trunk/src/cairo/Surface.d (modified) (4 diffs)
- trunk/src/cairo/SvgSurface.d (modified) (3 diffs)
- trunk/src/cairo/Version.d (modified) (2 diffs)
- trunk/src/gtkc/cairo.d (modified) (8 diffs)
- trunk/src/gtkc/cairotypes.d (modified) (16 diffs)
- trunk/src/gtkc/gtk.d (modified) (1 diff)
- trunk/wrap/APILookupCairo.txt (modified) (1 diff)
- trunk/wrap/downloadFiles.sh (modified) (1 diff)
- trunk/wrap/utils/GtkDClass.d (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/cairo/Context.d
r480 r499 222 222 /** 223 223 * Description 224 * Paths are the most basic drawing tools and are primarily used to implicitly 225 * generate simple masks. 224 226 */ 225 227 226 228 /** 227 229 * Description 230 * The current transformation matrix, ctm, is a 231 * two-dimensional affine transformation that maps all coordinates and other 232 * drawing instruments from the user space into the 233 * surface's canonical coordinate system, also known as the device 234 * space. 228 235 */ 229 236 230 237 /** 231 238 * Description 239 * Cairo has two sets of text rendering capabilities: 240 * The functions with text in their name form cairo's 241 * toy text API. The toy API takes UTF-8 encoded 242 * text and is limited in its functionality to rendering simple 243 * left-to-right text with no advanced features. That means for example 244 * that most complex scripts like Hebrew, Arabic, and Indic scripts are 245 * out of question. No kerning or correct positioning of diacritical marks 246 * either. The font selection is pretty limited too and doesn't handle the 247 * case that the selected font does not cover the characters in the text. 248 * This set of functions are really that, a toy text API, for testing and 249 * demonstration purposes. Any serious application should avoid them. 250 * The functions with glyphs in their name form cairo's 251 * low-level text API. The low-level API relies on 252 * the user to convert text to a set of glyph indexes and positions. This 253 * is a very hard problem and is best handled by external libraries, like 254 * the pangocairo that is part of the Pango text layout and rendering library. 255 * Pango is available from http://www.pango.org/. 232 256 */ 233 257 … … 237 261 * surface should be constructed with a backend-specific function such 238 262 * as cairo_image_surface_create() (or any other 239 * cairo_ <backend>_surface_create variant).263 * cairo_backend_surface_create variant). 240 264 * This function references target, so you can immediately 241 265 * call cairo_surface_destroy() on it if you don't need to … … 290 314 /** 291 315 * Checks whether an error has previously occurred for this context. 292 * Returns: the current status of this context, see cairo_status_t316 * Returns: the current status of this context, see cairo_status_t 293 317 */ 294 318 public cairo_status_t status() … … 391 415 * Since 1.2 392 416 * Params: 393 * content = a cairo_content_t indicating the type of group that417 * content = a %cairo_content_t indicating the type of group that 394 418 * will be created 395 419 */ … … 432 456 433 457 /** 434 * Gets the target surface for the current group as started by the 435 * most recent call to cairo_push_group() or 436 * cairo_push_group_with_content(). 437 * This function will return NULL if called "outside" of any group 438 * rendering blocks, (that is, after the last balancing call to 439 * cairo_pop_group() or cairo_pop_group_to_source()). 458 * Gets the current destination surface for the context. This is either 459 * the original target surface as passed to cairo_create() or the target 460 * surface for the current group as started by the most recent call to 461 * cairo_push_group() or cairo_push_group_with_content(). 462 * This function will always return a valid pointer, but the result 463 * can be a "nil" surface if cr is already in an error state, 464 * (ie. cairo_status() != CAIRO_STATUS_SUCCESS). 465 * A nil surface is indicated by cairo_surface_status() 466 * != CAIRO_STATUS_SUCCESS. 440 467 * Since 1.2 441 * Returns: the target group surface, or NULL if none. Thisobject is owned by cairo. To keep a reference to it, you must callcairo_surface_reference().468 * Returns: the target surface. This object is owned by cairo. Tokeep a reference to it, you must call cairo_surface_reference(). 442 469 */ 443 470 public Surface getGroupTarget() … … 460 487 * 1. If the values passed in are outside that range, they will be 461 488 * clamped. 489 * The default source pattern is opaque black, (that is, it is 490 * equivalent to cairo_set_source_rgb (cr, 0.0, 0.0, 0.0)). 462 491 * Params: 463 492 * red = red component of color … … 478 507 * range 0 to 1. If the values passed in are outside that range, they 479 508 * will be clamped. 509 * The default source pattern is opaque black, (that is, it is 510 * equivalent to cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 1.0)). 480 511 * Params: 481 512 * red = red component of color … … 498 529 * that further modifications of the current transformation matrix 499 530 * will not affect the source pattern. See cairo_pattern_set_matrix(). 500 * XXX: I'd also like to direct the reader's attention to some501 * ( not-yet-written) section on cairo's imaging model. How would I do502 * that if such a section existed? (cworth).531 * The default source pattern is a solid pattern that is opaque black, 532 * (that is, it is equivalent to cairo_set_source_rgb (cr, 0.0, 0.0, 533 * 0.0)). 503 534 * Params: 504 535 * source = a cairo_pattern_t to be used as the source for … … 590 621 * dashes. 591 622 * If any value in dashes is negative, or if all values are 0, then 592 * c airo_twill be put into an error state with a status of593 * CAIRO_STATUS_INVALID_DASH.623 * cr will be put into an error state with a status of 624 * #CAIRO_STATUS_INVALID_DASH. 594 625 * Params: 595 626 * dashes = an array specifying alternate lengths of on and off stroke portions … … 637 668 * both cairo_fill() and cairo_clip(). See cairo_fill_rule_t for details 638 669 * on the semantics of each available fill rule. 670 * The default fill rule is CAIRO_FILL_RULE_WINDING. 639 671 * Params: 640 672 * fillRule = a fill rule, specified as a cairo_fill_rule_t … … 664 696 * cairo_stroke_to_path(), but does not have any effect during path 665 697 * construction. 698 * The default line cap style is CAIRO_LINE_CAP_BUTT. 666 699 * Params: 667 700 * lineCap = a line cap style … … 691 724 * cairo_stroke_to_path(), but does not have any effect during path 692 725 * construction. 693 * Params: 694 * lineJoin = a line joint style 726 * The default line join style is CAIRO_LINE_JOIN_MITER. 727 * Params: 728 * lineJoin = a line join style 695 729 */ 696 730 public void setLineJoin(cairo_line_join_t lineJoin) … … 762 796 * cairo_stroke_to_path(), but does not have any effect during path 763 797 * construction. 798 * The default miter limit value is 10.0, which will convert joins 799 * with interior angles less than 11 degrees to bevels instead of 800 * miters. For reference, a miter limit of 2.0 makes the miter cutoff 801 * at 60 degrees, and a miter limit of 1.414 makes the cutoff at 90 802 * degrees. 803 * A miter limit for a desired angle can be computed as: miter limit = 804 * 1/sin(angle/2) 764 805 * Params: 765 806 * limit = miter limit to set … … 785 826 * operations. See cairo_operator_t for details on the semantics of 786 827 * each available compositing operator. 787 * XXX: I'd also like to direct the reader's attention to some 788 * (not-yet-written) section on cairo's imaging model. How would I do 789 * that if such a section existed? (cworth). 828 * The default operator is CAIRO_OPERATOR_OVER. 790 829 * Params: 791 830 * op = a compositing operator, specified as a cairo_operator_t … … 838 877 * region with the current path as it would be filled by cairo_fill() 839 878 * and according to the current fill rule (see cairo_set_fill_rule()). 840 * After cairo_clip , the current path will be cleared from the cairo879 * After cairo_clip(), the current path will be cleared from the cairo 841 880 * context. 842 881 * The current clip region affects all drawing operations by … … 860 899 * region with the current path as it would be filled by cairo_fill() 861 900 * and according to the current fill rule (see cairo_set_fill_rule()). 862 * Unlike cairo_clip(), cairo_clip_preserve preserves the path within901 * Unlike cairo_clip(), cairo_clip_preserve() preserves the path within 863 902 * the cairo context. 864 903 * The current clip region affects all drawing operations by … … 933 972 * user-space rectangles. The status may have other values to indicate 934 973 * other errors. 935 * The caller must always call cairo_rectangle_list_destroy on the result of936 * this function.937 974 * Since 1.4 938 * Returns: the current clip region as a list of rectangles in user coordinates .975 * Returns: the current clip region as a list of rectangles in user coordinates,which should be destroyed using cairo_rectangle_list_destroy(). 939 976 */ 940 977 public cairo_rectangle_list_t* copyClipRectangleList() … … 947 984 * A drawing operator that fills the current path according to the 948 985 * current fill rule, (each sub-path is implicitly closed before being 949 * filled). After cairo_fill , the current path will be cleared from986 * filled). After cairo_fill(), the current path will be cleared from 950 987 * the cairo context. See cairo_set_fill_rule() and 951 988 * cairo_fill_preserve(). … … 960 997 * A drawing operator that fills the current path according to the 961 998 * current fill rule, (each sub-path is implicitly closed before being 962 * filled). Unlike cairo_fill(), cairo_fill_preserve preserves the999 * filled). Unlike cairo_fill(), cairo_fill_preserve() preserves the 963 1000 * path within the cairo context. 964 1001 * See cairo_set_fill_rule() and cairo_fill(). … … 972 1009 /** 973 1010 * Computes a bounding box in user coordinates covering the area that 974 * would be affected by a cairo_fill() operation given the current path 975 * and fill parameters. If the current path is empty, returns an empty 976 * rectangle (0,0, 0,0). Surface dimensions and clipping are not taken 977 * into account. 1011 * would be affected, (the "inked" area), by a cairo_fill() operation 1012 * given the current path and fill parameters. If the current path is 1013 * empty, returns an empty rectangle ((0,0), (0,0)). Surface 1014 * dimensions and clipping are not taken into account. 1015 * Contrast with cairo_path_extents(), which is similar, but returns 1016 * non-zero extents for some paths with no inked area, (such as a 1017 * simple line segment). 1018 * Note that cairo_fill_extents() must necessarily do more work to 1019 * compute the precise inked areas in light of the fill rule, so 1020 * cairo_path_extents() may be more desirable for sake of performance 1021 * if the non-inked path extents are desired. 978 1022 * See cairo_fill(), cairo_set_fill_rule() and cairo_fill_preserve(). 979 1023 * Params: … … 1079 1123 * A drawing operator that strokes the current path according to the 1080 1124 * current line width, line join, line cap, and dash settings. Unlike 1081 * cairo_stroke(), cairo_stroke_preserve preserves the path within the1125 * cairo_stroke(), cairo_stroke_preserve() preserves the path within the 1082 1126 * cairo context. 1083 1127 * See cairo_set_line_width(), cairo_set_line_join(), … … 1093 1137 /** 1094 1138 * Computes a bounding box in user coordinates covering the area that 1095 * would be affected by a cairo_stroke() operation operation given the 1096 * current path and stroke parameters. If the current path is empty, 1139 * would be affected, (the "inked" area), by a cairo_stroke() 1140 * operation operation given the current path and stroke 1141 * parameters. If the current path is empty, returns an empty 1142 * rectangle ((0,0), (0,0)). Surface dimensions and clipping are not 1143 * taken into account. 1144 * Note that if the line width is set to exactly zero, then 1145 * cairo_stroke_extents() will return an empty rectangle. Contrast with 1146 * cairo_path_extents() which can be used to compute the non-empty 1147 * bounds as the line width approaches zero. 1148 * Note that cairo_stroke_extents() must necessarily do more work to 1149 * compute the precise inked areas in light of the stroke parameters, 1150 * so cairo_path_extents() may be more desirable for sake of 1151 * performance if non-inked path extents are desired. 1152 * See cairo_stroke(), cairo_set_line_width(), cairo_set_line_join(), 1153 * cairo_set_line_cap(), cairo_set_dash(), and 1154 * cairo_stroke_preserve(). 1097 1155 * Params: 1098 1156 * x1 = left of the resulting extents … … 1131 1189 * for the next page too. Use cairo_show_page() if you want to get an 1132 1190 * empty page after the emission. 1191 * This is a convenience function that simply calls 1192 * cairo_surface_copy_page() on cr's target. 1133 1193 */ 1134 1194 public void copyPage() … … 1141 1201 * Emits and clears the current page for backends that support multiple 1142 1202 * pages. Use cairo_copy_page() if you don't want to clear the page. 1203 * This is a convenience function that simply calls 1204 * cairo_surface_show_page() on cr's target. 1143 1205 */ 1144 1206 public void showPage() … … 1234 1296 * to cairo_path_destroy() the path pointer is no longer valid and 1235 1297 * should not be used further. 1236 * N OTE: cairo_path_destroy functionshould only be called with a1298 * Note: cairo_path_destroy() should only be called with a 1237 1299 * pointer to a cairo_path_t returned by a cairo function. Any path 1238 1300 * that is created manually (ie. outside of cairo) should be destroyed … … 1265 1327 1266 1328 /** 1329 * Returns whether a current point is defined on the current path. 1330 * See cairo_get_current_point() for details on the current point. 1331 * Since 1.6 1332 * Returns: whether a current point is defined. 1333 */ 1334 public cairo_bool_t hasCurrentPoint() 1335 { 1336 // cairo_bool_t cairo_has_current_point (cairo_t *cr); 1337 return cairo_has_current_point(cairo); 1338 } 1339 1340 /** 1267 1341 * Gets the current point of the current path, which is 1268 1342 * conceptually the final point reached by the path so far. 1269 1343 * The current point is returned in the user-space coordinate 1270 * system. If there is no defined current point then x and y will 1271 * both be set to 0.0. 1344 * system. If there is no defined current point or if cr is in an 1345 * error status, x and y will both be set to 0.0. It is possible to 1346 * check this in advance with cairo_has_current_point(). 1272 1347 * Most path construction functions alter the current point. See the 1273 1348 * Params: … … 1319 1394 * the ends of the sub-path. Instead, there is a line join connecting 1320 1395 * the final and initial segments of the sub-path. 1321 * If there is no current point before the call to cairo_close_path ,1396 * If there is no current point before the call to cairo_close_path(), 1322 1397 * this function will have no effect. 1323 * Note: As of cairo version 1.2.4 any call to cairo_close_path will1398 * Note: As of cairo version 1.2.4 any call to cairo_close_path() will 1324 1399 * place an explicit MOVE_TO element into the path immediately after 1325 1400 * the CLOSE_PATH element, (which can be seen in cairo_copy_path() for … … 1343 1418 * If there is a current point, an initial line segment will be added 1344 1419 * to the path to connect the current point to the beginning of the 1345 * arc. 1420 * arc. If this initial line is undesired, it can be avoided by 1421 * calling cairo_new_sub_path() before calling cairo_arc(). 1346 1422 * Angles are measured in radians. An angle of 0.0 is in the direction 1347 1423 * of the positive X axis (in user space). An angle of M_PI/2.0 radians … … 1483 1559 * This allows for chaining multiple calls to to cairo_text_path() 1484 1560 * without having to set current point in between. 1485 * N OTE: The cairo_text_path() function call is part of what the cairo1561 * Note: The cairo_text_path() function call is part of what the cairo 1486 1562 * designers call the "toy" text API. It is convenient for short demos 1487 1563 * and simple programs, but it is not expected to be adequate for … … 1564 1640 1565 1641 /** 1642 * Computes a bounding box in user-space coordinates covering the 1643 * points on the current path. If the current path is empty, returns 1644 * an empty rectangle ((0,0), (0,0)). Stroke parameters, fill rule, 1645 * surface dimensions and clipping are not taken into account. 1646 * Contrast with cairo_fill_extents() and cairo_stroke_extents() which 1647 * return the extents of only the area that would be "inked" by 1648 * the corresponding drawing operations. 1649 * The result of cairo_path_extents() is defined as equivalent to the 1650 * limit of cairo_stroke_extents() with CAIRO_LINE_CAP_ROUND as the 1651 * line width approaches 0.0, (but never reaching the empty-rectangle 1652 * returned by cairo_stroke_extents() for a line width of 0.0). 1653 * Specifically, this means that zero-area sub-paths such as 1654 * cairo_move_to();cairo_line_to() segments, (even degenerate cases 1655 * where the coordinates to both calls are identical), will be 1656 * considered as contributing to the extents. However, a lone 1657 * cairo_move_to() will not contribute to the results of 1658 * cairo_path_extents(). 1659 * Since 1.6 1660 * Params: 1661 * x1 = left of the resulting extents 1662 * y1 = top of the resulting extents 1663 * x2 = right of the resulting extents 1664 * y2 = bottom of the resulting extents 1665 */ 1666 public void pathExtents(double* x1, double* y1, double* x2, double* y2) 1667 { 1668 // void cairo_path_extents (cairo_t *cr, double *x1, double *y1, double *x2, double *y2); 1669 cairo_path_extents(cairo, x1, y1, x2, y2); 1670 } 1671 1672 /** 1566 1673 * Modifies the current transformation matrix (CTM) by translating the 1567 1674 * user-space origin by (tx, ty). This offset is interpreted as a 1568 1675 * user-space coordinate according to the CTM in place before the new 1569 * call to cairo_translate . In other words, the translation of the1676 * call to cairo_translate(). In other words, the translation of the 1570 1677 * user-space origin takes place after any existing transformation. 1571 1678 * Params: … … 1717 1824 1718 1825 /** 1826 * Note: The cairo_select_font_face() function call is part of what 1827 * the cairo designers call the "toy" text API. It is convenient for 1828 * short demos and simple programs, but it is not expected to be 1829 * adequate for serious text-using applications. 1719 1830 * Selects a family and style of font from a simplified description as 1720 * a family name, slant and weight. This function is meant to be used 1721 * only for applications with simple font needs: Cairo doesn't provide 1722 * for operations such as listing all available fonts on the system, 1723 * and it is expected that most applications will need to use a more 1724 * comprehensive font handling and text layout library in addition to 1725 * cairo. 1831 * a family name, slant and weight. Cairo provides no operation to 1832 * list available family names on the system (this is a "toy", 1833 * remember"), but the standard CSS2 generic family names, ("serif", 1834 * "sans-serif", "cursive", "fantasy", "monospace"), are likely to 1835 * work as expected. 1836 * For "real" font selection, see the font-backend-specific 1837 * font_face_create functions for the font backend you are using. (For 1838 * example, if you are using the freetype-based cairo-ft font backend, 1839 * see cairo_ft_font_face_create_for_ft_face() or 1840 * cairo_ft_font_face_create_for_pattern().) The resulting font face 1841 * could then be used with cairo_scaled_font_create() and 1842 * cairo_set_scaled_font(). 1843 * Similarly, when using the "real" font support, you can call 1844 * directly into the underlying font system, (such as fontconfig or 1845 * freetype), for operations such as listing available fonts, etc. 1846 * It is expected that most applications will need to use a more 1847 * comprehensive font handling and text layout library, (for example, 1848 * pango), in conjunction with cairo. 1849 * If text is drawn without a call to cairo_select_font_face(), (nor 1850 * cairo_set_font_face() nor cairo_set_scaled_font()), the default 1851 * family is "sans", slant is CAIRO_FONT_SLANT_NORMAL, and weight is 1852 * CAIRO_FONT_WEIGHT_NORMAL. 1726 1853 * Params: 1727 1854 * family = a font family name, encoded in UTF-8 … … 1741 1868 * units. (More precisely, this matrix will result in the font's 1742 1869 * em-square being a size by size square in user space.) 1870 * If text is drawn without a call to cairo_set_font_size(), (nor 1871 * cairo_set_font_matrix() nor cairo_set_scaled_font()), the default 1872 * font size is 10.0. 1743 1873 * Params: 1744 1874 * size = the new font size, in user space units … … 1885 2015 * by its advance values. This allows for easy display of a single 1886 2016 * logical string with multiple calls to cairo_show_text(). 1887 * N OTE: The cairo_show_text() function call is part of what the cairo2017 * Note: The cairo_show_text() function call is part of what the cairo 1888 2018 * designers call the "toy" text API. It is convenient for short demos 1889 2019 * and simple programs, but it is not expected to be adequate for trunk/src/cairo/FontFace.d
r480 r499 63 63 /** 64 64 * Description 65 * cairo_font_face_t represents a particular font at a particular weight, 66 * slant, and other characteristic but no size, transformation, or size. 67 * Font faces are created using font-backend-specific 68 * constructors, typically of the form 69 * cairo_backend_font_face_create(), 70 * or implicitly using the toy text API by way of 71 * cairo_select_font_face(). The resulting face can be accessed using 72 * cairo_get_font_face(). 65 73 */ 66 74 public class FontFace trunk/src/cairo/FontOption.d
r480 r499 63 63 /** 64 64 * Description 65 * The font options specify how fonts should be rendered. Most of the time the 66 * font options implied by a surface are just right and do not need any changes, 67 * but for pixel-based targets tweaking font options may result in superior 68 * output on a particular display. 65 69 */ 66 70 public class FontOption … … 185 189 * Params: 186 190 * other = another cairo_font_options_t 187 * Returns: TRUE if all fields of the two font options objects match 191 * Returns: TRUE if all fields of the two font options objects match.Note that this function will return FALSE if either object is inerror. 188 192 */ 189 193 public cairo_bool_t equal(FontOption other) trunk/src/cairo/ImageSurface.d
r480 r499 38 38 * prefixes: 39 39 * - cairo_image_surface_ 40 * - cairo_ 40 41 * omit structs: 41 42 * omit prefixes: … … 66 67 /** 67 68 * Description 68 * Image surfaces provide the ability to render to memory buffers69 * either allocated by cairo or by the calling code. The supported70 * image formats are those defined in cairo_format_t.69 * Image surfaces provide the ability to render to memory buffers 70 * either allocated by cairo or by the calling code. The supported 71 * image formats are those defined in cairo_format_t. 71 72 */ 72 73 public class ImageSurface : Surface … … 106 107 /** 107 108 * Description 108 */ 109 * The PNG functions allow reading PNG images into image surfaces, and writing 110 * any surface to a PNG file. 111 */ 112 113 /** 114 * This function provides a stride value that will respect all 115 * alignment requirements of the accelerated image-rendering code 116 * Since 1.6 117 * Params: 118 * format = A cairo_format_t value 119 * width = The desired width of an image surface to be created. 120 * Returns: the appropriate stride to use given the desiredformat and width, or -1 if either the format is invalid or the widthtoo large. 121 */ 122 public static int formatStrideForWidth(cairo_format_t format, int width) 123 { 124 // int cairo_format_stride_for_width (cairo_format_t format, int width); 125 return cairo_format_stride_for_width(format, width); 126 } 109 127 110 128 /** … … 118 136 * width = width of the surface, in pixels 119 137 * height = height of the surface, in pixels 120 * Returns: a pointer to the newly created surface. The callerowns the surface and should call cairo_surface_destroy when donewith it.This function always returns a valid pointer, but it will return apointer to a "nil" surface if an error such as out of memoryoccurs. You can use cairo_surface_status() to check for this.138 * Returns: a pointer to the newly created surface. The callerowns the surface and should call cairo_surface_destroy() when donewith it.This function always returns a valid pointer, but it will return apointer to a "nil" surface if an error such as out of memoryoccurs. You can use cairo_surface_status() to check for this. 121 139 */ 122 140 public static ImageSurface create(cairo_format_t format, int width, int height) … … 139 157 * must explicitly clear the buffer, using, for example, 140 158 * cairo_rectangle() and cairo_fill() if you want it cleared. 141 * Params: 142 * data = a pointer to a buffer supplied by the application 143 * in which to write contents. 159 * Note that the stride may be larger than 160 * width*bytes_per_pixel to provide proper alignment for each pixel 161 * and row. This alignment is required to allow high-performance rendering 162 * within cairo. The correct way to obtain a legal stride value is to 163 * call cairo_format_stride_for_width() with the desired format and 164 * maximum image width value, and the use the resulting stride value 165 * to allocate the data and to create the image surface. See 166 * cairo_format_stride_for_width() for example code. 167 * Params: 168 * data = a pointer to a buffer supplied by the application in which 169 * to write contents. This pointer must be suitably aligned for any 170 * kind of variable, (for example, a pointer returned by malloc). 144 171 * format = the format of pixels in the buffer 145 172 * width = the width of the image to be stored in the buffer 146 173 * height = the height of the image to be stored in the buffer 147 * stride = the number of bytes between the start of rows 148 * in the buffer. Having this be specified separate from width149 * allows for padding at the end of rows, or for writing150 * to a subportion of a larger image.151 * Returns: a pointer to the newly created surface. The callerowns the surface and should call cairo_surface_destroy when donewith it.This function always returns a valid pointer, but it will return apointer to a "nil" surface if an error such as out of memoryoccurs. You can usecairo_surface_status() to check for this.See cairo_surface_set_user_data() for a means of attaching adestroy-notification fallback to the surface if necessary.174 * stride = the number of bytes between the start of rows in the 175 * buffer as allocated. This value should always be computed by 176 * cairo_format_stride_for_width() before allocating the data 177 * buffer. 178 * Returns: a pointer to the newly created surface. The callerowns the surface and should call cairo_surface_destroy() when donewith it.This function always returns a valid pointer, but it will return apointer to a "nil" surface in the case of an error such as out ofmemory or an invalid stride value. In case of invalid stride valuethe error status of the returned surface will beCAIRO_STATUS_INVALID_STRIDE. You can usecairo_surface_status() to check for this.See cairo_surface_set_user_data() for a means of attaching adestroy-notification fallback to the surface if necessary. 152 179 */ 153 180 public static ImageSurface createForData(ubyte* data, cairo_format_t format, int width, int height, int stride) … … 260 287 * image. 261 288 * Params: 289 * surface = a cairo_surface_t with pixel contents 262 290 * filename = the name of a file to write to 263 291 * Returns: CAIRO_STATUS_SUCCESS if the PNG file was writtensuccessfully. Otherwise, CAIRO_STATUS_NO_MEMORY if memory could notbe allocated for the operation orCAIRO_STATUS_SURFACE_TYPE_MISMATCH if the surface does not havepixel contents, or CAIRO_STATUS_WRITE_ERROR if an I/O error occurswhile attempting to write the file. 264 292 */ 265 public cairo_status_t writeToPng(string filename)293 public cairo_status_t surfaceWriteToPng(string filename) 266 294 { 267 295 // cairo_status_t cairo_surface_write_to_png (cairo_surface_t *surface, const char *filename); … … 272 300 * Writes the image surface to the write function. 273 301 * Params: 302 * surface = a cairo_surface_t with pixel contents 274 303 * writeFunc = a cairo_write_func_t 275 304 * closure = closure data for the write function 276 305 * Returns: CAIRO_STATUS_SUCCESS if the PNG file was writtensuccessfully. Otherwise, CAIRO_STATUS_NO_MEMORY is returned ifmemory could not be allocated for the operation,CAIRO_STATUS_SURFACE_TYPE_MISMATCH if the surface does not havepixel contents. 277 306 */ 278 public cairo_status_t writeToPngStream(cairo_write_func_t writeFunc, void* closure)307 public cairo_status_t surfaceWriteToPngStream(cairo_write_func_t writeFunc, void* closure) 279 308 { 280 309 // cairo_status_t cairo_surface_write_to_png_stream (cairo_surface_t *surface, cairo_write_func_t write_func, void *closure); trunk/src/cairo/Pattern.d
r480 r499 69 69 /** 70 70 * Description 71 * cairo_pattern_t is the paint with which cairo draws. 72 * The primary use of patterns is as the source for all cairo drawing operations, 73 * although they can also be used as masks, that is, as the brush too. 74 * A cairo pattern is created by using one of the many constructors, 75 * of the form cairo_pattern_create_type() 76 * or implicitly through 77 * cairo_set_source_type() functions. 71 78 */ 72 79 public class Pattern … … 430 437 * See cairo_extend_t for details on the semantics of each extend 431 438 * strategy. 439 * The default extend mode is CAIRO_EXTEND_NONE for surface patterns 440 * and CAIRO_EXTEND_PAD for gradient patterns. 432 441 * Params: 433 442 * extend = a cairo_extend_t describing how the area outside of the … … 454 463 * Sets the filter to be used for resizing when using this pattern. 455 464 * See cairo_filter_t for details on each filter. 465 * * Note that you might want to control filtering even when you do not 466 * have an explicit cairo_pattern_t object, (for example when using 467 * cairo_set_source_surface()). In these cases, it is convenient to 468 * use cairo_get_source() to get access to the pattern that cairo 456 469 * Params: 457 470 * filter = a cairo_filter_t describing the filter to use for resizing trunk/src/cairo/PdfSurface.d
r480 r499 66 66 /** 67 67 * Description 68 * The PDF surface is used to render cairo graphics to Adobe 69 * PDF files and is a multi-page vector surface backend. 68 70 */ 69 71 public class PdfSurface : Surface … … 112 114 * widthInPoints = width of the surface, in points (1 point == 1/72.0 inch) 113 115 * heightInPoints = height of the surface, in points (1 point == 1/72.0 inch) 114 * Returns: a pointer to the newly created surface. The callerowns the surface and should call cairo_surface_destroy when donewith it.This function always returns a valid pointer, but it will return apointer to a "nil" surface if an error such as out of memoryoccurs. You can use cairo_surface_status() to check for this.116 * Returns: a pointer to the newly created surface. The callerowns the surface and should call cairo_surface_destroy() when donewith it.This function always returns a valid pointer, but it will return apointer to a "nil" surface if an error such as out of memoryoccurs. You can use cairo_surface_status() to check for this. 115 117 */ 116 118 public static PdfSurface create(string filename, double widthInPoints, double heightInPoints) … … 135 137 * widthInPoints = width of the surface, in points (1 point == 1/72.0 inch) 136 138 * heightInPoints = height of the surface, in points (1 point == 1/72.0 inch) 137 * Returns: a pointer to the newly created surface. The callerowns the surface and should call cairo_surface_destroy when donewith it.This function always returns a valid pointer, but it will return apointer to a "nil" surface if an error such as out of memoryoccurs. You can use cairo_surface_status() to check for this.139 * Returns: a pointer to the newly created surface. The callerowns the surface and should call cairo_surface_destroy() when donewith it.This function always returns a valid pointer, but it will return apointer to a "nil" surface if an error such as out of memoryoccurs. You can use cairo_surface_status() to check for this. 138 140 */ 139 141 public static PdfSurface createForStream(cairo_write_func_t writeFunc, void* closure, double widthInPoints, double heightInPoints) trunk/src/cairo/PostScriptSurface.d
r480 r499 66 66 /** 67 67 * Description 68 * The PostScript surface is used to render cairo graphics to Adobe 69 * PostScript files and is a multi-page vector surface backend. 68 70 */ 69 71 public class PostScriptSurface : Surface … … 116 118 * widthInPoints = width of the surface, in points (1 point == 1/72.0 inch) 117 119 * heightInPoints = height of the surface, in points (1 point == 1/72.0 inch) 118 * Returns: a pointer to the newly created surface. The callerowns the surface and should call cairo_surface_destroy when donewith it.This function always returns a valid pointer, but it will return apointer to a "nil" surface if an error such as out of memoryoccurs. You can use cairo_surface_status() to check for this.120 * Returns: a pointer to the newly created surface. The callerowns the surface and should call cairo_surface_destroy() when donewith it.This function always returns a valid pointer, but it will return apointer to a "nil" surface if an error such as out of memoryoccurs. You can use cairo_surface_status() to check for this. 119 121 */ 120 122 public static PostScriptSurface create(string filename, double widthInPoints, double heightInPoints) … … 143 145 * widthInPoints = width of the surface, in points (1 point == 1/72.0 inch) 144 146 * heightInPoints = height of the surface, in points (1 point == 1/72.0 inch) 145 * Returns: a pointer to the newly created surface. The callerowns the surface and should call cairo_surface_destroy when donewith it.This function always returns a valid pointer, but it will return apointer to a "nil" surface if an error such as out of memoryoccurs. You can use cairo_surface_status() to check for this.147 * Returns: a pointer to the newly created surface. The callerowns the surface and should call cairo_surface_destroy() when donewith it.This function always returns a valid pointer, but it will return apointer to a "nil" surface if an error such as out of memoryoccurs. You can use cairo_surface_status() to check for this. 146 148 */ 147 149 public static PostScriptSurface createForStream(cairo_write_func_t writeFunc, void* closure, double widthInPoints, double heightInPoints) … … 155 157 } 156 158 return new PostScriptSurface(cast(cairo_surface_t*) p); 159 } 160 161 /** 162 * Restricts the generated PostSript file to level. See 163 * cairo_ps_get_levels() for a list of available level values that 164 * can be used here. 165 * This function should only be called before any drawing operations 166 * have been performed on the given surface. The simplest way to do 167 * this is to call this function immediately after creating the 168 * surface. 169 * Since 1.6 170 * Params: 171 * level = PostScript level 172 */ 173 public void restrictToLevel(cairo_ps_level_t level) 174 { 175 // void cairo_ps_surface_restrict_to_level (cairo_surface_t *surface, cairo_ps_level_t level); 176 cairo_ps_surface_restrict_to_level(cairo_surface, level); 177 } 178 179 /** 180 * Used to retrieve the list of supported levels. See 181 * cairo_ps_surface_restrict_to_level(). 182 * Since 1.6 183 * Params: 184 * levels = supported level list 185 * numLevels = list length 186 */ 187 public static void cairoPsGetLevels(cairo_ps_level_t** levels, int* numLevels) 188 { 189 // void cairo_ps_get_levels (cairo_ps_level_t const **levels, int *num_levels); 190 cairo_ps_get_levels(levels, numLevels); 191 } 192 193 /** 194 * Get the string representation of the given level id. This function 195 * will return NULL if level id isn't valid. See cairo_ps_get_levels() 196 * for a way to get the list of valid level ids. 197 * Since 1.6 198 * Params: 199 * level = a level id 200 * Returns: the string associated to given level. 201 */ 202 public static string cairoPsLevelToString(cairo_ps_level_t level) 203 { 204 // const char* cairo_ps_level_to_string (cairo_ps_level_t level); 205 return Str.toString(cairo_ps_level_to_string(level)); 206 } 207 208 /** 209 * If eps is TRUE, the PostScript surface will output Encapsulated 210 * PostScript. 211 * This function should only be called before any drawing operations 212 * have been performed on the current page. The simplest way to do 213 * this is to call this function immediately after creating the 214 * surface. An Encapsulated PostScript file should never contain more 215 * than one page. 216 * Since 1.6 217 * Params: 218 * eps = TRUE to output EPS format PostScript 219 */ 220 public void setEps(cairo_bool_t eps) 221 { 222 // void cairo_ps_surface_set_eps (cairo_surface_t *surface, cairo_bool_t eps); 223 cairo_ps_surface_set_eps(cairo_surface, eps); 224 } 225 226 /** 227 * Check whether the PostScript surface will output Encapsulated PostScript. 228 * Since 1.6 229 * Returns: TRUE if the surface will output Encapsulated PostScript. 230 */ 231 public cairo_bool_t getEps() 232 { 233 // cairo_bool_t cairo_ps_surface_get_eps (cairo_surface_t *surface); 234 return cairo_ps_surface_get_eps(cairo_surface); 157 235 } 158 236 trunk/src/cairo/ScaledFont.d
r480 r499 74 74 /** 75 75 * Description 76 * cairo_scaled_font_t represents a realization of a font face at a particular 77 * size and transformation and a certain set of font options. 76 78 */ 77 79 public class ScaledFont … … 125 127 * be used. 126 128 * options = options to use when getting metrics for the font and 127 * rendering with it. 129 * rendering with it. A NULL pointer will be interpreted as 130 * meaning the default options. 128 131 * Returns: a newly created cairo_scaled_font_t. Destroy with cairo_scaled_font_destroy() 129 132 */ trunk/src/cairo/Status.d
r480 r499 65 65 /** 66 66 * Description 67 * Cairo uses a single status type to represent all kinds of errors. A status 68 * value of CAIRO_STATUS_SUCCESS represents no error and has an integer value 69 * of zero. All other status values represent an error. 70 * Cairo's error handling is designed to be easy to use and safe. All major 71 * cairo objects retain an error status internally which 72 * can be queried anytime by the users using cairo*_status() calls. In 73 * the mean time, it is safe to call all cairo functions normally even if the 74 * underlying object is in an error status. This means that no error handling 75 * code is required before or after each individual cairo function call. 67 76 */ 68 77 public class Status … … 76 85 * Params: 77 86 * status = a cairo status 78 * Returns: a string representation of the status87 * Returns: a string representation of the status 79 88 */ 80 89 public static string oString(cairo_status_t status) … … 90 99 * This function is intended to be useful when using memory-checking 91 100 * tools such as valgrind. When valgrind's memcheck analyzes a 92 * cairo-using program without a call to cairo_debug_reset_static_data ,101 * cairo-using program without a call to cairo_debug_reset_static_data(), 93 102 * it will report all data reachable via cairo's static objects as 94 * "still reachable". Calling cairo_debug_reset_static_data just prior103 * "still reachable". Calling cairo_debug_reset_static_data() just prior 95 104 * to program termination will make it easier to get squeaky clean 96 105 * reports from valgrind. trunk/src/cairo/Surface.d
r480 r499 65 65 /** 66 66 * Description 67 * cairo_surface_t is the abstract type representing all different drawing 68 * targets that cairo can render to. The actual drawings are 69 * performed using a cairo context. 70 * A cairo surface is created by using backend-specific 71 * constructors, typically of the form 72 * cairo_backend_surface_create(). 67 73 */ 68 74 public class Surface … … 115 121 * width = width of the new surface, (in device-space units) 116 122 * height = height of the new surface (in device-space units) 117 * Returns: a pointer to the newly allocated surface. The callerowns the surface and should call cairo_surface_destroy when donewith it.This function always returns a valid pointer, but it will return apointer to a "nil" surface if other is already in an error stateor any other error occurs.123 * Returns: a pointer to the newly allocated surface. The callerowns the surface and should call cairo_surface_destroy() when donewith it.This function always returns a valid pointer, but it will return apointer to a "nil" surface if other is already in an error stateor any other error occurs. 118 124 */ 119 125 public Surface createSimilar(cairo_content_t content, int width, int height) … … 313 319 * device resolution. So this function has no effect on those 314 320 * backends. 315 * N OTE: The fallback resolution only takes effect at the time of321 * Note: The fallback resolution only takes effect at the time of 316 322 * completing a page (with cairo_show_page() or cairo_copy_page()) so 317 323 * there is currently no way to have more than one fallback resolution 318 324 * in effect on a single page. 325 * The default fallback resoultion is 300 pixels per inch in both 326 * dimensions. 319 327 * Since 1.2 320 328 * Params: … … 385 393 return cairo_surface_get_user_data(cairo_surface, key); 386 394 } 395 396 /** 397 * Emits the current page for backends that support multiple pages, 398 * but doesn't clear it, so that the contents of the current page will 399 * be retained for the next page. Use cairo_surface_show_page() if you 400 * want to get an empty page after the emission. 401 * Since 1.6 402 */ 403 <
