diff -r 59758314f811 -r d4524d6a4472 Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/drawfile_8h_source.html --- a/Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/drawfile_8h_source.html Fri Jun 11 15:24:34 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,449 +0,0 @@ - - -
- -00001 /* -00002 * drawfile.h -00003 * Copyright (C) 2005 A.J. van Os; Released under GNU GPL -00004 * -00005 * Description: -00006 * Include file to deal with drawfiles -00007 * -00008 * Based on: -00009 * C header file for DrawFile -00010 * written by DefMod (May 4 2004) on Tue May 4 13:34:17 2004 -00011 * Jonathan Coxhead, jonathan@doves.demon.co.uk, 21 Aug 1995 -00012 * OSLib---efficient, type-safe, transparent, extensible, -00013 * register-safe A P I coverage of RISC O S -00014 * Copyright (C) 1994 Jonathan Coxhead -00015 * -00016 * All credit should go to him, but all the bugs are mine -00017 */ -00018 -00019 #if !defined(__drawfile_h) -00020 #define __drawfile_h -00021 -00022 #include "DeskLib:Sprite.h" -00023 #include "DeskLib:Wimp.h" -00024 -00025 #if !defined(BOOL) -00026 #define BOOL int -00027 #define TRUE 1 -00028 #define FALSE 0 -00029 #endif /* !BOOL */ -00030 -00031 /********************* -00032 * Conversion macros * -00033 *********************/ -00034 #define Drawfile_DrawToScreen(i) ((i) / 256) -00035 #define Drawfile_ScreenToDraw(i) ((i) * 256) -00036 -00037 /********************************** -00038 * SWI names and SWI reason codes * -00039 **********************************/ -00040 #define DrawFile_Render 0x45540 -00041 #define DrawFile_BBox 0x45541 -00042 #define DrawFile_DeclareFonts 0x45542 -00043 -00044 /******************** -00045 * Type definitions * -00046 ********************/ -00047 typedef unsigned int bits; -00048 typedef unsigned char byte; -00049 -00050 typedef byte drawfile_fontref; -00051 -00052 typedef byte drawfile_path_style_flags; -00053 -00054 typedef bits drawfile_text_flags; -00055 -00056 typedef bits drawfile_render_flags; -00057 -00058 typedef bits drawfile_declare_fonts_flags; -00059 -00060 typedef bits drawfile_paper_options; -00061 -00062 typedef bits drawfile_entry_mode; -00063 -00064 typedef enum { -00065 drawfile_TYPE_FONT_TABLE = 0, -00066 drawfile_TYPE_TEXT = 1, -00067 drawfile_TYPE_PATH = 2, -00068 drawfile_TYPE_SPRITE = 5, -00069 drawfile_TYPE_GROUP = 6, -00070 drawfile_TYPE_TAGGED = 7, -00071 drawfile_TYPE_TEXT_AREA = 9, -00072 drawfile_TYPE_TEXT_COLUMN = 10, -00073 drawfile_TYPE_OPTIONS = 11, -00074 drawfile_TYPE_TRFM_TEXT = 12, -00075 drawfile_TYPE_TRFM_SPRITE = 13, -00076 drawfile_TYPE_JPEG = 16 -00077 } drawfile_type; -00078 -00079 typedef enum { -00080 drawfile_PATH_END_PATH = 0, -00081 drawfile_PATH_CONTINUATION = 1, -00082 drawfile_PATH_MOVE_TO = 2, -00083 drawfile_PATH_SPECIAL_MOVE_TO = 3, -00084 drawfile_PATH_CLOSE_GAP = 4, -00085 drawfile_PATH_CLOSE_LINE = 5, -00086 drawfile_PATH_BEZIER_TO = 6, -00087 drawfile_PATH_GAP_TO = 7, -00088 drawfile_PATH_LINE_TO = 8 -00089 } drawfile_path_type; -00090 -00091 typedef struct { -00092 int start; -00093 int element_count; -00094 int elements [6]; -00095 } draw_dash_pattern; -00096 -00097 typedef struct { -00098 int entries [3] [2]; -00099 } os_trfm; -00100 -00101 typedef struct { -00102 void *data; -00103 size_t length; -00104 } drawfile_info; -00105 -00106 typedef struct { -00107 drawfile_fontref font_ref; -00108 char font_name [1]; -00109 } drawfile_font_def; -00110 -00111 typedef struct { -00112 drawfile_fontref font_ref; -00113 byte reserved [3]; -00114 } drawfile_text_style; -00115 -00116 typedef struct { -00117 drawfile_path_style_flags flags; -00118 byte reserved; -00119 byte cap_width; -00120 byte cap_length; -00121 } drawfile_path_style; -00122 -00123 typedef struct { -00124 drawfile_font_def font_def[1]; -00125 } drawfile_font_table; -00126 -00127 typedef struct { -00128 wimp_box bbox; -00129 palette_entry fill; -00130 palette_entry bg_hint; -00131 drawfile_text_style style; -00132 int xsize; -00133 int ysize; -00134 wimp_coord base; -00135 char text [1]; -00136 } drawfile_text; -00137 -00138 typedef struct { -00139 wimp_box bbox; -00140 palette_entry fill; -00141 palette_entry outline; -00142 int width; -00143 drawfile_path_style style; -00144 int path [1]; -00145 } drawfile_path; -00146 -00147 typedef struct { -00148 wimp_box bbox; -00149 palette_entry fill; -00150 palette_entry outline; -00151 int width; -00152 drawfile_path_style style; -00153 draw_dash_pattern pattern; -00154 int path [1]; -00155 } drawfile_path_with_pattern; -00156 -00157 typedef struct { -00158 wimp_box bbox; -00159 sprite_header header; -00160 byte data [1]; -00161 } drawfile_sprite; -00162 -00163 typedef struct { -00164 wimp_box bbox; -00165 char name [12]; -00166 int objects [1]; -00167 } drawfile_group; -00168 -00169 typedef struct { -00170 wimp_box bbox; -00171 drawfile_type tag; -00172 int object [1]; -00173 } drawfile_tagged; -00174 -00175 typedef struct { -00176 wimp_box box; -00177 } drawfile_text_column; -00178 -00179 typedef struct { -00180 struct { -00181 drawfile_type type; -00182 int size; -00183 drawfile_text_column data; -00184 } columns [1]; -00185 } drawfile_text_column_list; -00186 -00187 typedef struct { -00188 drawfile_type type; -00189 int reserved [2]; -00190 palette_entry fill; -00191 palette_entry bg_hint; -00192 char text [1]; -00193 } drawfile_area_text; -00194 -00195 typedef struct { -00196 wimp_box bbox; -00197 drawfile_text_column_list header; -00198 drawfile_area_text area_text; -00199 } drawfile_text_area; -00200 -00201 typedef struct { -00202 wimp_box bbox; -00203 int paper_size; -00204 drawfile_paper_options paper_options; -00205 double grid_spacing; -00206 int grid_division; -00207 BOOL isometric; -00208 BOOL auto_adjust; -00209 BOOL show; -00210 BOOL lock; -00211 BOOL cm; -00212 int zoom_mul; -00213 int zoom_div; -00214 BOOL zoom_lock; -00215 BOOL toolbox; -00216 drawfile_entry_mode entry_mode; -00217 int undo_size; -00218 } drawfile_options; -00219 -00220 typedef struct { -00221 wimp_box bbox; -00222 os_trfm trfm; -00223 drawfile_text_flags flags; -00224 palette_entry fill; -00225 palette_entry bg_hint; -00226 drawfile_text_style style; -00227 int xsize; -00228 int ysize; -00229 wimp_coord base; -00230 char text [1]; -00231 } drawfile_trfm_text; -00232 -00233 typedef struct { -00234 wimp_box bbox; -00235 os_trfm trfm; -00236 sprite_header header; -00237 byte data [1]; -00238 } drawfile_trfm_sprite; -00239 -00240 typedef struct { -00241 wimp_box bbox; -00242 int width; -00243 int height; -00244 int xdpi; -00245 int ydpi; -00246 os_trfm trfm; -00247 int len; -00248 byte data [1]; -00249 } drawfile_jpeg; -00250 -00251 /* ------------------------------------------------------------------------ -00252 * Type: drawfile_object -00253 * -00254 * Description: This type is used to declare pointers rather than objects -00255 */ -00256 -00257 typedef struct { -00258 drawfile_type type; -00259 int size; -00260 union { -00261 drawfile_font_table font_table; -00262 drawfile_text text; -00263 drawfile_path path; -00264 drawfile_path_with_pattern path_with_pattern; -00265 drawfile_sprite sprite; -00266 drawfile_group group; -00267 drawfile_tagged tagged; -00268 drawfile_text_column text_column; -00269 drawfile_text_area text_area; -00270 drawfile_options options; -00271 drawfile_trfm_text trfm_text; -00272 drawfile_trfm_sprite trfm_sprite; -00273 drawfile_jpeg jpeg; -00274 } data; -00275 } drawfile_object; -00276 -00277 typedef struct { -00278 char tag [4]; -00279 int major_version; -00280 int minor_version; -00281 char source [12]; -00282 wimp_box bbox; -00283 drawfile_object objects [1]; -00284 } drawfile_diagram; -00285 -00286 typedef bits drawfile_bbox_flags; -00287 -00288 typedef struct { -00289 drawfile_object *object; -00290 drawfile_diagram *diagram; -00291 drawfile_object *font_table; -00292 drawfile_declare_fonts_flags flags; -00293 os_error *error; -00294 } drawfile_declare_fonts_state; -00295 -00296 /************************ -00297 * Constant definitions * -00298 ************************/ -00299 #define error_DRAW_FILE_NOT_DRAW 0x20C00u -00300 #define error_DRAW_FILE_VERSION 0x20C01u -00301 #define error_DRAW_FILE_FONT_TAB 0x20C02u -00302 #define error_DRAW_FILE_BAD_FONT_NO 0x20C03u -00303 #define error_DRAW_FILE_BAD_MODE 0x20C04u -00304 #define error_DRAW_FILE_BAD_FILE 0x20C05u -00305 #define error_DRAW_FILE_BAD_GROUP 0x20C06u -00306 #define error_DRAW_FILE_BAD_TAG 0x20C07u -00307 #define error_DRAW_FILE_SYNTAX 0x20C08u -00308 #define error_DRAW_FILE_FONT_NO 0x20C09u -00309 #define error_DRAW_FILE_AREA_VER 0x20C0Au -00310 #define error_DRAW_FILE_NO_AREA_VER 0x20C0Bu -00311 -00312 #define drawfile_PATH_MITRED ((drawfile_path_style_flags) 0x0u) -00313 #define drawfile_PATH_ROUND ((drawfile_path_style_flags) 0x1u) -00314 #define drawfile_PATH_BEVELLED ((drawfile_path_style_flags) 0x2u) -00315 #define drawfile_PATH_BUTT ((drawfile_path_style_flags) 0x0u) -00316 #define drawfile_PATH_SQUARE ((drawfile_path_style_flags) 0x2u) -00317 #define drawfile_PATH_TRIANGLE ((drawfile_path_style_flags) 0x3u) -00318 #define drawfile_PATH_JOIN_SHIFT 0 -00319 #define drawfile_PATH_JOIN ((drawfile_path_style_flags) 0x3u) -00320 #define drawfile_PATH_END_SHIFT 2 -00321 #define drawfile_PATH_END ((drawfile_path_style_flags) 0xCu) -00322 #define drawfile_PATH_START_SHIFT 4 -00323 #define drawfile_PATH_START ((drawfile_path_style_flags) 0x30u) -00324 #define drawfile_PATH_WINDING_EVEN_ODD ((drawfile_path_style_flags) 0x40u) -00325 #define drawfile_PATH_DASHED ((drawfile_path_style_flags) 0x80u) -00326 #define drawfile_PATH_CAP_WIDTH_SHIFT 16 -00327 #define drawfile_PATH_CAP_WIDTH ((drawfile_path_style_flags) 0xFF0000u) -00328 #define drawfile_PATH_CAP_LENGTH_SHIFT 24 -00329 #define drawfile_PATH_CAP_LENGTH ((drawfile_path_style_flags) 0xFF000000u) -00330 #define drawfile_TEXT_KERN ((drawfile_text_flags) 0x1u) -00331 #define drawfile_TEXT_RIGHT_TO_LEFT ((drawfile_text_flags) 0x2u) -00332 #define drawfile_TEXT_UNDERLINE ((drawfile_text_flags) 0x4u) -00333 #define drawfile_RENDER_BBOXES ((drawfile_render_flags) 0x1u) -00334 #define drawfile_RENDER_SUPPRESS ((drawfile_render_flags) 0x2u) -00335 #define drawfile_RENDER_GIVEN_FLATNESS ((drawfile_render_flags) 0x4u) -00336 #define drawfile_RENDER_GIVEN_COLOUR_MAPPING ((drawfile_render_flags) 0x8u) -00337 #define drawfile_NO_DOWNLOAD ((drawfile_declare_fonts_flags) 0x1u) -00338 #define drawfile_PAPER_SHOW ((drawfile_paper_options) 0x1u) -00339 #define drawfile_PAPER_LANDSCAPE ((drawfile_paper_options) 0x10u) -00340 #define drawfile_PAPER_DEFAULT ((drawfile_paper_options) 0x100u) -00341 #define drawfile_ENTRY_MODE_LINE ((drawfile_entry_mode) 0x1u) -00342 #define drawfile_ENTRY_MODE_CLOSED_LINE ((drawfile_entry_mode) 0x2u) -00343 #define drawfile_ENTRY_MODE_CURVE ((drawfile_entry_mode) 0x4u) -00344 #define drawfile_ENTRY_MODE_CLOSED_CURVE ((drawfile_entry_mode) 0x8u) -00345 #define drawfile_ENTRY_MODE_RECTANGLE ((drawfile_entry_mode) 0x10u) -00346 #define drawfile_ENTRY_MODE_ELLIPSE ((drawfile_entry_mode) 0x20u) -00347 #define drawfile_ENTRY_MODE_TEXT_LINE ((drawfile_entry_mode) 0x40u) -00348 #define drawfile_ENTRY_MODE_SELECT ((drawfile_entry_mode) 0x80u) -00349 -00350 /************************* -00351 * Function declarations * -00352 *************************/ -00353 -00354 #if defined(__cplusplus) -00355 extern "C" { -00356 #endif /* __cplusplus */ -00357 -00358 /* ------------------------------------------------------------------------ -00359 * Function: drawfile_render() -00360 * -00361 * Description: Calls SWI 0x45540 -00362 * -00363 * Input: flags - value of R0 on entry -00364 * diagram - value of R1 on entry -00365 * size - value of R2 on entry -00366 * trfm - value of R3 on entry -00367 * clip - value of R4 on entry -00368 * flatness - value of R5 on entry -00369 */ -00370 -00371 extern os_error *Drawfile_Render (drawfile_render_flags flags, -00372 drawfile_diagram const *diagram, -00373 int size, -00374 os_trfm const *trfm, -00375 wimp_box const *clip, -00376 int flatness); -00377 -00378 /* ------------------------------------------------------------------------ -00379 * Function: drawfile_bbox() -00380 * -00381 * Description: Calls SWI 0x45541 -00382 * -00383 * Input: flags - value of R0 on entry -00384 * diagram - value of R1 on entry -00385 * size - value of R2 on entry -00386 * trfm - value of R3 on entry -00387 * bbox - value of R4 on entry -00388 */ -00389 -00390 extern os_error *Drawfile_Bbox (drawfile_bbox_flags flags, -00391 drawfile_diagram const *diagram, -00392 int size, -00393 os_trfm const *trfm, -00394 wimp_box *bbox); -00395 -00396 /* ------------------------------------------------------------------------ -00397 * Function: Drawfile_DeclareFonts() -00398 * -00399 * Description: Calls SWI 0x45542 -00400 * -00401 * Input: flags - value of R0 on entry -00402 * diagram - value of R1 on entry -00403 * size - value of R2 on entry -00404 */ -00405 -00406 extern os_error *Drawfile_DeclareFonts (drawfile_declare_fonts_flags flags, -00407 drawfile_diagram const *diagram, -00408 int size); -00409 -00410 /* ------------------------------------------------------------------------ -00411 * Function: Drawfile_CreateDiagram() -00412 * -00413 */ -00414 -00415 extern os_error * Drawfile_CreateDiagram(drawfile_info *info, size_t memory, -00416 const char *creator, wimp_box box); -00417 -00418 extern os_error *Drawfile_AppendObject(drawfile_info *info, size_t memory, -00419 const drawfile_object *object, BOOL rebind); -00420 -00421 extern os_error *Drawfile_RenderDiagram(drawfile_info *info, -00422 window_redrawblock *redraw, double scale); -00423 -00424 extern os_error *Drawfile_VerifyDiagram(drawfile_info *info); -00425 -00426 extern void Drawfile_QueryBox(drawfile_info *info, -00427 wimp_box *rect, BOOL screenUnits); -00428 -00429 #if defined(__cplusplus) -00430 } -00431 #endif /* __cplusplus */ -00432 -00433 #endif /* __drawfile.h */ -