MCPcopy Create free account
hub / github.com/MapServer/MapServer / renderGlyphsGD

Function renderGlyphsGD

mapgd.c:388–419  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

386}
387
388int renderGlyphsGD(imageObj *img, double x, double y, labelStyleObj *style, char *text) {
389 gdImagePtr ip;
390 char *error=NULL;
391 int bbox[8];
392 x = MS_NINT(x);
393 y = MS_NINT(y);
394 if(!(ip = MS_IMAGE_GET_GDIMAGEPTR(img))) return MS_FAILURE;
395 if(!text || !strlen(text)) return(MS_SUCCESS); /* not errors, just don't want to do anything */
396
397 SETPEN(ip, style->color);
398 SETPEN(ip, style->outlinecolor);
399
400 if(style->outlinewidth > 0) { /* handle the outline color */
401 error = gdImageStringFT(ip, bbox, style->outlinecolor->pen, style->font, style->size, style->rotation, x, y-1, text);
402 if(error) {
403 msSetError(MS_TTFERR, error, "msDrawTextGD()");
404 return(MS_FAILURE);
405 }
406
407 gdImageStringFT(ip, bbox, style->outlinecolor->pen, style->font, style->size, style->rotation, x, y+1, text);
408 gdImageStringFT(ip, bbox, style->outlinecolor->pen, style->font, style->size, style->rotation, x+1, y, text);
409 gdImageStringFT(ip, bbox, style->outlinecolor->pen, style->font, style->size, style->rotation, x-1, y, text);
410 gdImageStringFT(ip, bbox, style->outlinecolor->pen, style->font, style->size, style->rotation, x-1, y-1, text);
411 gdImageStringFT(ip, bbox, style->outlinecolor->pen, style->font, style->size, style->rotation, x-1, y+1, text);
412 gdImageStringFT(ip, bbox, style->outlinecolor->pen, style->font, style->size, style->rotation, x+1, y-1, text);
413 gdImageStringFT(ip, bbox, style->outlinecolor->pen, style->font, style->size, style->rotation, x+1, y+1, text);
414 }
415
416 if(style->color)
417 gdImageStringFT(ip, bbox, style->color->pen, style->font, style->size, style->rotation, x, y, text);
418 return MS_SUCCESS;
419}
420
421int renderEllipseSymbolGD(imageObj *img, double x, double y, symbolObj *symbol, symbolStyleObj *style) {
422 /* check for trivial cases - 1x1 and 2x2, GD does not do these well */

Callers

nothing calls this directly

Calls 2

MS_NINTFunction · 0.85
msSetErrorFunction · 0.85

Tested by

no test coverage detected