Max 5 API Reference
00001 00002 #ifndef _JGRAPHICS_H_ 00003 #define _JGRAPHICS_H_ 00004 00005 BEGIN_USING_C_LINKAGE 00006 00007 #if C74_PRAGMA_STRUCT_PACKPUSH 00008 #pragma pack(push, 2) 00009 #elif C74_PRAGMA_STRUCT_PACK 00010 #pragma pack(2) 00011 #endif 00012 00013 // opaque types for the users of jgraphics 00014 #ifdef __cplusplus 00015 struct t_jgraphics; 00016 struct t_jpath; 00017 struct t_jpattern; 00018 struct t_jfont; 00019 struct t_jtextlayout; 00020 struct t_jtransform; 00021 struct t_jsurface; 00022 struct t_jpopupmenu; 00023 struct t_jsvg; 00024 #else 00025 typedef struct _jgraphics t_jgraphics; ///< An instance of a jgraphics drawing context. @ingroup jgraphics 00026 typedef struct _jpath t_jpath; ///< An instance of a jgraphics path. @ingroup jgraphics 00027 typedef struct _jpattern t_jpattern; ///< An instance of a jgraphics pattern. @ingroup jpattern 00028 typedef struct _jfont t_jfont; ///< An instance of a jgraphics font. @ingroup jfont 00029 typedef struct _jtextlayout t_jtextlayout; ///< An instance of a jgraphics text layout object. @ingroup jgraphics 00030 typedef struct _jtransform t_jtransform; ///< An instance of a jgraphics transform. @ingroup jgraphics 00031 typedef struct _jsurface t_jsurface; ///< An instance of a jgraphics surface. @ingroup jsurface 00032 typedef struct _jsvg t_jsvg; ///< An instance of an SVG object. @ingroup jgraphics 00033 typedef struct _jpopupmenu t_jpopupmenu; ///< An instance of a pop-up menu. @ingroup jgraphics 00034 #endif 00035 00036 00037 // pre-defined colors -- internal use only -- not exported from the kernel 00038 00039 extern t_jrgb s_jrgb_white; // White 00040 extern t_jrgb s_jrgb_black; // Black 00041 extern t_jrgb s_jrgb_red; // Red 00042 extern t_jrgb s_jrgb_green; // Green 00043 extern t_jrgb s_jrgb_blue; // Blue 00044 extern t_jrgb s_jrgb_yellow; // Yellow 00045 extern t_jrgb s_jrgb_cyan; // Cyan 00046 extern t_jrgb s_jrgb_magenta; // Magenta 00047 extern t_jrgb s_jrgb_gray; // Gray 00048 extern t_jrgb s_jrgb_boxgray; // Box Gray 00049 00050 /** Determine the coordinate of the bottom of a rect. 00051 @ingroup jgraphics */ 00052 #define JGRAPHICS_RECT_BOTTOM(rect) (((rect)->y)+((rect)->height)) 00053 00054 /** Determine the coordinate of the right side of a rect. 00055 @ingroup jgraphics */ 00056 #define JGRAPHICS_RECT_RIGHT(rect) (((rect)->x)+((rect)->width)) 00057 00058 00059 // misc utilities 00060 00061 /** Utility macro to return the value of Pi. @ingroup jgraphics */ 00062 #define JGRAPHICS_PI (3.1415926535897932384626433832795028842) 00063 00064 /** Utility macro to return the value of twice Pi. @ingroup jgraphics */ 00065 #define JGRAPHICS_2PI (2. * 3.1415926535897932384626433832795028842) 00066 00067 /** Utility macro to return the value of half of Pi. @ingroup jgraphics */ 00068 #define JGRAPHICS_PIOVER2 (0.5 * 3.1415926535897932384626433832795028842) 00069 00070 /** Utility macro to return the 270ยบ Case. @ingroup jgraphics */ 00071 #define JGRAPHICS_3PIOVER2 ((2.0 * JGRAPHICS_PI) / 3.0) 00072 00073 /** Utility for rounding a double to an int. 00074 @ingroup jgraphics 00075 @param d floating-point input. 00076 @return rounded int output. */ 00077 int jgraphics_round(double d); 00078 00079 00080 00081 // surfaces 00082 00083 /** Enumeration of color formats used by jgraphics surfaces. 00084 @ingroup jgraphics */ 00085 typedef enum _jgraphics_format { 00086 JGRAPHICS_FORMAT_ARGB32, ///< Color is represented using 32 bits, 8 bits each for the components, and including an alpha component. 00087 JGRAPHICS_FORMAT_RGB24, ///< Color is represented using 32 bits, 8 bits each for the components. There is no alpha component. 00088 JGRAPHICS_FORMAT_A8 ///< The color is represented only as an 8-bit alpha mask. 00089 // JGRAPHICS_FORMAT_A1 // not supported 00090 } t_jgraphics_format; 00091 00092 00093 /** Enumeration of file formats usable for jgraphics surfaces. 00094 @ingroup jgraphics */ 00095 typedef enum _jgraphics_fileformat { 00096 JGRAPHICS_FILEFORMAT_PNG, ///< Portable Network Graphics (PNG) format 00097 JGRAPHICS_FILEFORMAT_JPEG ///< JPEG format 00098 } t_jgraphics_fileformat; 00099 00100 00101 /** Create an image surface. 00102 Use jgraphics_surface_destroy() to free it when you are done. 00103 @ingroup jsurface 00104 @param format Defines the color format for the new surface. 00105 @param width Defines the width of the new surface. 00106 @param height Defines the height of the new surface. 00107 @return A pointer to the new surface. */ 00108 t_jsurface* jgraphics_image_surface_create(t_jgraphics_format format, int width, int height); 00109 00110 00111 /** Create an image surface, filling it with the contents of a file, and get a reference to the surface. 00112 Use jgraphics_surface_destroy() to release your reference to the surface when you are done. 00113 @ingroup jsurface 00114 @param filename The name of the file. 00115 @param path The path id of the file. 00116 @return A pointer to the new surface. */ 00117 t_jsurface *jgraphics_image_surface_create_referenced(const char *filename, short path); 00118 00119 00120 /** Create an image surface, filling it with the contents of a file. 00121 Use jgraphics_surface_destroy() to free it when you are done. 00122 @ingroup jsurface 00123 @param filename The name of the file. 00124 @param path The path id of the file. 00125 @return A pointer to the new surface. */ 00126 t_jsurface* jgraphics_image_surface_create_from_file(const char *filename, short path); 00127 00128 00129 /** Create an image surface from given pixel data. 00130 Data should point to start of top line of bitmap, stride tells how to get to next line. 00131 For upside down windows bitmaps, data = (pBits-(height-1)*stride) and stride is a negative number. 00132 @ingroup jsurface 00133 @param data The data. For example, an RGBA image loaded in memory. 00134 @param format The format of the data. 00135 @param width The width of the new surface. 00136 @param height The height of the new surface. 00137 @param stride The number of bytes between the start of rows in the dat buffer. 00138 @param freefun If not NULL, freefun will be called when the surface is destroyed 00139 @param freearg This will be passed to freefun if/when freefun is called. 00140 @return A pointer to the new surface. */ 00141 t_jsurface* jgraphics_image_surface_create_for_data(unsigned char *data, t_jgraphics_format format, 00142 int width, int height, int stride, 00143 method freefun, void *freearg); 00144 00145 // Internal Use Only 00146 t_jsurface* jgraphics_image_surface_create_for_data_premult(unsigned char *data, t_jgraphics_format format, 00147 int width, int height, int stride, 00148 method freefun, void *freearg); 00149 00150 /** Create a new surface from file data. 00151 @ingroup jsurface 00152 @param data A pointer to the raw PNG or JPG bits. 00153 @param datalen The number of bytes in data. 00154 @return The new surface. 00155 @see jgraphics_write_image_surface_to_filedata() */ 00156 t_jsurface* jgraphics_image_surface_create_from_filedata(const void *data, unsigned long datalen); 00157 00158 00159 /** Create a new surface from a resource in your external. 00160 @ingroup jsurface 00161 @param moduleRef A pointer to your external's module, 00162 which is passed to your external's main() function when the class is loaded. 00163 @param resname The name of the resource in the external. 00164 @remark The following example shows an example of how this might be used in an external. 00165 @code 00166 static s_my_surface = NULL; 00167 00168 int main(void *moduleRef) 00169 { 00170 // (Do typical class initialization here) 00171 00172 // now create the surface from a resource that we added to the Xcode/VisualStudio project 00173 s_my_surface = jgraphics_image_surface_create_from_resource(moduleRef, "myCoolImage"); 00174 00175 return 0; 00176 } 00177 @endcode */ 00178 t_jsurface* jgraphics_image_surface_create_from_resource(const void* moduleRef, const char *resname); 00179 00180 /** Low-level routine to access an object's resource data. 00181 @ingroup jsurface 00182 @param moduleRef A pointer to your external's module, which is passed to your external's main() function when the class is loaded. 00183 @param resname Base name of the resource data (without an extension) 00184 @param extcount Count of possible extensions (ignored on Windows) 00185 @param exts Array of symbol atoms containing possible filename extensions (ignored on Windows) 00186 @param data Returned resource data assigned to a pointer you supply 00187 @param datasize Size of the data returned 00188 @remark You are responsible for freeing any data returned in the data pointer 00189 @return A Max error code. */ 00190 t_max_err jgraphics_get_resource_data(const void *moduleRef, const char *resname, long extcount, t_atom *exts, void **data, unsigned long *datasize); 00191 00192 /** Create a reference to an existing surface. 00193 Use jgraphics_surface_destroy() to release your reference to the surface when you are done. 00194 @ingroup jsurface 00195 @param s The surface to reference. 00196 @return The new reference to the surface. */ 00197 t_jsurface* jgraphics_surface_reference(t_jsurface *s); 00198 00199 00200 /** Release or free a surface. 00201 @ingroup jsurface 00202 @param s The surface to release. */ 00203 void jgraphics_surface_destroy(t_jsurface *s); 00204 00205 00206 /** Export a PNG file of the contents of a surface. 00207 @ingroup jsurface 00208 @param surface The surface to export. 00209 @param filename Specify the name of the file to create. 00210 @param path Specify the path id for where to create the file. 00211 @param dpi Define the resolution of the image (e.g. 72). 00212 @return A Max error code. */ 00213 t_max_err jgraphics_image_surface_writepng(t_jsurface *surface, const char *filename, short path, long dpi); 00214 00215 00216 // Not used by any C74 code... 00217 void jgraphics_surface_set_device_offset(t_jsurface *s, double x_offset, double y_offset); 00218 void jgraphics_surface_get_device_offset(t_jsurface *s, double *x_offset, double *y_offset); 00219 00220 00221 /** Retrieve the width of a surface. 00222 @ingroup jsurface 00223 @param s The surface to query. 00224 @return The width of the surface. */ 00225 int jgraphics_image_surface_get_width(t_jsurface *s); 00226 00227 /** Retrieve the height of a surface. 00228 @ingroup jsurface 00229 @param s The surface to query. 00230 @return The height of the surface. */ 00231 int jgraphics_image_surface_get_height(t_jsurface *s); 00232 00233 /** Set the color of an individual pixel in a surface. 00234 @ingroup jsurface 00235 @param s The surface. 00236 @param x The horizontal coordinate of the pixel. 00237 @param y The vertical coordinate of the pixel. 00238 @param color The color of the pixel. */ 00239 void jgraphics_image_surface_set_pixel(t_jsurface *s, int x, int y, t_jrgba color); 00240 00241 /** Retrieve the color of an individual pixel in a surface. 00242 @ingroup jsurface 00243 @param s The surface. 00244 @param x The horizontal coordinate of the pixel. 00245 @param y The vertical coordinate of the pixel. 00246 @param color The address of a valid #t_jrgba struct 00247 whose values will be filled in with the color of the pixel upon return. */ 00248 void jgraphics_image_surface_get_pixel(t_jsurface *s, int x, int y, t_jrgba *color); 00249 00250 /** 00251 @ingroup jsurface 00252 @param s The surface to scroll. 00253 @param x The origin of the rect to scroll. 00254 @param y The origin of the rect to scroll. 00255 @param width The width of the rect to scroll. 00256 @param height The height of the rect to scroll. 00257 @param dx The amount to scroll the surface horizontally. 00258 @param dy The amount to scroll the surface vertically. 00259 @param path Can pass NULL if you are not interested in this info. 00260 Otherwise pass a pointer and it will be returned with a path containing the invalid region. 00261 */ 00262 void jgraphics_image_surface_scroll(t_jsurface *s, 00263 int x, int y, int width, int height, 00264 int dx, int dy, 00265 t_jpath **path); // 00266 00267 00268 /** Get a read-only raw bitmap of a surface. 00269 This gives you a pointer to the raw bitmap data so you can read from it yourself and examine the stuff that was drawn. 00270 The jgraphics_image_surface_lockpixels() version gives you a pointer to the bits that you can directly munge. 00271 After either call you should make the appropriate unlock call. 00272 @ingroup jsurface 00273 @param s The surface. 00274 @param x The rect horizontal-origin for the raw bitmap. 00275 @param y The rect vertical-origin for the raw bitmap. 00276 @param width The rect width for the bitmap. 00277 @param height The rect height for the bitmap. 00278 @param linestride The line stride for the bitmap. 00279 @param pixelstride The pixel stride for the bitmap. 00280 @return A pointer to the raw bitmap. */ 00281 const unsigned char* jgraphics_image_surface_lockpixels_readonly(t_jsurface *s, 00282 int x, int y, int width, int height, 00283 int *linestride, int *pixelstride); 00284 /** Unlock a surface locked by jgraphics_image_surface_lockpixels_readonly(). 00285 @ingroup jsurface 00286 @param s The surface. 00287 @param data The pointer returned by jgraphics_image_surface_lockpixels_readonly(). */ 00288 void jgraphics_image_surface_unlockpixels_readonly(t_jsurface *s, const unsigned char *data); 00289 00290 00291 /** Get a writable bitmap of a surface. 00292 After you are done reading/writing to the bitmap, you should call jgraphics_image_surface_unlockpixels(). 00293 @ingroup jsurface 00294 @param s The surface. 00295 @param x The rect horizontal-origin for the raw bitmap. 00296 @param y The rect vertical-origin for the raw bitmap. 00297 @param width The rect width for the bitmap. 00298 @param height The rect height for the bitmap. 00299 @param linestride The line stride for the bitmap. 00300 @param pixelstride The pixel stride for the bitmap. 00301 @return A pointer to the raw bitmap. */ 00302 unsigned char* jgraphics_image_surface_lockpixels(t_jsurface *s, 00303 int x, int y, int width, int height, 00304 int *linestride, int *pixelstride); 00305 00306 /** Unlock a surface locked by jgraphics_image_surface_lockpixels(). 00307 @ingroup jsurface 00308 @param s The surface. 00309 @param data The pointer returned by jgraphics_image_surface_lockpixels(). */ 00310 void jgraphics_image_surface_unlockpixels(t_jsurface *s, unsigned char *data); 00311 00312 00313 /** Draw an image surface. 00314 This not in cairo, but, it seems silly to have to make a brush to just draw an image. 00315 This doesn't support rotations, however. 00316 @ingroup jsurface 00317 @param g The graphics context in which to draw the surface. 00318 @param s The surface to draw. 00319 @param srcRect The rect within the surface that should be drawn. 00320 @param destRect The rect in the context to which to draw the srcRect. 00321 @see jgraphics_image_surface_draw_fast() */ 00322 void jgraphics_image_surface_draw(t_jgraphics *g, t_jsurface *s, t_rect srcRect, t_rect destRect); 00323 00324 00325 /** Draw an image surface quickly. 00326 The draw_fast version won't scale based on zoom factor or user transforms so make sure that this is what you want! 00327 Draws entire image, origin *can* be shifted via zoom and user transforms 00328 (even though image is not scaled based on those same transforms) 00329 @ingroup jsurface 00330 @param g The graphics context in which to draw the surface. 00331 @param s The surface to draw. 00332 @see jgraphics_image_surface_draw */ 00333 void jgraphics_image_surface_draw_fast(t_jgraphics *g, t_jsurface *s); 00334 00335 00336 /** Get surface data ready for manually writing to a file. 00337 @ingroup jsurface 00338 @param surf The surface whose data will be retrieved. 00339 @param fmt The format for the data. This should be a selection from #t_jgraphics_fileformat. 00340 @param data The address of a pointer that will be allocated and filled. 00341 When you are done with this data you should free it using sysmem_freeptr(). 00342 @param size The address of a variable to hold the size of the data upon return. 00343 00344 @remark A good example of this is to embed the surface as a PNG in a patcher file. 00345 @code 00346 long size = 0; 00347 void *data = NULL; 00348 00349 jgraphics_write_image_surface_to_filedata(x->j_surface, JGRAPHICS_FILEFORMAT_PNG, &data, &size); 00350 if (size) { 00351 x->j_format = gensym("png"); 00352 binarydata_appendtodictionary(data, size, gensym("data"), x->j_format, d); 00353 x->j_imagedata = data; 00354 x->j_imagedatasize = size; 00355 } 00356 @endcode 00357 @see jgraphics_image_surface_create_from_filedata() */ 00358 void jgraphics_write_image_surface_to_filedata(t_jsurface *surf, long fmt, void **data, long *size); 00359 00360 00361 /** Set all pixels in rect to 0. 00362 @ingroup jsurface 00363 @param s The surface to clear. 00364 @param x The horizontal origin of the rect to clear. 00365 @param y The vertical origin of the rect to clear. 00366 @param width The width of the rect to clear. 00367 @param height The height of the rect to clear. */ 00368 void jgraphics_image_surface_clear(t_jsurface *s, int x, int y, int width, int height); 00369 00370 00371 00372 // SVG Stuff 00373 00374 /** Read an SVG file, return a #t_jsvg object. 00375 @ingroup jsvg 00376 @param filename The name of the file to read. 00377 @param path The path id of the file to read. 00378 @return A new SVG object. */ 00379 t_jsvg* jsvg_create_from_file(const char *filename, short path); 00380 00381 00382 /** Read an SVG file from a resource. 00383 @ingroup jsvg 00384 @param moduleRef The external's moduleRef. 00385 @param resname The name of the SVG resource. 00386 @return A new SVG object. 00387 @see jgraphics_image_surface_create_from_resource() */ 00388 t_jsvg* jsvg_create_from_resource(const void *moduleRef, const char *resname); 00389 00390 00391 /** Create an SVG object from a string containing the SVG's XML. 00392 @ingroup jsvg 00393 @param svgXML The SVG source. 00394 @return A new SVG object. */ 00395 t_jsvg* jsvg_create_from_xmlstring(const char *svgXML); 00396 00397 00398 /** Retrieve the size of an SVG object. 00399 @ingroup jsvg 00400 @param svg An SVG object. 00401 @param width The address of a variable that will be set to the width upon return. 00402 @param height The address of a variable that will be set to the width upon return. */ 00403 void jsvg_get_size(t_jsvg *svg, double *width, double *height); 00404 00405 00406 /** Free a #t_jsvg object. 00407 @ingroup jsvg 00408 @param svg The object to free. */ 00409 void jsvg_destroy(t_jsvg *svg); 00410 00411 00412 /** Render an SVG into a graphics context. 00413 @ingroup jsvg 00414 @param svg The SVG object to render. 00415 @param g The graphics context in which to render. */ 00416 void jsvg_render(t_jsvg *svg, t_jgraphics *g); 00417 00418 00419 /** Create a context to draw on a particular surface. 00420 When you are done, call jgraphics_destroy(). 00421 @ingroup jsurface 00422 @param target The surface to which to draw. 00423 @return The new graphics context. */ 00424 t_jgraphics* jgraphics_create(t_jsurface *target); 00425 00426 00427 /** Get a reference to a graphics context. 00428 When you are done you should release your reference with jgraphics_destroy(). 00429 @ingroup jgraphics 00430 @param g The context you wish to reference. 00431 @return A new reference to the context. */ 00432 t_jgraphics* jgraphics_reference(t_jgraphics *g); 00433 00434 00435 /** Release or free a graphics context. 00436 @ingroup jgraphics 00437 @param g The context to release. */ 00438 void jgraphics_destroy(t_jgraphics *g); 00439 00440 00441 00442 // Paths 00443 00444 /** Begin a new path. 00445 This action clears any current path in the context. 00446 @ingroup jgraphics 00447 @param g The graphics context. */ 00448 void jgraphics_new_path(t_jgraphics *g); 00449 00450 00451 /** Get a copy of the current path from a context. 00452 @ingroup jgraphics 00453 @param g A copy of the current path. */ 00454 t_jpath* jgraphics_copy_path(t_jgraphics *g); 00455 00456 00457 /** Release/free a path. 00458 @ingroup jgraphics 00459 @param path The path to release. */ 00460 void jgraphics_path_destroy(t_jpath *path); 00461 00462 00463 /** Add a path to a graphics context. 00464 @ingroup jgraphics 00465 @param g The graphics context. 00466 @param path The path to add. */ 00467 void jgraphics_append_path(t_jgraphics *g, t_jpath *path); 00468 00469 00470 /** Close the current path in a context. 00471 This will add a line segment to close current subpath. 00472 @ingroup jgraphics 00473 @param g The graphics context. */ 00474 void jgraphics_close_path(t_jgraphics *g); 00475 00476 00477 /** Round out any corners in a path. 00478 This action clears any current path in the context. 00479 @ingroup jgraphics 00480 @param g The graphics context. 00481 @param cornerRadius The amount by which to round corners. */ 00482 void jgraphics_path_roundcorners(t_jgraphics *g, double cornerRadius); 00483 00484 00485 /** Get the current location of the cursor in a graphics context. 00486 @ingroup jgraphics 00487 @param g The graphics context. 00488 @param x The address of a variable that will be set to the horizontal cursor location upon return. 00489 @param y The address of a variable that will be set to the vertical cursor location upon return. */ 00490 void jgraphics_get_current_point(t_jgraphics *g, double *x, double *y); 00491 00492 00493 /** Add a circular, clockwise, arc to the current path. 00494 @ingroup jgraphics 00495 @param g The graphics context. 00496 @param xc The horizontal coordinate of the arc's center. 00497 @param yc The vertical coordinate of the arc's center. 00498 @param radius The radius of the arc. 00499 @param angle1 The starting angle of the arc in radians. 00500 Zero radians is center right (positive x axis). 00501 @param angle2 The terminal angle of the arc in radians. 00502 Zero radians is center right (positive x axis). */ 00503 void jgraphics_arc(t_jgraphics *g, 00504 double xc, double yc, 00505 double radius, 00506 double angle1, double angle2); 00507 00508 00509 /** Add a non-circular arc to the current path. 00510 @ingroup jgraphics 00511 @param g The graphics context. 00512 @param xc The horizontal coordinate of the arc's center. 00513 @param yc The vertical coordinate of the arc's center. 00514 @param radiusx The horizontal radius of the arc. 00515 @param radiusy The vertical radius of the arc. 00516 @param angle1 The starting angle of the arc in radians. 00517 Zero radians is center right (positive x axis). 00518 @param angle2 The terminal angle of the arc in radians. 00519 Zero radians is center right (positive x axis). */ 00520 void jgraphics_ovalarc(t_jgraphics *g, 00521 double xc, double yc, 00522 double radiusx, double radiusy, 00523 double angle1, double angle2); 00524 00525 00526 /** Add a circular, counter-clockwise, arc to the current path. 00527 @ingroup jgraphics 00528 @param g The graphics context. 00529 @param xc The horizontal coordinate of the arc's center. 00530 @param yc The vertical coordinate of the arc's center. 00531 @param radius The radius of the arc. 00532 @param angle1 The starting angle of the arc in radians. 00533 Zero radians is center right (positive x axis). 00534 @param angle2 The terminal angle of the arc in radians. 00535 Zero radians is center right (positive x axis). */ 00536 void jgraphics_arc_negative(t_jgraphics *g, 00537 double xc, double yc, 00538 double radius, 00539 double angle1, double angle2); 00540 00541 00542 /** Add a cubic Bezier spline to the current path. 00543 @ingroup jgraphics 00544 @param g The graphics context. 00545 @param x1 The first control point. 00546 @param y1 The first control point. 00547 @param x2 The second control point. 00548 @param y2 The second control point. 00549 @param x3 The destination point. 00550 @param y3 The destination point. */ 00551 void jgraphics_curve_to(t_jgraphics *g, 00552 double x1, double y1, 00553 double x2, double y2, 00554 double x3, double y3); 00555 00556 00557 /** Add a cubic Bezier spline to the current path, using coordinates relative to the current point. 00558 @ingroup jgraphics 00559 @param g The graphics context. 00560 @param x1 The first control point. 00561 @param y1 The first control point. 00562 @param x2 The second control point. 00563 @param y2 The second control point. 00564 @param x3 The destination point. 00565 @param y3 The destination point. */ 00566 void jgraphics_rel_curve_to(t_jgraphics *g, 00567 double x1, double y1, 00568 double x2, double y2, 00569 double x3, double y3); 00570 00571 00572 /** Add a line segment to the current path. 00573 @ingroup jgraphics 00574 @param g The graphics context. 00575 @param x The destination point. 00576 @param y The destination point. */ 00577 void jgraphics_line_to(t_jgraphics *g, double x, double y); 00578 00579 00580 /** Add a line segment to the current path, using coordinates relative to the current point. 00581 @ingroup jgraphics 00582 @param g The graphics context. 00583 @param x The destination point. 00584 @param y The destination point. */ 00585 void jgraphics_rel_line_to(t_jgraphics *g, double x, double y); 00586 00587 00588 /** Move the cursor to a new point and begin a new subpath. 00589 @ingroup jgraphics 00590 @param g The graphics context. 00591 @param x The new location. 00592 @param y The new location. */ 00593 void jgraphics_move_to(t_jgraphics *g, double x, double y); 00594 00595 00596 /** Move the cursor to a new point and begin a new subpath, using coordinates relative to the current point. 00597 @ingroup jgraphics 00598 @param g The graphics context. 00599 @param x The new location. 00600 @param y The new location. */ 00601 void jgraphics_rel_move_to(t_jgraphics *g, double x, double y); 00602 00603 00604 /** Add a closed rectangle path in the context. 00605 @ingroup jgraphics 00606 @param g The graphics context. 00607 @param x The horizontal origin. 00608 @param y The vertical origin. 00609 @param width The width of the rect. 00610 @param height The height of the rect. */ 00611 void jgraphics_rectangle(t_jgraphics *g, 00612 double x, double y, 00613 double width, double height); 00614 00615 00616 /** Deprecated -- do not use. Adds a closed oval path in the context, however, it does not scale appropriately. 00617 @ingroup jgraphics 00618 @param g The graphics context. 00619 @param x The horizontal origin. 00620 @param y The vertical origin. 00621 @param width The width of the oval. 00622 @param height The height of the oval. */ 00623 void jgraphics_oval(t_jgraphics *g, 00624 double x, double y, 00625 double width, double height); 00626 00627 00628 /** Add a closed rounded-rectangle path in the context. 00629 @ingroup jgraphics 00630 @param g The graphics context. 00631 @param x The horizontal origin. 00632 @param y The vertical origin. 00633 @param width The width of the rect. 00634 @param height The height of the rect. 00635 @param ovalwidth The width of the oval used for the round corners. 00636 @param ovalheight The height of the oval used for the round corners. */ 00637 void jgraphics_rectangle_rounded(t_jgraphics *g, 00638 double x, double y, 00639 double width, double height, 00640 double ovalwidth, double ovalheight); 00641 00642 00643 /** Add a closed elliptical path in the context. 00644 @ingroup jgraphics 00645 @param g The graphics context. 00646 @param x The horizontal origin. 00647 @param y The vertical origin. 00648 @param width The width of the rect. 00649 @param height The height of the rect. */ 00650 void jgraphics_ellipse(t_jgraphics *g, 00651 double x, double y, 00652 double width, double height); 00653 00654 00655 // Internal use only 00656 void jgraphics_diagonal_line_fill(t_jgraphics *g, double pixels, double x, double y, double width, double height); 00657 00658 00659 // need to add glyph stuff and stuff for adding glyphs to a path. 00660 00661 /** Enumeration of slanting options for font display. 00662 @ingroup jfont */ 00663 typedef enum _jgraphics_font_slant { 00664 JGRAPHICS_FONT_SLANT_NORMAL, ///< Normal slanting (typically this means no slanting) 00665 JGRAPHICS_FONT_SLANT_ITALIC ///< Italic slanting 00666 // JGRAPHICS_FONT_SLANT_OBLIQUE 00667 } t_jgraphics_font_slant; 00668 00669 00670 /** Enumeration of font weight options for font display. 00671 @ingroup jfont */ 00672 typedef enum _jgraphics_font_weight { 00673 JGRAPHICS_FONT_WEIGHT_NORMAL, ///< Normal font weight 00674 JGRAPHICS_FONT_WEIGHT_BOLD ///< Bold font weight 00675 } t_jgraphics_font_weight; 00676 00677 00678 /** Specify a font for a graphics context. 00679 @ingroup jgraphics 00680 @param g The graphics context. 00681 @param family The name of the font family (e.g. "Arial"). 00682 @param slant Define the slant to use for the font. 00683 @param weight Define the weight to use for the font. */ 00684 void jgraphics_select_font_face(t_jgraphics *g, 00685 const char *family, 00686 t_jgraphics_font_slant slant, 00687 t_jgraphics_font_weight weight); 00688 00689 00690 /** Specify a font for a graphics context by passing a #t_jfont object. 00691 @ingroup jgraphics 00692 @param g The graphics context. 00693 @param jfont A jfont object whose attributes will be copied to the context. */ 00694 void jgraphics_select_jfont(t_jgraphics *g, t_jfont *jfont); 00695 00696 00697 /** Specify the font size for a context. 00698 @ingroup jgraphics 00699 @param g The graphics context. 00700 @param size The font size. */ 00701 void jgraphics_set_font_size(t_jgraphics *g, double size); 00702 00703 00704 /** Turn underlining on/off for text in a context. 00705 @ingroup jgraphics 00706 @param g The graphics context. 00707 @param underline Pass true or false to set the appropriate behavior. */ 00708 void jgraphics_set_underline(t_jgraphics *g, char underline); 00709 00710 00711 /** Display text at the current position in a context. 00712 @ingroup jgraphics 00713 @param g The graphics context. 00714 @param utf8 The text to display. */ 00715 void jgraphics_show_text(t_jgraphics *g, const char *utf8); 00716 00717 00718 /** A structure for holding information related to how much space the rendering of a given font will use. 00719 The units for these measurements is in pixels. 00720 @ingroup jgraphics 00721 */ 00722 typedef struct _jgraphics_font_extents { 00723 double ascent; ///< The ascent. 00724 double descent; ///< The descent. 00725 double height; ///< The hieght. 00726 double max_x_advance; ///< Unused / Not valid. 00727 double max_y_advance; ///< Unused / Not valid. 00728 } t_jgraphics_font_extents; 00729 00730 00731 /** Return the extents of the currently selected font for a given graphics context. 00732 @ingroup jgraphics 00733 @param g Pointer to a jgraphics context. 00734 @param extents The address of a #t_jgraphics_font_extents structure to be filled with the results. 00735 */ 00736 void jgraphics_font_extents(t_jgraphics *g, t_jgraphics_font_extents *extents); 00737 00738 00739 /** Return the height and width of a string given current graphics settings in a context. 00740 @ingroup jgraphics 00741 @param g Pointer to a jgraphics context. 00742 @param utf8 A string containing the text whose dimensions we wish to find. 00743 @param width The address of a variable to be filled with the width of the rendered text. 00744 @param height The address of a variable to be filled with the height of the rendered text. 00745 */ 00746 void jgraphics_text_measure(t_jgraphics *g, const char *utf8, double *width, double *height); 00747 00748 00749 /** Return the height, width, and number of lines that will be used to render a given string. 00750 @ingroup jgraphics 00751 @param g Pointer to a jgraphics context. 00752 @param utf8 A string containing the text whose dimensions we wish to find. 00753 @param wrapwidth The number of pixels in width at which the text should be wrapped if it is too long. 00754 @param includewhitespace Set zero to not include white space in the calculation, otherwise set this parameter to 1. 00755 @param width The address of a variable to be filled with the width of the rendered text. 00756 @param height The address of a variable to be filled with the height of the rendered text. 00757 @param numlines The address of a variable to be filled with the number of lines required to render the text. 00758 */ 00759 void jgraphics_text_measure_wrapped(t_jgraphics *g, const char *utf8, double wrapwidth, long includewhitespace, 00760 double *width, double *height, long *numlines); 00761 00762 00763 // Internal Use Only 00764 double jgraphics_getfontscale(void); 00765 00766 00767 00768 // Working with fonts directly 00769 00770 // Internal Use Only 00771 t_jfont* jfont_create_from_maxfont(short number, short size); 00772 00773 00774 /** Create a new font object. 00775 @ingroup jfont 00776 @param family The name of the font family (e.g. Arial). 00777 @param slant The type of slant for the font. 00778 @param weight The type of weight for the font. 00779 @param size The size of the font. 00780 @return The new font object. */ 00781 t_jfont* jfont_create(const char *family, 00782 t_jgraphics_font_slant slant, 00783 t_jgraphics_font_weight weight, 00784 double size); 00785 00786 00787 /** Create new reference to an existing font object. 00788 @ingroup jfont 00789 @param font The font object for which to obtain a reference. 00790 @return The new font object reference. */ 00791 t_jfont* jfont_reference(t_jfont *font); 00792 00793 00794 /** Release or free a font object. 00795 @ingroup jfont 00796 @param font The font object to release. */ 00797 void jfont_destroy(t_jfont *font); 00798 00799 00800 /** Set the size of a font object. 00801 @ingroup jfont 00802 @param font The font object. 00803 @param size The new size for the font object. */ 00804 void jfont_set_font_size(t_jfont *font, double size); 00805 00806 00807 /** Set the underlining of a font object. 00808 @ingroup jfont 00809 @param font The font object. 00810 @param ul Pass true to underline, or false for no underlining. */ 00811 void jfont_set_underline(t_jfont *font, char ul); 00812 00813 00814 double jfont_get_heighttocharheightratio(t_jfont *font); 00815 00816 00817 /** Get extents of this font 00818 @ingroup jfont 00819 @param font The font object. 00820 @param extents The font extents upon return/ */ 00821 void jfont_extents(t_jfont *font, t_jgraphics_font_extents *extents); 00822 00823 00824 /** Given a font, find out how much area is required to render a string of text. 00825 @ingroup jfont 00826 @param font The font object. 00827 @param utf8 The text whose rendering will be measured. 00828 @param width The address of a variable to hold the width upon return. 00829 @param height The address of a variable to hold the height upon return. */ 00830 void jfont_text_measure(t_jfont *font, const char *utf8, double *width, double *height); 00831 00832 00833 /** Given a font, find out how much area is required to render a string of text, 00834 provided a horizontal maximum limit at which the text is wrapped. 00835 @ingroup jfont 00836 @param font The font object. 00837 @param utf8 The text whose rendering will be measured. 00838 @param wrapwidth The maximum width, above which text should wrap onto a new line. 00839 @param includewhitespace If non-zero, include whitespace in the measurement. 00840 @param width The address of a variable to hold the width upon return. 00841 @param height The address of a variable to hold the height upon return. 00842 @param numlines The address of a variable to hold the number of lines of text after wrapping upon return. */ 00843 void jfont_text_measure_wrapped(t_jfont *font, const char *utf8, double wrapwidth, long includewhitespace, 00844 double *width, double *height, long *numlines); 00845 00846 /** Get a list of font names. 00847 @ingroup jfont 00848 @param count The addres of a variable to hold the count of font names in list upon return. 00849 @param list The address of a #t_symbol** initialized to NULL. 00850 Upon return this will be set to an array of count #t_symbol pointers. 00851 This array should be freed using sysmem_freeptr() when you are done with it. 00852 @return A Max error code. */ 00853 t_max_err jfont_getfontlist(long *count, t_symbol ***list); 00854 00855 00856 // Internal Use Only -- not exported 00857 void jfont_set_juce_default_fontname(char *s); 00858 void jfont_copy_juce_default_fontname(char *s, long maxlen); 00859 void jfont_copy_juce_platform_fontname(char *s, long maxlen); 00860 void jfont_set_juce_fallback_fontname(char *s); 00861 void jfont_copy_juce_fallback_fontname(char *s, long maxlen); 00862 00863 00864 /** Determine if you can anti-alias text to a transparent background. 00865 You might want to call this and then disable "useimagebuffer" if false *and* 00866 you are rendering text on a transparent background. 00867 @ingroup jgraphics 00868 @return Non-zero if you can anti-alias text to a transparent background. */ 00869 long jgraphics_system_canantialiastexttotransparentbg(); 00870 00871 00872 long jgraphics_fontname_hasglyph(char *name, long code); 00873 00874 00875 /** Create a new textlayout object. 00876 @ingroup textlayout 00877 @return The new textlayout object. */ 00878 t_jtextlayout* jtextlayout_create(); 00879 00880 00881 /** Create a new textlayout object. 00882 This gives a hint to the textlayout as to what the text bgcolor will be. 00883 It won't actually paint the bg for you. 00884 But, it does let it do a better job. 00885 @ingroup textlayout 00886 @param g The graphics context for the textlayout. 00887 @param bgcolor The background color for the textlayout. 00888 @return The new textlayout object. */ 00889 t_jtextlayout* jtextlayout_withbgcolor(t_jgraphics *g, t_jrgba *bgcolor); 00890 00891 00892 /** Release/free a textlayout object. 00893 @ingroup textlayout 00894 @param textlayout The textlayout object to release. */ 00895 void jtextlayout_destroy(t_jtextlayout* textlayout); 00896 00897 00898 /** Enumeration of text justification options, which are specified as a bitmask. 00899 @ingroup jgraphics */ 00900 typedef enum _jgraphics_text_justification { 00901 JGRAPHICS_TEXT_JUSTIFICATION_LEFT = 1, ///< Justify left 00902 JGRAPHICS_TEXT_JUSTIFICATION_RIGHT = 2, ///< Justify right 00903 JGRAPHICS_TEXT_JUSTIFICATION_HCENTERED = 4, ///< Centered horizontally 00904 JGRAPHICS_TEXT_JUSTIFICATION_TOP = 8, ///< Justified to the top 00905 JGRAPHICS_TEXT_JUSTIFICATION_BOTTOM = 16, ///< Justified to the bottom 00906 JGRAPHICS_TEXT_JUSTIFICATION_VCENTERED = 32, ///< Centered vertically 00907 JGRAPHICS_TEXT_JUSTIFICATION_HJUSTIFIED = 64, ///< Horizontally justified 00908 JGRAPHICS_TEXT_JUSTIFICATION_CENTERED = JGRAPHICS_TEXT_JUSTIFICATION_HCENTERED + JGRAPHICS_TEXT_JUSTIFICATION_VCENTERED ///< Shortcut for Centering both vertically and horizontally 00909 } t_jgraphics_text_justification; 00910 00911 00912 /** Flags for setting text layout options. 00913 @ingroup textlayout */ 00914 typedef enum _jgraphics_textlayout_flags { 00915 JGRAPHICS_TEXTLAYOUT_NOWRAP = 1, ///< disable word wrapping 00916 JGRAPHICS_TEXTLAYOUT_USEELLIPSIS = 3 ///< show ... if a line doesn't fit (implies NOWRAP too) 00917 } t_jgraphics_textlayout_flags; 00918 00919 00920 /** Set the text and attributes of a textlayout object. 00921 @ingroup textlayout 00922 @param textlayout The textlayout object. 00923 @param utf8 The text to render. 00924 @param jfont The font with which to render the text. 00925 @param x The text is placed within rect specified by x, y, width, height. 00926 @param y The text is placed within rect specified by x, y, width, height. 00927 @param width The text is placed within rect specified by x, y, width, height. 00928 @param height The text is placed within rect specified by x, y, width, height. 00929 @param justification How to justify the text within the rect. 00930 @param flags Additional flags to control behaviour. */ 00931 void jtextlayout_set(t_jtextlayout *textlayout, 00932 const char *utf8, 00933 t_jfont *jfont, 00934 double x, double y, 00935 double width, 00936 double height, 00937 t_jgraphics_text_justification justification, 00938 t_jgraphics_textlayout_flags flags); 00939 00940 00941 /** Set the color to render text in a textlayout object. 00942 @ingroup textlayout 00943 @param textlayout The textlayout object for which to set the color. 00944 @param textcolor The color for the text. */ 00945 void jtextlayout_settextcolor(t_jtextlayout *textlayout, t_jrgba *textcolor); 00946 00947 00948 /** Return a measurement of how much space will be required to draw the text of a textlayout. 00949 @ingroup textlayout 00950 @param textlayout The textlayout object to query. 00951 @param startindex You can measure a subset of the characters. 00952 This defines the character from which to start. 00953 @param numchars Pass -1 for all characters from startindex to end 00954 @param includewhitespace Define whether to measure with or without whitespace truncated from edges. 00955 @param width Returns the width of text not including any margins. 00956 @param height Returns the height of text not including any margins. 00957 @param numlines Returns the number of lines of text. */ 00958 void jtextlayout_measure(t_jtextlayout *textlayout, 00959 long startindex, 00960 long numchars, 00961 long includewhitespace, 00962 double *width, double *height, 00963 long *numlines); 00964 00965 00966 /** Draw a textlayout in a given graphics context. 00967 @ingroup textlayout 00968 @param tl The textlayout object to query. 00969 @param g The graphics context in which to draw the text. */ 00970 void jtextlayout_draw(t_jtextlayout *tl, t_jgraphics *g); 00971 00972 00973 /** Retrieve a count of the number of characters in a textlayout object. 00974 @ingroup textlayout 00975 @param tl The textlayout object to query. 00976 @return The number of characters. */ 00977 long jtextlayout_getnumchars(t_jtextlayout *tl); 00978 00979 00980 /** Retrieve the #t_rect containing a character at a given index. 00981 @ingroup textlayout 00982 @param tl The textlayout object to query. 00983 @param index The index from which to fetch the unicode character. 00984 @param rect The address of a valid #t_rect which will be filled in upon return. 00985 @return A Max error code. */ 00986 t_max_err jtextlayout_getcharbox(t_jtextlayout *tl, long index, t_rect *rect); 00987 00988 00989 /** Retrieve the unicode character at a given index. 00990 @ingroup textlayout 00991 @param tl The textlayout object to query. 00992 @param index The index from which to fetch the unicode character. 00993 @param pch The address of a variable to hold the unicode character value upon return. 00994 @return A Max error code. */ 00995 t_max_err jtextlayout_getchar(t_jtextlayout *tl, long index, long *pch); 00996 00997 00998 00999 01000 /** An affine transformation (such as scale, shear, etc). 01001 @ingroup jmatrix */ 01002 typedef struct { 01003 double xx; ///< xx component 01004 double yx; ///< yx component 01005 double xy; ///< xy component 01006 double yy; ///< yy component 01007 double x0; ///< x translation 01008 double y0; ///< y translation 01009 } t_jmatrix; 01010 01011 /** Set a #t_jmatrix to an affine transformation. 01012 @ingroup jmatrix 01013 @param x 01014 @param xx 01015 @param yx 01016 @param xy 01017 @param yy 01018 @param x0 01019 @param y0 01020 @remark given x,y the matrix specifies the following transformation: 01021 @code 01022 xnew = xx * x + xy * y + x0; 01023 ynew = yx * x + yy * y + y0; 01024 @endcode 01025 */ 01026 void jgraphics_matrix_init(t_jmatrix *x, double xx, double yx, double xy, double yy, double x0, double y0); 01027 01028 /** Modify a matrix to be an identity transform. 01029 @ingroup jmatrix 01030 @param x The #t_jmatrix. 01031 */ 01032 void jgraphics_matrix_init_identity(t_jmatrix *x); 01033 01034 /** Initialize a #t_jmatrix to translate (offset) a point. 01035 @ingroup jmatrix 01036 @param x The #t_jmatrix. 01037 @param tx The amount of x-axis translation. 01038 @param ty The amount of y-axis translation. 01039 */ 01040 void jgraphics_matrix_init_translate(t_jmatrix *x, double tx, double ty); 01041 01042 /** Initialize a #t_jmatrix to scale (offset) a point. 01043 @ingroup jmatrix 01044 @param x The #t_jmatrix. 01045 @param sx The horizontal scale factor. 01046 @param sy The vertical scale factor. 01047 */ 01048 void jgraphics_matrix_init_scale(t_jmatrix *x, double sx, double sy); 01049 01050 /**Initialize a #t_jmatrix to rotate (offset) a point. 01051 @ingroup jmatrix 01052 @param x The #t_jmatrix. 01053 @param radians The angle or rotation in radians. 01054 */ 01055 void jgraphics_matrix_init_rotate(t_jmatrix *x, double radians); 01056 01057 01058 /** Apply a translation to an existing matrix. 01059 @ingroup jmatrix 01060 @param x The #t_jmatrix. 01061 @param tx The amount of x-axis translation. 01062 @param ty The amount of y-axis translation. 01063 */ 01064 void jgraphics_matrix_translate(t_jmatrix *x, double tx, double ty); 01065 01066 /** Apply a scaling to an existing matrix. 01067 @ingroup jmatrix 01068 @param x The #t_jmatrix. 01069 @param sx The horizontal scale factor. 01070 @param sy The vertical scale factor. 01071 */ 01072 void jgraphics_matrix_scale(t_jmatrix *x, double sx, double sy); 01073 01074 /** Apply a rotation to an existing matrix. 01075 @ingroup jmatrix 01076 @param x The #t_jmatrix. 01077 @param radians The angle or rotation in radians. 01078 */ 01079 void jgraphics_matrix_rotate(t_jmatrix *x, double radians); 01080 01081 /** Invert an existing matrix. 01082 @ingroup jmatrix 01083 @param x The #t_jmatrix. 01084 */ 01085 void jgraphics_matrix_invert(t_jmatrix *x); 01086 01087 /** Multiply two matrices: resulting matrix has effect of first applying a and then applying b. 01088 @ingroup jmatrix 01089 @param result The resulting product #t_jmatrix. 01090 @param a The first operand. 01091 @param b The second operand. 01092 */ 01093 void jgraphics_matrix_multiply(t_jmatrix *result, const t_jmatrix *a, const t_jmatrix *b); 01094 01095 01096 /** Transform a point using a #t_jmatrix transormation. 01097 @ingroup jmatrix 01098 @param matrix The #t_jmatrix. 01099 @param x The address of the variable holding the x coordinate. 01100 @param y The address of the variable holding the y coordinate. 01101 */ 01102 void jgraphics_matrix_transform_point(const t_jmatrix *matrix, double *x, double *y); 01103 01104 01105 01106 01107 // Patterns 01108 t_jpattern* jgraphics_pattern_create_rgba(double red, 01109 double green, // colors between 0 and 1 01110 double blue, 01111 double alpha); // solid, set alpha to 1.0 01112 01113 t_jpattern* jgraphics_pattern_create_for_surface(t_jsurface *surface); 01114 01115 t_jpattern* jgraphics_pattern_create_linear(double x0, double y0, double x1, double y1); 01116 01117 /* 01118 cx0 : x coordinate for the center of the start circle 01119 cy0 : y coordinate for the center of the start circle 01120 radius0 : radius of the start circle 01121 cx1 : x coordinate for the center of the end circle 01122 cy1 : y coordinate for the center of the end circle 01123 radius1 : radius of the end circle 01124 */ 01125 t_jpattern* jgraphics_pattern_create_radial(double cx0, double cy0, double radius0, double cx1, double cy1, double radius1); 01126 01127 void jgraphics_pattern_add_color_stop_rgba(t_jpattern* pattern, double offset, double red, double green, double blue, double alpha); 01128 01129 t_jpattern *jgraphics_pattern_reference(t_jpattern *pattern); 01130 void jgraphics_pattern_destroy(t_jpattern *pattern); 01131 01132 typedef enum _jgraphics_pattern_type { 01133 JGRAPHICS_PATTERN_TYPE_SOLID, 01134 JGRAPHICS_PATTERN_TYPE_SURFACE, 01135 JGRAPHICS_PATTERN_TYPE_LINEAR, 01136 JGRAPHICS_PATTERN_TYPE_RADIAL 01137 } t_jgraphics_pattern_type; 01138 01139 t_jgraphics_pattern_type jgraphics_pattern_get_type(t_jpattern *pattern); 01140 01141 typedef enum _jgraphics_extend { 01142 JGRAPHICS_EXTEND_NONE, 01143 JGRAPHICS_EXTEND_REPEAT, 01144 JGRAPHICS_EXTEND_REFLECT, 01145 JGRAPHICS_EXTEND_PAD 01146 } t_jgraphics_extend; 01147 01148 // rbs -- JGRAPHICS_EXTEND_NONE for images isn't actually supported yet 01149 #define JGRAPHICS_EXTEND_GRADIENT_DEFAULT JGRAPHICS_EXTEND_PAD 01150 #define JGRAPHICS_EXTEND_SURFACE_DEFAULT JGRAPHICS_EXTEND_NONE 01151 01152 void jgraphics_pattern_set_extend(t_jpattern *pattern, t_jgraphics_extend extend); 01153 t_jgraphics_extend jgraphics_pattern_get_extend(t_jpattern *pattern); 01154 01155 void jgraphics_pattern_set_matrix(t_jpattern *pattern, const t_jmatrix *matrix); 01156 void jgraphics_pattern_get_matrix(t_jpattern *pattern, t_jmatrix *matrix); 01157 01158 // Transforms 01159 void jgraphics_translate(t_jgraphics *g, double tx, double ty); 01160 void jgraphics_scale(t_jgraphics *g, double sx, double sy); 01161 void jgraphics_rotate(t_jgraphics *g, double angle); 01162 void jgraphics_transform(t_jgraphics *g, const t_jmatrix *matrix); 01163 void jgraphics_set_matrix(t_jgraphics *g, const t_jmatrix *matrix); 01164 void jgraphics_get_matrix(t_jgraphics *g, t_jmatrix *matrix); 01165 void jgraphics_identity_matrix(t_jgraphics *g); 01166 01167 01168 /** User coordinates are those passed to drawing functions in a given #t_jgraphics context. 01169 Device coordinates refer to patcher canvas coordinates, before any zooming. 01170 @ingroup jgraphics */ 01171 void jgraphics_user_to_device(t_jgraphics *g, 01172 double *x, 01173 double *y); 01174 01175 /** User coordinates are those passed to drawing functions in a given #t_jgraphics context. 01176 Device coordinates refer to patcher canvas coordinates, before any zooming. 01177 @ingroup jgraphics */ 01178 void jgraphics_device_to_user(t_jgraphics *g, 01179 double *x, 01180 double *y); 01181 01182 // Graphics 01183 01184 void jgraphics_save(t_jgraphics* g); // doesn't save/restore the path 01185 void jgraphics_restore(t_jgraphics *g); 01186 01187 t_jsurface* jgraphics_get_target(t_jgraphics *g); 01188 01189 01190 // Pushing and Popping groups is not currently exported or supported by Max. 01191 void jgraphics_push_group(t_jgraphics *g); 01192 t_jpattern* jgraphics_pop_group(t_jgraphics *g); 01193 void jgraphics_pop_group_to_source(t_jgraphics *g); 01194 t_jsurface* jgraphics_get_group_target(t_jgraphics *g); 01195 // jgraphics_pop_group_surface is not in cairo, but equivalent to the following sequence 01196 // jgraphics_get_group_target(), jgraphics_surface_reference(), jgraphics_restore() 01197 t_jsurface* jgraphics_pop_group_surface(t_jgraphics *g); 01198 01199 01200 // if a t_jpattern source was previously selected, it is removed 01201 void jgraphics_set_source_rgba(t_jgraphics *g, 01202 double red, 01203 double green, 01204 double blue, 01205 double alpha); 01206 01207 void jgraphics_set_source_jrgba(t_jgraphics *g, t_jrgba *rgba); 01208 01209 void jgraphics_set_source_rgb(t_jgraphics *g, 01210 double red, 01211 double green, 01212 double blue); 01213 // if NULL source is passed in will revert to prior solid color. 01214 void jgraphics_set_source(t_jgraphics *g, t_jpattern *source); 01215 01216 // convenience function for creating pattern from surface and making it the source for g 01217 void jgraphics_set_source_surface(t_jgraphics *g, 01218 t_jsurface *surface, 01219 double x, double y); 01220 01221 01222 typedef enum _jgraphics_pattern_shared { 01223 JGRAPHICS_PATTERN_GRAY = 0, 01224 JGRAPHICS_NUM_SHARED_PATTERNS 01225 } t_jgraphics_pattern_shared; 01226 01227 01228 // We create some standard patterns which are "owned" by the jgraphics library. 01229 // You can use these as a source for filling or stroking paths. 01230 // The gray patter above is what is used to put dotted lines around the comment box, and others. 01231 void jgraphics_set_source_shared(t_jgraphics *g, t_jgraphics_pattern_shared patindex); 01232 01233 // color transforms 01234 // each component (rgba) has a scale and offset value as part of the graphics context. 01235 // this is saved and restored with the jgraphics_save and jgraphics_restore calls. 01236 01237 void jgraphics_scale_source_rgba(t_jgraphics *g, 01238 double redscale, 01239 double greenscale, 01240 double bluescale, 01241 double alphascale); 01242 01243 void jgraphics_translate_source_rgba(t_jgraphics *g, 01244 double redoffset, 01245 double greenoffset, 01246 double blueoffset, 01247 double alphaoffset); 01248 01249 // example use of this function is in the gswitch object 01250 void jgraphics_set_dash(t_jgraphics *g, 01251 double *dashes, 01252 int numdashes, 01253 double offset); // offset not supported yet 01254 01255 01256 typedef enum _jgraphics_fill_rule { 01257 JGRAPHICS_FILL_RULE_WINDING, 01258 JGRAPHICS_FILL_RULE_EVEN_ODD 01259 } t_jgraphics_fill_rule; 01260 01261 void jgraphics_set_fill_rule(t_jgraphics *g, t_jgraphics_fill_rule fill_rule); 01262 t_jgraphics_fill_rule jgraphics_get_fill_rule(t_jgraphics *g); 01263 01264 01265 typedef enum _jgraphics_line_cap { 01266 JGRAPHICS_LINE_CAP_BUTT, 01267 JGRAPHICS_LINE_CAP_ROUND, 01268 JGRAPHICS_LINE_CAP_SQUARE 01269 } t_jgraphics_line_cap; 01270 01271 void jgraphics_set_line_cap(t_jgraphics *g, t_jgraphics_line_cap line_cap); 01272 t_jgraphics_line_cap jgraphics_get_line_cap(t_jgraphics *g); 01273 01274 01275 typedef enum _jgraphics_line_join { 01276 JGRAPHICS_LINE_JOIN_MITER, 01277 JGRAPHICS_LINE_JOIN_ROUND, 01278 JGRAPHICS_LINE_JOIN_BEVEL 01279 } t_jgraphics_line_join; 01280 01281 01282 void jgraphics_set_line_join(t_jgraphics *g, 01283 t_jgraphics_line_join line_join); 01284 t_jgraphics_line_join jgraphics_get_line_join(t_jgraphics *g); 01285 01286 void jgraphics_set_line_width(t_jgraphics *g, 01287 double width); 01288 double jgraphics_get_line_width(t_jgraphics *g); 01289 01290 // perhaps someday we could expose something like this 01291 // jgraphics_set_operator() 01292 01293 void jgraphics_fill(t_jgraphics *g); 01294 void jgraphics_fill_preserve(t_jgraphics *g); 01295 01296 // Note: you can use jgraphics_image_surface_create with a 1x1 offscreen to do path stuff 01297 // that isn't actually going to be used for drawing. 01298 int jgraphics_in_fill(t_jgraphics *g, double x, double y); // hit test 01299 int jgraphics_path_intersects_line(t_jgraphics *g, double x1, double y1, double x2, double y2); // not in cairo 01300 01301 // various utilities 01302 int jgraphics_ptinrect(t_pt pt, t_rect rect); 01303 01304 /* 01305 Note that the functions jgraphics_rectangle_rounded() and jgraphics_ptinroundedrect() 01306 need different size arguments as ovalsize and ovalwidth. 01307 */ 01308 int jgraphics_ptinroundedrect(t_pt pt, t_rect rect, double ovalwidth, double ovalheight); 01309 01310 // get extents of current path in device coordinates (after transform matrix) 01311 void jgraphics_fill_extents(t_jgraphics *g, 01312 double *x1, double *y1, 01313 double *x2, double *y2); 01314 01315 // paints current source using alpha of pattern 01316 //void jgraphics_mask(t_jgraphics *x, 01317 // t_jpattern *pattern); 01318 01319 // paints current source using alpha of surface 01320 //void jgraphics_mask_surface(t_jgraphics *g, 01321 // t_jsurface *surface, 01322 // double surface_x, // surface origin 01323 // double surface_y); // surface origin 01324 01325 // paint current source in entire current clip region 01326 void jgraphics_paint(t_jgraphics *g); 01327 void jgraphics_paint_with_alpha(t_jgraphics *g, 01328 double alpha); 01329 01330 void jgraphics_stroke(t_jgraphics *g); 01331 void jgraphics_stroke_preserve(t_jgraphics *g); 01332 01333 // fast non antialiasing/rotating versions 01334 void jgraphics_rectangle_fill_fast(t_jgraphics *g, double x, double y, double width, double height); 01335 void jgraphics_rectangle_draw_fast(t_jgraphics *g, double x, double y, double width, double height, double border); 01336 void jgraphics_line_draw_fast(t_jgraphics *g, double x1, double y1, double x2, double y2, double linewidth); 01337 01338 01339 01340 01341 // popup menu API so externals can create popup menus that can also be drawn into 01342 01343 /** Create a pop-up menu. 01344 Free this pop-up menu using jpopupmenu_destroy(). 01345 @ingroup jpopupmenu 01346 @return A pointer to the newly created jpopupmenu object. */ 01347 t_jpopupmenu* jpopupmenu_create(); 01348 01349 /** Free a pop-up menu created with jpopupmenu_create(). 01350 @ingroup jpopupmenu 01351 @param menu The pop-up menu to be freed. */ 01352 void jpopupmenu_destroy(t_jpopupmenu *menu); 01353 01354 /** Clear the conents of a pop-up menu. 01355 @ingroup jpopupmenu 01356 @param menu The pop-up menu whose contents will be cleared. */ 01357 void jpopupmenu_clear(t_jpopupmenu *menu); 01358 01359 // Internal use only 01360 void jpopupmenu_setitemcallback(method fun, void *arg); 01361 01362 /** Set the colors used by a pop-up menu. 01363 @ingroup jpopupmenu 01364 @param menu The pop-up menu to which the colors will be applied. 01365 @param text The text color for menu items. 01366 @param bg The background color for menu items. 01367 @param highlightedtext The text color for the highlighted menu item. 01368 @param highlightedbg The background color the highlighted menu item. */ 01369 void jpopupmenu_setcolors(t_jpopupmenu *menu, 01370 t_jrgba text, 01371 t_jrgba bg, 01372 t_jrgba highlightedtext, 01373 t_jrgba highlightedbg); 01374 01375 // Internal use only (header functions are not exported) 01376 void jpopupmenu_setheadercolor(t_jpopupmenu *menu, t_jrgba *hc); 01377 01378 /** Set the font used by a pop-up menu. 01379 @ingroup jpopupmenu 01380 @param menu The pop-up menu whose font will be set. 01381 @param font A pointer to a font object, whose font info will be copied to the pop-up menu. */ 01382 void jpopupmenu_setfont(t_jpopupmenu *menu, t_jfont *font); 01383 01384 /** Add an item to a pop-up menu. 01385 @ingroup jpopupmenu 01386 @param menu The pop-up menu to which the item will be added. 01387 @param itemid Each menu item should be assigned a unique integer id using this parameter. 01388 @param utf8Text The text to display in for the menu item. 01389 @param textColor The color to use for the menu item, or NULL to use the default color. 01390 @param checked A non-zero value indicates that the item should have a check-mark next to it. 01391 @param disabled A non-zero value indicates that the item should be disabled. 01392 @param icon A #t_jsurface will be used as an icon for the menu item if provided here. 01393 Pass NULL for no icon. */ 01394 void jpopupmenu_additem(t_jpopupmenu *menu, 01395 int itemid, 01396 const char *utf8Text, 01397 t_jrgba *textColor, 01398 int checked, 01399 int disabled, 01400 t_jsurface *icon); 01401 01402 /** Add a pop-menu to another pop-menu as a submenu. 01403 @ingroup jpopupmenu 01404 @param menu The pop-up menu to which a menu will be added as a submenu. 01405 @param utf8Name The name of the menu item. 01406 @param submenu The pop-up menu which will be used as the submenu. 01407 @param disabled Pass a non-zero value to disable the menu item. */ 01408 void jpopupmenu_addsubmenu(t_jpopupmenu *menu, 01409 const char *utf8Name, 01410 t_jpopupmenu *submenu, 01411 int disabled); 01412 01413 /** Add a separator to a pop-menu. 01414 @ingroup jpopupmenu 01415 @param menu The pop-up menu to which the separator will be added. */ 01416 void jpopupmenu_addseperator(t_jpopupmenu *menu); 01417 01418 // Internal use only (header functions are not exported) 01419 void jpopupmenu_addheader(t_jpopupmenu *menu, const char *utf8Text); 01420 01421 // Internal use only 01422 // ownerdraw: give a t_object to the menu. 01423 // it will be sent a paint message to draw itself. 01424 // it will be sent a getsize message to find out the size. 01425 void jpopupmenu_addownerdrawitem(t_jpopupmenu *menu, 01426 int itemid, 01427 t_object *owner); 01428 01429 /** Tell a menu to display at a specified location. 01430 @ingroup jpopupmenu 01431 @param menu The pop-up menu to display. 01432 @param screen The point at which to display in screen coordinates. 01433 @param defitemid The initially choosen item id. 01434 @return The item id for the item in the menu choosen by the user. */ 01435 int jpopupmenu_popup(t_jpopupmenu *menu, 01436 t_pt screen, 01437 int defitemid); // initial item id 01438 01439 /** Tell a menu to display above a given box in a patcher. 01440 @ingroup jpopupmenu 01441 @param menu The pop-up menu to display. 01442 @param box The box above which to display the menu. 01443 @param view The patcherview for the box in which to display the menu. 01444 @param offset An offset from the box position at which to display the menu. 01445 @param defitemid The initially choosen item id. 01446 @return The item id for the item in the menu choosen by the user. */ 01447 int jpopupmenu_popup_abovebox(t_jpopupmenu *menu, t_object *box, t_object *view, int offset, int defitemid); 01448 01449 /** Tell a menu to display near a given box in a patcher. 01450 @ingroup jpopupmenu 01451 @param menu The pop-up menu to display. 01452 @param box The box above which to display the menu. 01453 @param view The patcherview for the box in which to display the menu. 01454 @param defitemid The initially choosen item id. 01455 @return The item id for the item in the menu choosen by the user. */ 01456 int jpopupmenu_popup_nearbox(t_jpopupmenu *menu, 01457 t_object *box, t_object *view, 01458 int defitemid); 01459 01460 01461 // unused by any C74 code 01462 // you can draw to a surface and then turn that into a cursor 01463 // only works with 16 x 16 surfaces 01464 void jmouse_setcursor_surface(t_object *patcherview, t_object *box, t_jsurface *surface, int xHotSpot, int yHotSpot); 01465 01466 01467 // Unused by any C74 code 01468 void jbox_fontface_to_weight_slant(t_object *b, long *weight, long *slant); 01469 01470 /** Get the slant box's font. 01471 @ingroup jfont 01472 @param b An object's box. 01473 @return A value from the #t_jgraphics_font_weight enum. */ 01474 long jbox_get_font_weight(t_object *b); 01475 01476 /** Get the slant box's font. 01477 @ingroup jfont 01478 @param b An object's box. 01479 @return A value from the #t_jgraphics_font_slant enum. */ 01480 long jbox_get_font_slant(t_object *b); 01481 01482 // create a jfont object for box -- internal use only 01483 t_jfont *jbox_createfont(t_object *b); 01484 01485 01486 01487 01488 // utility funtions and macros for new rgba attribtes and legacy rgb attributes 01489 01490 // don't call these two functions directly, instead use the macros below... 01491 t_max_err jgraphics_attr_setrgba(t_object *x, t_object *attr, long argc, t_atom *argv); 01492 t_max_err jgraphics_attr_setrgb_alias(t_object *x, t_object *attr, long argc, t_atom *argv); 01493 01494 01495 /** 01496 Create a color (#t_jrgba) attribute and add it to a Max class. 01497 01498 @ingroup attr 01499 @param c The class pointer. 01500 @param attrname The name of this attribute as a C-string. 01501 @param flags Any flags you wish to declare for this attribute, as defined in #e_max_attrflags. 01502 @param structname The C identifier for the struct (containing a valid #t_object header) representing an instance of this class. 01503 @param structmember The C identifier of the member in the struct that holds the value of this attribute. 01504 */ 01505 #define CLASS_ATTR_RGBA(c,attrname,flags,structname,structmember) \ 01506 { CLASS_ATTR_DOUBLE_ARRAY(c,attrname,flags,structname,structmember,4); \ 01507 CLASS_ATTR_ACCESSORS(c,attrname,NULL,jgraphics_attr_setrgba); \ 01508 CLASS_ATTR_PAINT(c,attrname,0); } 01509 01510 01511 // for internal use only? 01512 #define CLASS_ATTR_RGBA_LEGACY(c,attrname,aliasname,flags,structname,structmember) \ 01513 { CLASS_ATTR_RGBA(c,attrname,flags,structname,structmember); \ 01514 CLASS_ATTR_ALIAS(c,attrname,aliasname); \ 01515 CLASS_ATTR_INVISIBLE(c,aliasname,0); \ 01516 CLASS_ATTR_ACCESSORS(c,aliasname,NULL,jgraphics_attr_setrgb_alias); } 01517 01518 01519 /** 01520 Retrieves the value of a color attribute, given its parent object and name. 01521 01522 @ingroup attr 01523 @param ob The attribute's parent object 01524 @param s The attribute's name 01525 @param c The address of a #t_jrgba struct that will be filled with the attribute's color component values. 01526 @return This function returns the error code #MAX_ERR_NONE if successful, 01527 or one of the other error codes defined in #e_max_errorcodes if unsuccessful. 01528 */ 01529 t_max_err object_attr_getjrgba(void *ob, t_symbol *s, t_jrgba *c); 01530 01531 01532 /** 01533 Sets the value of a color attribute, given its parent object and name. 01534 The function will call the attribute's <tt>set</tt> method, using the data provided. 01535 01536 @ingroup attr 01537 @param ob The attribute's parent object 01538 @param s The attribute's name 01539 @param c The address of a #t_jrgba struct that contains the new color. 01540 @return This function returns the error code #MAX_ERR_NONE if successful, 01541 or one of the other error codes defined in #e_max_errorcodes if unsuccessful. 01542 */ 01543 t_max_err object_attr_setjrgba(void *ob, t_symbol *s, t_jrgba *c); 01544 01545 01546 /** Get the components of a color in an array of pre-allocated atoms. 01547 01548 @ingroup color 01549 @param argv The address to the first of an array of atoms that will hold the result. 01550 At least 4 atoms must be allocated, as 4 atoms will be set by this function 01551 for the red, green, blue, and alpha components. 01552 @param c The address of a #t_jrgba struct from which the color components will be fetched. 01553 */ 01554 void jrgba_to_atoms(t_jrgba *c, t_atom *argv); 01555 01556 01557 /** Set the components of a color by providing an array of atoms. 01558 If it is an array of 3 atoms, then the atoms provided should define the 01559 red, green, and blue components (in this order) in a range of [0.0, 1.0]. 01560 If a 4th atom is provided, it will define the alpha channel. 01561 If the alpha channel is not defined then it is assumed to be 1.0. 01562 01563 @ingroup color 01564 @param argc The number of atoms in the array provided in argv. 01565 This should be 3 or 4 depending on whether or not the alpha channel is being provided. 01566 @param argv The address to the first of an array of atoms that define the color. 01567 @param c The address of a #t_jrgba struct for which the color will be defined. 01568 @return A Max error code. */ 01569 t_max_err atoms_to_jrgba(long argc, t_atom *argv, t_jrgba *c); 01570 01571 01572 /** Set the components of a color. 01573 @ingroup color 01574 @param prgba The address of a #t_jrgba struct for which the color will be defined. 01575 @param r The value of the red component in a range of [0.0, 1.0]. 01576 @param g The value of the green component in a range of [0.0, 1.0]. 01577 @param b The value of the blue component in a range of [0.0, 1.0]. 01578 @param a The value of the alpha component in a range of [0.0, 1.0]. */ 01579 void jrgba_set(t_jrgba *prgba, double r, double g, double b, double a); 01580 01581 01582 /** Copy a color. 01583 @ingroup color 01584 @param dest The address of a #t_jrgba struct to which the color will be copied. 01585 @param src The address of a #t_jrgba struct from which the color will be copied. */ 01586 void jrgba_copy(t_jrgba *dest, t_jrgba *src); 01587 01588 01589 /** Compare two colors for equality. 01590 @ingroup color 01591 @param rgba1 The address of a #t_jrgba struct to compare. 01592 @param rgba2 The address of another #t_jrgba struct to compare. 01593 @return returns 1 if rgba1 == rgba2. */ 01594 long jrgba_compare(t_jrgba *rgba1, t_jrgba *rgba2); 01595 01596 01597 /** Get a list of of filetypes appropriate for use with jgraphics surfaces. 01598 @ingroup jgraphics 01599 @param dummy Unused. 01600 @param count The address of a variable to be set with the number of types in filetypes upon return. 01601 @param filetypes The address of a variable that will represent the array of file types upon return. 01602 @param alloc The address of a char that will be flagged with a 1 or a 0 depending on whether or not 01603 memory was allocated for the filetypes member. 01604 01605 @remark This example shows a common usage of jgraphics_getfiletypes(). 01606 @code 01607 char filename[MAX_PATH_CHARS]; 01608 long *type = NULL; 01609 long ntype; 01610 long outtype; 01611 t_max_err err; 01612 char alloc; 01613 short path; 01614 t_jsurface *surface; 01615 01616 if (want_to_show_dialog) { 01617 jgraphics_getfiletypes(x, &ntype, &type, &alloc); 01618 err = open_dialog(filename, &path,(void *)&outtype, (void *)type, ntype); 01619 if (err) 01620 goto out; 01621 } 01622 else { 01623 strncpy_zero(filename, s->s_name, MAX_PATH_CHARS); 01624 err = locatefile_extended(filename, &path, &outtype, type, ntype); 01625 if (err) 01626 goto out; 01627 } 01628 surface = jgraphics_image_surface_create_referenced(filename, path); 01629 out: 01630 if (alloc) 01631 sysmem_freeptr((char *)type); 01632 @endcode 01633 */ 01634 void jgraphics_getfiletypes(void *dummy, long *count, long **filetypes, char *alloc); 01635 01636 01637 // boxlayer stuff 01638 01639 /** Invalidate a layer, indicating that it needs to be re-drawn. 01640 @ingroup boxlayer 01641 @param b The object/box to invalidate. 01642 @param view The patcherview for the object which should be invalidated, or NULL for all patcherviews. 01643 @param name The name of the layer to invalidate. 01644 @return A Max error code. */ 01645 t_max_err jbox_invalidate_layer(t_object *b, t_object *view, t_symbol *name); 01646 01647 // unused by any C74 code 01648 t_max_err jbox_remove_layer(t_object *b, t_object *view, t_symbol *name); 01649 01650 /** Create a layer, and ready it for drawing commands. 01651 The layer drawing commands must be wrapped with a matching call to jbox_end_layer() 01652 prior to calling jbox_paint_layer(). 01653 01654 @ingroup boxlayer 01655 @param b The object/box to which the layer is attached. 01656 @param view The patcherview for the object to which the layer is attached. 01657 @param name A name for this layer. 01658 @param width The width of the layer. 01659 @param height The height of the layer. 01660 @return A #t_jgraphics context for drawing into the layer. */ 01661 t_jgraphics* jbox_start_layer(t_object *b, t_object *view, t_symbol *name, double width, double height); 01662 01663 /** Conclude a layer, indicating that it is complete and ready for painting. 01664 @ingroup boxlayer 01665 @param b The object/box for the layer opened by jbox_start_layer(). 01666 @param view The patcherview for the object opened by jbox_start_layer(). 01667 @param name The name of the layer. 01668 @return A Max error code. */ 01669 t_max_err jbox_end_layer(t_object *b, t_object *view, t_symbol *name); 01670 01671 /** Paint a layer at a given position. 01672 Note that the current color alpha value is used when painting layers to allow you to blend layers. 01673 The same is also true for jgraphics_image_surface_draw() and jgraphics_image_surface_draw_fast(). 01674 01675 @ingroup boxlayer 01676 @param b The object/box to be painted. 01677 @param view The patcherview for the object which should be painted, or NULL for all patcherviews. 01678 @param name The name of the layer to paint. 01679 @param x The x-coordinate for the position at which to paint the layer. 01680 @param y The y-coordinate for the position at which to paint the layer. 01681 @return A Max error code. */ 01682 t_max_err jbox_paint_layer(t_object *b, t_object *view, t_symbol *name, double x, double y); 01683 01684 01685 /** Simple utility to test for rectangle intersection. 01686 @ingroup jgraphics 01687 @param r1 The address of the first rect for the test. 01688 @param r2 The address of the second rect for the test. 01689 @return Returns true if the rects intersect, otherwise false. */ 01690 long jgraphics_rectintersectsrect(t_rect *r1, t_rect *r2); 01691 01692 /** Simple utility to test for rectangle containment. 01693 @ingroup jgraphics 01694 @param outer The address of the first rect for the test. 01695 @param inner The address of the second rect for the test. 01696 @return Returns true if the inner rect is completely inside the outer rect, 01697 otherwise false. */ 01698 long jgraphics_rectcontainsrect(t_rect *outer, t_rect *inner); 01699 01700 /** Generate a #t_rect according to positioning rules. 01701 @ingroup jgraphics 01702 @param positioned_rect The address of a valid #t_rect whose members will be filled in upon return. 01703 @param positioned_near_this_rect A pointer to a rect near which this rect should be positioned. 01704 @param keep_inside_this_rect A pointer to a rect defining the limits within which the new rect must reside. */ 01705 void jgraphics_position_one_rect_near_another_rect_but_keep_inside_a_third_rect( 01706 t_rect *positioned_rect, 01707 const t_rect *positioned_near_this_rect, 01708 const t_rect *keep_inside_this_rect); 01709 01710 #if C74_PRAGMA_STRUCT_PACKPUSH 01711 #pragma pack(pop) 01712 #elif C74_PRAGMA_STRUCT_PACK 01713 #pragma pack() 01714 #endif 01715 01716 END_USING_C_LINKAGE 01717 01718 #endif // #ifndef _JGRAPHICS_H_ 01719
Copyright © 2008, Cycling '74