SG_Image *
SG_ImageNew
(SG_Node
*parent, const char
*name);
SG_Image *
SG_ImageFromSurface
(SG_Node
*parent, const char
*name, AG_Surface
*s);
SG_Image *
SG_ImageFromSurfaceNODUP
(SG_Node
*parent, const char
*name, AG_Surface
*s);
SG_Image *
SG_ImageFromAnim
(SG_Node
*parent, const char
*name, const AG_Anim
*anim);
SG_Image *
SG_ImageFromAnimNODUP
(SG_Node
*parent, const char
*name, AG_Anim
*anim);
void
SG_ImageSetSurface
(SG_Image
*bb, const AG_Surface
*s, M_Real
scale);
void
SG_ImageSetSurfaceNODUP
(SG_Image
*bb, AG_Surface
*s);
int
SG_ImageSetAnim
(SG_Image
*bb, AG_Anim
*anim);
int
SG_ImageSetAnimNODUP
(SG_Image
*bb, AG_Anim
*anim);
void
SG_ImageAnimPlay
(SG_Image
*bb);
void
SG_ImageAnimStop
(SG_Image
*bb);
void
SG_ImageSetShape
(SG_Image
*bb, enum sg_image_shape
shape);
void
SG_ImageSetShapeAuto
(SG_Image
*bb);
void
SG_ImageSetProj
(SG_Image
*bb, int
enable);
void
SG_ImageSetTolContour
(SG_Image
*bb, float
tol);
void
SG_ImageSetSize
(SG_Image
*bb, M_Real w,
M_Real h);
void
SG_ImageSetColor
(SG_Image
*bb, const AG_Color
*c);
The
SG_ImageNew
()
function creates a new image node at the origin of the parent node. The
SG_ImageFromSurface
() and
SG_ImageFromAnim
() variants set an initial surface
or animation.
The
SG_ImageSetSurface
()
function loads the specified surface. Image pixels are related to
SG(3) node
coordinates by the scaling factor scale.
The
SG_ImageSetAnim
()
function loads the specified animation (see
AG_Anim(3)).
Playback can be initiated or stopped with
SG_ImageAnimPlay
() and
SG_ImageAnimStop
().
SG_ImageSetShape
()
selects the contour shape for the image object. Possible values for
shape include:
- SG_IMAGE_RECT
- Render as solid rectangle.
- SG_IMAGE_POLYGON
- Render as a complex polygon calculated from the contours of the image. The
contour of the polygon is reduced to a manageable set of vertices using
Douglas-Peucker polygon simplification.
The
SG_ImageSetShapeAuto
()
function scans the image and selects
SG_IMAGE_POLYGON
if a usable shape exists over a
transparent background, otherwise the SG_IMAGE_RECT
shape is selected.
SG_ImageSetProj
()
configures the image projection mode. If an argument of 1 is given, the
image object will be rendered as to always face the camera. Otherwise, the
object is rendered as a textured plane in its original orientation (the
default).
SG_ImageSetTolContour
()
sets the tolerance for Douglas-Peucker simplification (default is 10.0).
SG_ImageSetSize
()
sets the relative size of the image (default is 1.0 x 1.0).
SG_ImageSetColor
()
sets the background color (RGBA) of the image object (default is transparent
black).