MCPcopy Index your code
hub / github.com/MapServer/MapServer / msImageCreateIM

Function msImageCreateIM

mapimagemap.c:293–397  ·  view source on GitHub ↗

* Utility function to create a IM image. Returns * a pointer to an imageObj structure. */

Source from the content-addressed store, hash-verified

291 * a pointer to an imageObj structure.
292 */
293imageObj *msImageCreateIM(int width, int height, outputFormatObj *format,
294 char *imagepath, char *imageurl, double resolution, double defresolution)
295{
296 imageObj *image=NULL;
297 if (setvbuf(stdout, NULL, _IONBF , 0)){
298 printf("Whoops...");
299 };
300DEBUG_IF printf("msImageCreateIM<BR>\n");
301 if (width > 0 && height > 0)
302 {
303 image = (imageObj *)calloc(1,sizeof(imageObj));
304 MS_CHECK_ALLOC(image, sizeof(imageObj), NULL);
305/*
306
307 if( format->imagemode == MS_IMAGEMODE_RGB
308 || format->imagemode == MS_IMAGEMODE_RGBA )
309 {
310#if IM2_VERS > 1
311 image->img.gd = gdImageCreateTrueColor(width, height);
312#else
313 msSetError(MS_IMGERR,
314 "Attempt to use RGB or RGBA IMAGEMODE with IM 1.x, please upgrade to GD 2.x.", "msImageCreateGD()" );
315#endif
316 }
317 else
318 image->img.gd = gdImageCreate(width, height);
319 */
320 if (image)
321 {
322 imgStr.string = &(image->img.imagemap);
323 imgStr.alloc_size = &(image->size);
324
325 image->format = format;
326 format->refcount++;
327
328 image->width = width;
329 image->height = height;
330 image->imagepath = NULL;
331 image->imageurl = NULL;
332 image->resolution = resolution;
333 image->resolutionfactor = resolution/defresolution;
334
335 if( strcasecmp("ON",msGetOutputFormatOption( format, "DXF", "OFF" )) == 0){
336 dxf = 1;
337 im_iprintf(&layerStr, " 2\nLAYER\n 70\n 10\n");
338 } else
339 dxf = 0;
340
341 if( strcasecmp("ON",msGetOutputFormatOption( format, "SCRIPT", "OFF" )) == 0){
342 dxf = 2;
343 im_iprintf(&layerStr, "");
344 }
345
346 /* get href formation string options */
347 polyHrefFmt = makeFmtSafe(msGetOutputFormatOption
348 ( format, "POLYHREF", "javascript:Clicked('%s');"), 1);
349 polyMOverFmt = makeFmtSafe(msGetOutputFormatOption
350 ( format, "POLYMOUSEOVER", ""), 1);

Callers 2

msPrepareImageFunction · 0.85
msImageCreateFunction · 0.85

Calls 6

strcasecmpFunction · 0.85
msGetOutputFormatOptionFunction · 0.85
im_iprintfFunction · 0.85
makeFmtSafeFunction · 0.85
msStrdupFunction · 0.85
msSetErrorFunction · 0.85

Tested by

no test coverage detected