void OEDrawTextToCenter(OEImageBase &image, const std::string &text,
                                            const OEFont &font)

Draws the given text to the center of the image.

See code snippet below and the corresponding image in Figure: Example of using the OEDrawTextToCenter function.

int width  = 100;
int height = 50;
OEImage image = new OEImage(width, height);

OEDepict.OEDrawTextToCenter(image, "center", OEDepict.OEDefaultFont);
OEDepict.OEDrawBorder(image,  OEDepict.OELightGreyPen);

OEDepict.OEWriteImage("OEDrawTextToCenter.png", image);

Example of using the OEDrawTextToCenter function

See also