start_image function begins the creation of an image, and end_image ends it. However, the type of image to draw is specified in separate function calls, instead of arguments:
The calling sequence to create images for image tiles and image buttons is similar to the list-handling sequence. TheDraws a vector (a single, straight line) in the current image.
Draws a filled rectangle in the current image.
Draws an AutoCAD slide in the image.
Vectors and filled rectangles are useful for simple images, such as the color swatches (filled rectangles) that the AutoCAD Select Color dialog box uses to display the user's choice of color. For complicated images, slides are more convenient. However, displaying slides can be time-consuming. If you use slides, keep them simple.
vector_image function requires that you specify absolute coordinates, while fill_image and slide_image require that you specify a starting coordinate along with a relative width and height. To do this correctly you must know the exact dimensions of the image tile or image button. Because these dimensions are usually assigned when the dialog box is laid out, the PDB feature provides functions that return the width and height of a particular tile. These dimension functions are dimx_tile and dimy_tile. You should call them before you begin creating an image. The origin of a tile, (0,0), is always the upper-left corner.
TheColors can be specified as AutoCAD color numbers or as one of the logical color numbers shown in the following table. (The values and mnemonics are defined by the Autodesk Device Interface [ADI].)
Dialog box color attribute |
||
---|---|---|
Color number |
ADI mnemonic |
Meaning |
-2 |
BGLCOLOR |
Current background of the AutoCAD graphics screen |
-15 |
DBGLCOLOR |
Current dialog box background color |
-16 |
DFGLCOLOR |
Current dialog box foreground color (for text) |
-18 |
LINELCOLOR |
Current dialog box line color |
"cur_color" is an image tile you want to fill entirely with a patch of red as follows:
In the following example,(setq width (dimx_tile "cur_color")
height (dimy_tile "cur_color"))
(start_image "cur_color")
(fill_image 0 0 width height 1) ;1 = AutoCAD red.
(end_image)
You can use the image-drawing functions in conjunction with each other. The following code fills an image and then draws a vertical stripe over it:
(setq width (dimx_tile "stripe")
height (dimy_tile "stripe"))
(start_image "stripe")
(fill_image 0 0 width height 3) ;3 = AutoCAD green.
(setq x (/ width 2)) ;Center the vector vertically.
(vector_image x 0 x height 4) ;4 = AutoCAD cyan.
(end_image)
slide_image can be standalone slide (SLD) files, or part of a slide library (SLB) file. If the slide is in an SLD file, you specify its name without the .sld extension (for example, "frntview"). If the slide is in a slide library, you specify the name of the library, followed by the name of the slide enclosed in parentheses. Note that the library and slide names are also specified without extensions—for example, "allviews(frntview)". The slide_image function searches for the slide or slide library file according to the current AutoCAD library search path. (See in the AutoLISP Reference.)
The slides you display withIn the following example, the slide is in a single file called topview.sld:
(setq x (dimx_tile "view")
y (dimy_tile "view"))
(start_image "view")
( slide_image 0 0 x y "topview")
(end_image)
color attribute to graphics_background. (You can also change the background of the image by preceding the slide_image call with a fill_image call.)
Vectors in slides are often drawn in white (color number 7), which is the default background color of an image. If your image tile is blank when you first display a slide, try changing its