home *** CD-ROM | disk | FTP | other *** search
- #ifndef draw_H
- #define draw_H
-
- /* C header file for Draw
- * written by DefMod (Sep 7 1994) on Wed Sep 7 21:24:39 1994
- * Copyright © Acorn Computers Ltd, 1994
- */
-
- /*************************************************************************
- * This source file was written by Acorn Computers Limited. It is part *
- * of the OSLib library for writing applications for RISC OS. It may be *
- * used freely in the creation of programs for RISC OS. *
- *************************************************************************/
-
- #ifndef types_H
- #include "types.h"
- #endif
-
- #ifndef os_H
- #include "os.h"
- #endif
-
- /**********************************
- * SWI names and SWI reason codes *
- **********************************/
- #undef Draw_ProcessPath
- #define Draw_ProcessPath 0x40700
- #undef XDraw_ProcessPath
- #define XDraw_ProcessPath 0x60700
- #undef Draw_Fill
- #define Draw_Fill 0x40702
- #undef XDraw_Fill
- #define XDraw_Fill 0x60702
- #undef Draw_Stroke
- #define Draw_Stroke 0x40704
- #undef XDraw_Stroke
- #define XDraw_Stroke 0x60704
- #undef Draw_StrokePath
- #define Draw_StrokePath 0x40706
- #undef XDraw_StrokePath
- #define XDraw_StrokePath 0x60706
- #undef Draw_FlattenPath
- #define Draw_FlattenPath 0x40708
- #undef XDraw_FlattenPath
- #define XDraw_FlattenPath 0x60708
- #undef Draw_TransformPath
- #define Draw_TransformPath 0x4070A
- #undef XDraw_TransformPath
- #define XDraw_TransformPath 0x6070A
- #undef DrawV
- #define DrawV 0x20
-
- /************************************
- * Structure and union declarations *
- ************************************/
- typedef struct draw_path_element draw_path_element;
- typedef struct draw_line_style draw_line_style;
- typedef struct draw_dash_pattern draw_dash_pattern;
- typedef struct draw_path draw_path;
-
- /********************
- * Type definitions *
- ********************/
- struct draw_path_element
- { int tag;
- union
- { int end_path;
- draw_path_element *continuation;
- os_coord move_to;
- os_coord special_move_to;
- os_coord bezier_to [3];
- os_coord gap_to;
- os_coord line_to;
- }
- data;
- };
-
- typedef bits draw_fill_style;
-
- struct draw_line_style
- { byte join_style;
- byte end_cap_style;
- byte start_cap_style;
- byte reserved;
- int mitre_limit;
- short start_cap_width;
- short start_cap_length;
- short end_cap_width;
- short end_cap_length;
- };
-
- struct draw_dash_pattern
- { int start;
- int element_count;
- int elements [UNKNOWN];
- };
-
- #define draw_DASH_PATTERN(N) \
- struct \
- { int start; \
- int element_count; \
- int elements [N]; \
- }
-
- #define draw_SIZEOF_DASH_PATTERN(N) \
- (offsetof (draw_dash_pattern, elements) + \
- (N)*sizeof ((draw_dash_pattern *) NULL)->elements)
-
- struct draw_path
- { draw_path_element elements [UNKNOWN];
- };
-
- /************************
- * Constant definitions *
- ************************/
- #define draw_OS_UNIT 256
- #define draw_INCH 46080
- #define draw_POINT 640
- #define draw_END_PATH 0
- #define draw_CONTINUATION 1
- #define draw_MOVE_TO 2
- #define draw_SPECIAL_MOVE_TO 3
- #define draw_CLOSE_GAP 4
- #define draw_CLOSE_LINE 5
- #define draw_BEZIER_TO 6
- #define draw_GAP_TO 7
- #define draw_LINE_TO 8
- #define draw_FILL_NONZERO 0
- #define draw_FILL_NEGATIVE 1
- #define draw_FILL_EVEN_ODD 2
- #define draw_FILL_POSITIVE 3
- #define draw_FILL_WINDING_RULE_SHIFT 0
- #define draw_FILL_WINDING_RULE 0x3u
- #define draw_FILL_FULL_EXTERIOR 0x4u
- #define draw_FILL_EXTERIOR_BOUNDARY 0x8u
- #define draw_FILL_INTERIOR_BOUNDARY 0x10u
- #define draw_FILL_FULL_INTERIOR 0x20u
- #define draw_FILL_CLOSE_OPEN_SUBPATHS 0x8000000u
- #define draw_FILL_FLATTEN 0x10000000u
- #define draw_FILL_THICKEN 0x20000000u
- #define draw_FILL_REFLATTEN 0x40000000u
- #define draw_FILL_FLOAT 0x80000000u
- #define draw_JOIN_MITRED 0
- #define draw_JOIN_ROUND 1
- #define draw_JOIN_BEVELLED 2
- #define draw_CAP_BUTT 0
- #define draw_CAP_ROUND 1
- #define draw_CAP_SQUARE 2
- #define draw_CAP_TRIANGULAR 3
- #define draw_SPECIAL_IN_SITU 0
- #define draw_SPECIAL_FILL 1
- #define draw_SPECIAL_FILL_BY_SUBPATHS 2
- #define draw_SPECIAL_COUNT 3
- #define error_DRAW_NO_DRAW_IN_IRQ_MODE 0x980u
- #define error_DRAW_BAD_DRAW_REASON_CODE 0x981u
- #define error_DRAW_RESERVED_DRAW_BITS 0x982u
- #define error_DRAW_INVALID_DRAW_ADDRESS 0x983u
- #define error_DRAW_BAD_PATH_ELEMENT 0x984u
- #define error_DRAW_BAD_PATH_SEQUENCE 0x985u
- #define error_DRAW_MAY_EXPAND_PATH 0x986u
- #define error_DRAW_PATH_FULL 0x987u
- #define error_DRAW_PATH_NOT_FLAT 0x988u
- #define error_DRAW_BAD_CAPS_OR_JOINS 0x989u
- #define error_DRAW_TRANSFORM_OVERFLOW 0x98Au
- #define error_DRAW_DRAW_NEEDS_GRAPHICS_MODE 0x98Bu
- #define error_DRAW_UNIMPLEMENTED_DRAW 0x9FFu
-
- /*************************
- * Function declarations *
- *************************/
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- /*************************************************************
- * NOTE: The following functions provide direct access to *
- * the SWI's noted in the function description. *
- * Please read the relevant PRM section for more *
- * information on their input/output parameters. *
- *************************************************************/
-
- /* ------------------------------------------------------------------------
- * Function: draw_process_path()
- *
- * Description: Main Draw SWI
- *
- * Input: path - value of R0 on entry
- * fill_style - value of R1 on entry
- * trfm - value of R2 on entry
- * flatness - value of R3 on entry
- * thickness - value of R4 on entry
- * line_style - value of R5 on entry
- * dash_pattern - value of R6 on entry
- * processed_path - value of R7 on entry
- *
- * Output: end_or_used - value of R0 on exit (X version only)
- *
- * Returns: R0 (non-X version only)
- *
- * Other notes: Calls SWI 0x40700.
- */
-
- extern os_error *xdraw_process_path (draw_path *path,
- draw_fill_style fill_style,
- os_trfm *trfm,
- int flatness,
- int thickness,
- draw_line_style *line_style,
- draw_dash_pattern *dash_pattern,
- draw_path *processed_path,
- byte **end_or_used);
- extern byte *draw_process_path (draw_path *path,
- draw_fill_style fill_style,
- os_trfm *trfm,
- int flatness,
- int thickness,
- draw_line_style *line_style,
- draw_dash_pattern *dash_pattern,
- draw_path *processed_path);
-
- /* ------------------------------------------------------------------------
- * Function: draw_fill()
- *
- * Description: Processes a path and sends it to the VDU, filling the
- * interior portion
- *
- * Input: path - value of R0 on entry
- * fill_style - value of R1 on entry
- * trfm - value of R2 on entry
- * flatness - value of R3 on entry
- *
- * Other notes: Calls SWI 0x40702.
- */
-
- extern os_error *xdraw_fill (draw_path *path,
- draw_fill_style fill_style,
- os_trfm *trfm,
- int flatness);
- extern void draw_fill (draw_path *path,
- draw_fill_style fill_style,
- os_trfm *trfm,
- int flatness);
-
- /* ------------------------------------------------------------------------
- * Function: draw_stroke()
- *
- * Description: Processes a path and sends it to the VDU
- *
- * Input: path - value of R0 on entry
- * fill_style - value of R1 on entry
- * trfm - value of R2 on entry
- * flatness - value of R3 on entry
- * thickness - value of R4 on entry
- * line_style - value of R5 on entry
- * dash_pattern - value of R6 on entry
- *
- * Other notes: Calls SWI 0x40704.
- */
-
- extern os_error *xdraw_stroke (draw_path *path,
- draw_fill_style fill_style,
- os_trfm *trfm,
- int flatness,
- int thickness,
- draw_line_style *line_style,
- draw_dash_pattern *dash_pattern);
- extern void draw_stroke (draw_path *path,
- draw_fill_style fill_style,
- os_trfm *trfm,
- int flatness,
- int thickness,
- draw_line_style *line_style,
- draw_dash_pattern *dash_pattern);
-
- /* ------------------------------------------------------------------------
- * Function: draw_stroke_path()
- *
- * Description: Processes a path and writes its output to another path
- *
- * Input: path - value of R0 on entry
- * stroked_path - value of R1 on entry
- * trfm - value of R2 on entry
- * flatness - value of R3 on entry
- * thickness - value of R4 on entry
- * line_style - value of R5 on entry
- * dash_pattern - value of R6 on entry
- *
- * Output: end_or_used - value of R0 on exit (X version only)
- *
- * Returns: R0 (non-X version only)
- *
- * Other notes: Calls SWI 0x40706.
- */
-
- extern os_error *xdraw_stroke_path (draw_path *path,
- draw_path *stroked_path,
- os_trfm *trfm,
- int flatness,
- int thickness,
- draw_line_style *line_style,
- draw_dash_pattern *dash_pattern,
- byte **end_or_used);
- extern byte *draw_stroke_path (draw_path *path,
- draw_path *stroked_path,
- os_trfm *trfm,
- int flatness,
- int thickness,
- draw_line_style *line_style,
- draw_dash_pattern *dash_pattern);
-
- /* ------------------------------------------------------------------------
- * Function: draw_flatten_path()
- *
- * Description: Flattens a path and writes its output to another path
- *
- * Input: path - value of R0 on entry
- * flattened_path - value of R1 on entry
- * flatness - value of R2 on entry
- *
- * Output: end_or_used - value of R0 on exit (X version only)
- *
- * Returns: R0 (non-X version only)
- *
- * Other notes: Calls SWI 0x40708.
- */
-
- extern os_error *xdraw_flatten_path (draw_path *path,
- draw_path *flattened_path,
- int flatness,
- byte **end_or_used);
- extern byte *draw_flatten_path (draw_path *path,
- draw_path *flattened_path,
- int flatness);
-
- /* ------------------------------------------------------------------------
- * Function: draw_transform_path()
- *
- * Description: Transforms a path and writes its output to another path
- *
- * Input: path - value of R0 on entry
- * transformed_path - value of R1 on entry
- * trfm - value of R2 on entry
- *
- * Output: end_or_used - value of R0 on exit (X version only)
- *
- * Returns: R0 (non-X version only)
- *
- * Other notes: Calls SWI 0x4070A with R3 = 0x0.
- */
-
- extern os_error *xdraw_transform_path (draw_path *path,
- draw_path *transformed_path,
- os_trfm *trfm,
- byte **end_or_used);
- extern byte *draw_transform_path (draw_path *path,
- draw_path *transformed_path,
- os_trfm *trfm);
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif
-