## 10.3 Figure Item

A figure item is a free style display item. One can draw lines, polygons, arcs, text and pixmaps in figure item. Coordinates in a figure item are relative to its display location and a measured in pixels.

### 10.3.1 Resources

Figure item supports the following resources.

configOption | resourceName | valueType
`EZ_X` | `x` | `int`
`EZ_Y` | `y` | `int`
`EZ_LOCATION` | `location` | `int_x int_y`
`EZ_WIDTH` | `width` | `int`
`EZ_HEIGHT` | `height` | `int`
`EZ_SIZE` | `size` | `int_w int_h`
`EZ_GEOMETRY` | `geometry` | `int_x int_y int_w int_h`

configOption | resourceName | valueType
`EZ_BORDER_TYPE` | `borderType` | `enum`
`EZ_BORDER_WIDTH` | `borderWidth` | `int`
`EZ_BACKGROUND` | `background` | `string`

### 10.3.2 Interface Functions

`GC EZ_GetGC(unsigned long mask, XGCValues *gcv);`

find or create a GC that matches the specified characteristics.

`void EZ_FreeGC(GC gc);`

free a GC allocated by `EZ_GetGC`.

The following routines are wrappers for the corresponding Xlib drawing procedures.

    EZ_FigPiece  *EZ_FigItemAddString(EZ_Item *fitem, GC theGC,
                           char *str, int slen, int justification, int x, int y);

add a string to a figure item.

    EZ_FigPiece  *EZ_FigItemAddPixmap(EZ_Item *fitem, GC theGC,
                  EZ_Bitmap *bmp, int sx, int sy, int sw, int sh, int dx, int dy);

add a pixmap to a figure item.

    EZ_FigPiece  *EZ_FigItemAddPoints(EZ_Item *fitem, GC theGC,
                                      XPoint *pts, int npts);

add some points to a figure item.

    EZ_FigPiece  *EZ_FigItemAddLines (EZ_Item *fitem, GC theGC,
                              XPoint *pts, int npts, int mode);

add some lines to a figure item.

    EZ_FigPiece  *EZ_FigItemAddPolygon(EZ_Item *fitem, GC theGC,
                               XPoint *pts, int npts, int mode);

add a polygon to a figure item.

    EZ_FigPiece  *EZ_FigItemAddRectangle(EZ_Item *fitem, GC theGC,
                  int x, int y, int w, int h);
    EZ_FigPiece  *EZ_FigItemAddFilledRectangle(EZ_Item *fitem, GC theGC,
                  int x, int y, int w, int h);
    EZ_FigPiece  *EZ_FigItemAddRectangles(EZ_Item *fitem, GC theGC,
                   XRectangle *rects, int nrects);
    EZ_FigPiece  *EZ_FigItemAddFilledRectangles(EZ_Item *fitem, GC theGC,
                  XRectangle *rects, int nrects);

add a rectangles/filled rectangles to a figure item.

    EZ_FigPiece  *EZ_FigItemAddArc(EZ_Item *fitem, GC theGC,
                  int x, int y, int w, int h, int angle1, int angle);
    EZ_FigPiece  *EZ_FigItemAddFilledArc(EZ_Item *fitem, GC theGC,
                   int x, int y, int w, int h, int a1, int a2);
    EZ_FigPiece  *EZ_FigItemAddArcs(EZ_Item *fitem, GC theGC,
                   XArc *arcs, int narcs);
    EZ_FigPiece  *EZ_FigItemAddFilledArcs(EZ_Item *fitem, GC theGC,
                   XArc *arcs, int narcs);

add an arc/filled arc to a figure item

    EZ_FigPiece  *EZ_FigItemAddSegments(EZ_Item *fitem, GC theGC,
                  XSegment *segs, int nsegs);

add line segments to a figure item.

The following are figure item/piece manipulation commands.

`void EZ_ScaleFigItem(EZ_Item *item, float sx, float sy, int mode);`

scale a figure item.

`void EZ_FigItemDeletePiece(EZ_Item *item, EZ_FigPiece *fpiece, int update);`

delete a figure piece from a figure item.

`void EZ_FigItemHidePiece(EZ_Item *item, EZ_FigPiece *fpiece, int update);`

hide a figure piece from a figure item.

`void EZ_FigItemShowPiece(EZ_Item *item, EZ_FigPiece *fpiece, int update);`

un-hide a figure piece.

    void EZ_GetFigPieceBoundingBox(EZ_FigPiece *fpiece,
            int *x1, int *y1, int *x2, int *y2);

return the bounding box of a figure piece.

HTML Documentation Maintainance:`Arturo Espinosa <arturo@nuclecu.unam.mx>`