Example #1
0
int renderTileCairo(imageObj *img, imageObj *tile, double x, double y) {
    cairo_renderer *r = CAIRO_RENDERER(img);
    cairo_surface_t *im = CAIRO_RENDERER(tile)->surface;
    int w = cairo_image_surface_get_width (im);
    int h = cairo_image_surface_get_height (im);
    cairo_save(r->cr);
    cairo_translate(r->cr, MS_NINT(x-0.5 * w), MS_NINT(y -0.5 * h));
    cairo_set_source_surface(r->cr, im, 0, 0);
    cairo_pattern_set_filter (cairo_get_source (r->cr), CAIRO_FILTER_NEAREST);
    cairo_paint(r->cr);
    cairo_restore(r->cr);
    return MS_SUCCESS;
}
Example #2
0
int mergeRasterBufferCairo(imageObj *img, rasterBufferObj *rb, double opacity,
                           int srcX, int srcY, int dstX, int dstY,
                           int width, int height)
{
  cairo_surface_t *src;
  cairo_renderer *r;
  /* not implemented for src,dst,width and height */
  if(rb->type != MS_BUFFER_BYTE_RGBA) {
    return MS_FAILURE;
  }
  r = CAIRO_RENDERER(img);

  src = cairo_image_surface_create_for_data(rb->data.rgba.pixels,CAIRO_FORMAT_ARGB32,
        rb->width,rb->height,
        rb->data.rgba.row_step);

  if(dstX||dstY||srcX||srcY||width!=img->width||height!=img->height) {
    cairo_set_source_surface (r->cr, src, dstX - srcX, dstY - srcY);
    cairo_rectangle (r->cr, dstX, dstY, width, height);
    cairo_fill (r->cr);
  } else {
    cairo_set_source_surface (r->cr,src,0,0);
    cairo_paint_with_alpha(r->cr,opacity);
  }
  cairo_surface_finish(src);
  cairo_surface_destroy(src);
  return MS_SUCCESS;
}
Example #3
0
int renderPixmapSymbolCairo(imageObj *img, double x, double y,symbolObj *symbol,
                            symbolStyleObj *style)
{
  cairo_renderer *r = CAIRO_RENDERER(img);
  cairo_surface_t *im;
  rasterBufferObj *b = symbol->pixmap_buffer;
  assert(b);
  if(!symbol->renderer_cache) {
    symbol->renderer_cache = (void*)createSurfaceFromBuffer(b);
  }
  assert(symbol->renderer_cache);
  im=(cairo_surface_t*)symbol->renderer_cache;
  cairo_save(r->cr);
  if(style->rotation != 0 || style->scale != 1) {
    cairo_translate (r->cr, x,y);
    cairo_rotate (r->cr, -style->rotation);
    cairo_scale  (r->cr, style->scale,style->scale);
    cairo_translate (r->cr, -0.5*b->width, -0.5*b->height);
  } else {
    cairo_translate (r->cr, MS_NINT(x-0.5*b->width),MS_NINT(y-0.5*b->height));
  }
  cairo_set_source_surface (r->cr, im, 0, 0);
  cairo_paint (r->cr);
  cairo_restore(r->cr);
  return MS_SUCCESS;
}
Example #4
0
int renderEllipseSymbolCairo(imageObj *img, double x, double y, symbolObj *symbol,
                             symbolStyleObj *style)
{
  cairo_renderer *r = CAIRO_RENDERER(img);

  cairo_save(r->cr);
  cairo_set_line_cap(r->cr, CAIRO_LINE_CAP_BUTT);
  cairo_set_line_join(r->cr, CAIRO_LINE_JOIN_MITER);
  cairo_translate(r->cr,x,y);
  cairo_rotate(r->cr,-style->rotation);
  cairo_scale(r->cr,symbol->sizex*style->scale/2,symbol->sizey*style->scale/2);
  cairo_arc (r->cr, 0,0,1, 0, 2 * MS_PI);
  cairo_restore(r->cr);
  if(style->color) {
    msCairoSetSourceColor(r->cr, style->color);
    cairo_fill_preserve(r->cr);
  }
  if(style->outlinewidth > 0) {
    cairo_set_line_width (r->cr, style->outlinewidth);
    msCairoSetSourceColor(r->cr, style->outlinecolor);
    cairo_stroke_preserve(r->cr);
  }
  cairo_new_path(r->cr);
  return MS_SUCCESS;
}
Example #5
0
int renderLineCairo(imageObj *img, shapeObj *p, strokeStyleObj *stroke) {
    int i,j;
    cairo_renderer *r = CAIRO_RENDERER(img);
    assert(stroke->color);
    cairo_new_path(r->cr);
    msCairoSetSourceColor(r->cr,stroke->color);
    for(i=0;i<p->numlines;i++) {
        lineObj *l = &(p->line[i]);
        cairo_move_to(r->cr,l->point[0].x,l->point[0].y);
        for(j=1;j<l->numpoints;j++) {
            cairo_line_to(r->cr,l->point[j].x,l->point[j].y);
        }
    }
    if(stroke->patternlength>0) {
        cairo_set_dash(r->cr,stroke->pattern,stroke->patternlength,0);
    }
    switch(stroke->linecap) {
        case MS_CJC_BUTT:
            cairo_set_line_cap(r->cr,CAIRO_LINE_CAP_BUTT);
            break;
        case MS_CJC_SQUARE:
            cairo_set_line_cap(r->cr,CAIRO_LINE_CAP_SQUARE);
            break;
        case MS_CJC_ROUND:
        case MS_CJC_NONE:
        default:
            cairo_set_line_cap(r->cr,CAIRO_LINE_CAP_ROUND);
    }
    cairo_set_line_width (r->cr, stroke->width);
    cairo_stroke (r->cr);
    if(stroke->patternlength>0) {
        cairo_set_dash(r->cr,stroke->pattern,0,0);
    }
    return MS_SUCCESS;
}
Example #6
0
int renderSVGSymbolCairo(imageObj *img, double x, double y, symbolObj *symbol,
                         symbolStyleObj *style)
{
#ifdef USE_SVG_CAIRO
    cairo_renderer *r = CAIRO_RENDERER(img);
    //double ox=symbol->sizex*0.5,oy=symbol->sizey*0.5;

    svg_cairo_status_t status;
    struct svg_symbol_cache *cache;

    msPreloadSVGSymbol(symbol);
    assert(symbol->renderer_cache);
    cache = symbol->renderer_cache;

    cairo_save(r->cr);
    cairo_translate(r->cr,x,y);
    cairo_scale(r->cr,style->scale,style->scale);

    if (style->rotation != 0) {
        cairo_rotate(r->cr, -style->rotation);
        cairo_translate (r->cr, -(int)(symbol->sizex/2), -(int)(symbol->sizey/2));
    } else
        cairo_translate (r->cr, -(int)(symbol->sizex/2), -(int)(symbol->sizey/2));

    status = svg_cairo_render(cache->svgc, r->cr);
    cairo_restore(r->cr);
    return MS_SUCCESS;

#else
    msSetError(MS_MISCERR, "SVG Symbols requested but is not built with libsvgcairo",
               "renderSVGSymbolCairo()");
    return MS_FAILURE;
#endif
}
Example #7
0
int startLayerVectorCairo(imageObj *img, mapObj *map, layerObj *layer)
{
  if(layer->compositer && layer->compositer->opacity<100) {
    cairo_renderer *r = CAIRO_RENDERER(img);
    cairo_push_group (r->cr);
  }
  return MS_SUCCESS;
}
int renderTruetypeSymbolCairo(imageObj *img, double x, double y, symbolObj *symbol,
                              symbolStyleObj *s)
{
  int unicode;
  cairo_glyph_t glyph;
  cairo_text_extents_t extents;

  cairo_matrix_t trans;
  double ox,oy;
  cairoCacheData *cache = MS_IMAGE_RENDERER_CACHE(img);
  cairo_renderer *r = CAIRO_RENDERER(img);
  faceCacheObj *face = getFontFace(cache,symbol->full_font_path);

  if(!face) return MS_FAILURE;

  cairo_save(r->cr);
  cairo_set_font_face(r->cr,face->face);
  cairo_set_font_size(r->cr,s->scale*96/72.0);


  msUTF8ToUniChar(symbol->character, &unicode);

  if (face->ftface->charmap &&
    face->ftface->charmap->encoding == FT_ENCODING_MS_SYMBOL)
    unicode |= 0xf000;

  glyph.index = FT_Get_Char_Index(face->ftface, unicode);
  glyph.x=0;
  glyph.y=0;
  cairo_glyph_extents(r->cr,&glyph,1,&extents);
  ox=extents.x_bearing+extents.width/2.;
  oy=extents.y_bearing+extents.height/2.;



  cairo_matrix_init_rotate(&trans,-s->rotation);

  cairo_matrix_transform_point(&trans,&ox,&oy);
  /* cairo_translate(cr,-extents.width/2,-extents.height/2); */

  cairo_translate(r->cr,x-ox,y-oy);
  cairo_rotate(r->cr, -s->rotation);

  cairo_glyph_path(r->cr,&glyph,1);

  if (s->outlinewidth) {
    msCairoSetSourceColor(r->cr, s->outlinecolor);
    cairo_set_line_width(r->cr, s->outlinewidth + 1);
    cairo_stroke_preserve(r->cr);
  }
  if(s->color) {
    msCairoSetSourceColor(r->cr, s->color);
    cairo_fill_preserve(r->cr);
  }
  cairo_new_path(r->cr);
  cairo_restore(r->cr);
  return MS_SUCCESS;
}
Example #9
0
int renderSVGSymbolCairo(imageObj *img, double x, double y, symbolObj *symbol,
                         symbolStyleObj *style) {
#ifdef USE_SVG_CAIRO
    cairo_renderer *r = CAIRO_RENDERER(img);
    //double ox=symbol->sizex*0.5,oy=symbol->sizey*0.5;

    unsigned int svg_width, svg_height;
    svg_cairo_status_t status;
    svg_cairo_t *svgc;
    double scale;

    //use cache for svg surface
    if(!symbol->renderer_cache) {
        status = svg_cairo_create(&svgc);
        status = svg_cairo_parse_buffer(svgc, symbol->svg_text, strlen(symbol->svg_text));
        if (status) {
            msSetError(MS_RENDERERERR, "problem creating cairo svg", "renderSVGSymbolCairo()");
            return MS_FAILURE;
        }
        symbol->renderer_cache = svgc;
    }
    assert(symbol->renderer_cache);
    svgc=(svg_cairo_t *)symbol->renderer_cache;

    svg_cairo_get_size (svgc, &svg_width, &svg_height);

    //scale such that the SVG is rendered at the desired size in pixels
    scale = style->scale;
    /*
    if (style->scale != 1) {
        scale = MS_MIN(style->scale / (double) svg_width,
                   style->scale / (double) svg_height);
    } else {
        scale = style->scale;
    }
    */

    cairo_save(r->cr);
    cairo_translate(r->cr,x,y);
    cairo_scale(r->cr,scale,scale);

    if (style->rotation != 0) {
        cairo_rotate(r->cr, -style->rotation);
        cairo_translate (r->cr, -(int)svg_width/2, -(int)svg_height/2);
    }
    else
        cairo_translate (r->cr, -(int)svg_width/2, -(int)svg_height/2);

    status = svg_cairo_render(svgc, r->cr);
    cairo_restore(r->cr);
    return MS_SUCCESS;

#else
    msSetError(MS_MISCERR, "SVG Symbols requested but is not built with libsvgcairo",
               "renderSVGSymbolCairo()");
    return MS_FAILURE;
#endif
}
Example #10
0
int closeLayerVectorCairo(imageObj *img, mapObj *map, layerObj *layer)
{
  if(layer->compositer && layer->compositer->opacity<100) {
    cairo_renderer *r = CAIRO_RENDERER(img);
    cairo_pop_group_to_source (r->cr);
    cairo_paint_with_alpha (r->cr, layer->compositer->opacity*0.01);
  }
  return MS_SUCCESS;
}
Example #11
0
int saveImageCairo(imageObj *img, FILE *fp, outputFormatObj *format) {
    cairo_renderer *r = CAIRO_RENDERER(img);
    if(!strcasecmp(img->format->driver,"cairo/pdf") || !strcasecmp(img->format->driver,"cairo/svg")) {
        cairo_surface_finish (r->surface);
        fwrite(r->outputStream->data,r->outputStream->size,1,fp);
    } else {
        // not supported
    }
    return MS_SUCCESS;
}
Example #12
0
int renderPolygonTiledCairo(imageObj *img, shapeObj *p,  imageObj *tile) {
    int i,j;
    cairo_renderer *r = CAIRO_RENDERER(img);
    cairo_renderer *tileRenderer = CAIRO_RENDERER(tile);
    cairo_pattern_t *pattern = cairo_pattern_create_for_surface(tileRenderer->surface);
    cairo_pattern_set_extend(pattern, CAIRO_EXTEND_REPEAT);
    
    cairo_set_source(r->cr, pattern);
    for (i = 0; i < p->numlines; i++) {
      lineObj *l = &(p->line[i]);
      cairo_move_to(r->cr, l->point[0].x, l->point[0].y);
      for (j = 1; j < l->numpoints; j++) {
        cairo_line_to(r->cr, l->point[j].x, l->point[j].y);
      }
      //cairo_close_path(r->cr);
    }
    cairo_fill(r->cr);
    cairo_pattern_destroy(pattern);
    return MS_SUCCESS;
}
Example #13
0
unsigned char* saveImageBufferCairo(imageObj *img, int *size_ptr, outputFormatObj *format)
{
  cairo_renderer *r = CAIRO_RENDERER(img);
  unsigned char *data;
  assert(!strcasecmp(img->format->driver,"cairo/pdf") || !strcasecmp(img->format->driver,"cairo/svg"));
  cairo_surface_finish (r->surface);
  data = msSmallMalloc(r->outputStream->size);
  memcpy(data,r->outputStream->data,r->outputStream->size);
  *size_ptr = (int)r->outputStream->size;
  return data;
}
Example #14
0
static void
cairo_renderer_finalize (PinPointRenderer *pp_renderer)
{
  CairoRenderer *renderer = CAIRO_RENDERER (pp_renderer);

  g_free (renderer->path);
  if (renderer->surface)
    cairo_surface_destroy (renderer->surface);
  g_hash_table_unref (renderer->surfaces);
  g_hash_table_unref (renderer->svgs);
  if (renderer->ctx)
    cairo_destroy (renderer->ctx);
}
Example #15
0
int freeImageCairo(imageObj *img) {
    cairo_renderer *r = CAIRO_RENDERER(img);
    if(r) {
        cairo_destroy(r->cr);
        cairo_surface_finish(r->surface);
        cairo_surface_destroy(r->surface);
        if(r->outputStream) {
            msBufferFree(r->outputStream);
            free(r->outputStream);
        }
        free(r);
    }
    return MS_SUCCESS;
}
Example #16
0
int saveImageCairo(imageObj *img, mapObj *map, FILE *fp, outputFormatObj *format) {
    cairo_renderer *r = CAIRO_RENDERER(img);
    if(!strcasecmp(img->format->driver,"cairo/pdf") || !strcasecmp(img->format->driver,"cairo/svg")) {
        cairo_surface_finish (r->surface);

        if (map != NULL && !strcasecmp(img->format->driver,"cairo/pdf"))
            msTransformToGeospatialPDF(img, map, r);

        fwrite(r->outputStream->data,r->outputStream->size,1,fp);
    } else {
        /* not supported */
    }
    return MS_SUCCESS;
}
Example #17
0
static void
cairo_renderer_run (PinPointRenderer *pp_renderer)
{
  CairoRenderer *renderer = CAIRO_RENDERER (pp_renderer);
  GList         *cur;

  for (cur = pp_slides; cur; cur = g_list_next (cur))
    {
      PinPointPoint *point = cur->data;

      cairo_renderer_render_page (renderer, point);
      if (point->speaker_notes)
        cairo_render_speaker_notes (renderer, point);
    }
}
Example #18
0
int renderPolygonCairo(imageObj *img, shapeObj *p, colorObj *c) {
    cairo_renderer *r = CAIRO_RENDERER(img);
    int i,j;
    cairo_new_path(r->cr);
    cairo_set_fill_rule(r->cr,CAIRO_FILL_RULE_EVEN_ODD);
    msCairoSetSourceColor(r->cr,c);
    for(i=0;i<p->numlines;i++) {
        lineObj *l = &(p->line[i]);
        cairo_move_to(r->cr,l->point[0].x,l->point[0].y);
        for(j=1;j<l->numpoints;j++) {
            cairo_line_to(r->cr,l->point[j].x,l->point[j].y);
        }
        cairo_close_path(r->cr);
    }
    cairo_fill(r->cr);
    return MS_SUCCESS;
}
Example #19
0
int getRasterBufferHandleCairo(imageObj *img, rasterBufferObj *rb) {
  unsigned char *pb;
    cairo_renderer *r = CAIRO_RENDERER(img);
    rb->type = MS_BUFFER_BYTE_RGBA;
    pb = cairo_image_surface_get_data(r->surface);
    rb->data.rgba.pixels = pb;
    rb->data.rgba.row_step = cairo_image_surface_get_stride(r->surface);
    rb->data.rgba.pixel_step=4;
    rb->width = cairo_image_surface_get_width(r->surface);
    rb->height = cairo_image_surface_get_height(r->surface);
    rb->data.rgba.r = &(pb[2]);
    rb->data.rgba.g = &(pb[1]);
    rb->data.rgba.b = &(pb[0]);
    if(r->use_alpha)
       rb->data.rgba.a = &(pb[3]);
    else
       rb->data.rgba.a = NULL;
    return MS_SUCCESS;
}
Example #20
0
int renderGlyphs2Cairo(imageObj *img, textPathObj *tp, colorObj *c, colorObj *oc, int ow) {
  cairo_renderer *r = CAIRO_RENDERER(img);
  cairoCacheData *cache = MS_IMAGE_RENDERER_CACHE(img);
  cairoFaceCache *cairo_face = NULL;
  FT_Face prevface = NULL;
  int g;

  cairo_set_font_size(r->cr,MS_NINT(tp->glyph_size * 96.0/72.0));
  for(g=0;g<tp->numglyphs;g++) {
    glyphObj *gl = &tp->glyphs[g];
    cairo_glyph_t glyph;
    /* load the glyph's face into cairo, if not already present */
    if(gl->face->face != prevface) {
      cairo_face = getCairoFontFace(cache,gl->face->face);
      cairo_set_font_face(r->cr, cairo_face->face);
      cairo_set_font_options(r->cr,cairo_face->options);
      prevface = gl->face->face;
      cairo_set_font_size(r->cr,MS_NINT(tp->glyph_size * 96.0/72.0));
    }
    cairo_save(r->cr);
    cairo_translate(r->cr,gl->pnt.x,gl->pnt.y);
    if(gl->rot != 0.0)
      cairo_rotate(r->cr, -gl->rot);
    glyph.x = glyph.y = 0;
    glyph.index = gl->glyph->key.codepoint;
    cairo_glyph_path(r->cr,&glyph,1);
    cairo_restore(r->cr);
  }
  if (oc) {
    cairo_save(r->cr);
    msCairoSetSourceColor(r->cr, oc);
    cairo_set_line_width(r->cr, ow + 1);
    cairo_stroke_preserve(r->cr);
    cairo_restore(r->cr);
  }
  if(c) {
    msCairoSetSourceColor(r->cr, c);
    cairo_fill(r->cr);
  }
  cairo_new_path(r->cr);
  return MS_SUCCESS;
}
Example #21
0
int cairoCompositeRasterBuffer(imageObj *img, rasterBufferObj *rb, CompositingOperation comp, int opacity) {
  cairo_surface_t *src;
  cairo_renderer *r;
  if(rb->type != MS_BUFFER_BYTE_RGBA) {
    return MS_FAILURE;
  }
  r = CAIRO_RENDERER(img);

  src = cairo_image_surface_create_for_data(rb->data.rgba.pixels,CAIRO_FORMAT_ARGB32,
        rb->width,rb->height,
        rb->data.rgba.row_step);

  cairo_set_source_surface (r->cr,src,0,0);
  cairo_set_operator(r->cr, ms2cairo_compop(comp));
  cairo_paint_with_alpha(r->cr,opacity/100.0);
  cairo_surface_finish(src);
  cairo_surface_destroy(src);
  cairo_set_operator(r->cr,CAIRO_OPERATOR_OVER);
  return MS_SUCCESS;
}
Example #22
0
static void
cairo_renderer_init (PinPointRenderer *pp_renderer,
                     char             *pinpoint_file)
{
  CairoRenderer *renderer = CAIRO_RENDERER (pp_renderer);

  /* A4, landscape */
  renderer->width = A4_LS_WIDTH;
  renderer->height = A4_LS_HEIGHT;
  renderer->surface = cairo_pdf_surface_create (pp_output_filename,
                                                renderer->width, renderer->height);
  renderer->path = g_strdup (pinpoint_file);

  renderer->ctx = cairo_create (renderer->surface);
  renderer->surfaces = g_hash_table_new_full (g_str_hash, g_str_equal,
                                              g_free, _destroy_surface);
  renderer->svgs = g_hash_table_new_full (g_str_hash, g_str_equal,
                                          NULL,
                                          g_object_unref);
}
Example #23
0
void
cairo_renderer_set_cr (PinPointRenderer *pp_renderer,
                       cairo_t          *ctx,
                       float             width,
                       float             height)
{
  CairoRenderer *renderer = CAIRO_RENDERER (pp_renderer);
  if (renderer->ctx)
    {
      if (renderer->surface)
        {
          cairo_surface_destroy (renderer->surface);
          renderer->surface = NULL;
        }
      cairo_destroy (renderer->ctx);
      renderer->ctx = NULL;
    }
  renderer->ctx = ctx;
  renderer->width = width;
  renderer->height = height;
}
Example #24
0
int renderVectorSymbolCairo(imageObj *img, double x, double y, symbolObj *symbol,
                            symbolStyleObj *style)
{
  cairo_renderer *r = CAIRO_RENDERER(img);
  double ox=symbol->sizex*0.5,oy=symbol->sizey*0.5;
  int is_new = 1,i;
  cairo_new_path(r->cr);
  cairo_save(r->cr);
  cairo_translate(r->cr,x,y);
  cairo_scale(r->cr,style->scale,style->scale);
  cairo_rotate(r->cr,-style->rotation);
  cairo_translate(r->cr,-ox,-oy);
  for (i = 0; i < symbol->numpoints; i++) {
    if ((symbol->points[i].x == -99) && (symbol->points[i].y == -99)) { /* (PENUP) */
      is_new = 1;
    } else {
      if (is_new) {
        cairo_move_to(r->cr,symbol->points[i].x,symbol->points[i].y);
        is_new = 0;
      } else {
        cairo_line_to(r->cr,symbol->points[i].x,symbol->points[i].y);
      }
    }
  }
  cairo_restore(r->cr);
  if(style->color) {
    msCairoSetSourceColor(r->cr,style->color);
    cairo_fill_preserve(r->cr);
  }
  if(style->outlinewidth>0) {
    msCairoSetSourceColor(r->cr,style->outlinecolor);
    cairo_set_line_width (r->cr, style->outlinewidth);
    cairo_stroke_preserve(r->cr);
  }
  cairo_new_path(r->cr);
  return MS_SUCCESS;
}
Example #25
0
int renderGlyphsCairo(imageObj *img,double x, double y, labelStyleObj *style, char *text) {
    cairo_renderer *r = CAIRO_RENDERER(img);
    cairoCacheData *cache = MS_IMAGE_RENDERER_CACHE(img);
    faceCacheObj *face = getFontFace(cache,style->font);

    char *utfptr=text;
    int i,has_kerning,unicode;
    unsigned long previdx=0;
    int numglyphs = msGetNumGlyphs(text);
    cairo_glyph_t glyph;
    cairo_text_extents_t extents;
    double px=0,py=0;

    if(face == NULL) {
        return MS_FAILURE;
    }

    cairo_set_font_face(r->cr,face->face);
    cairo_set_font_size(r->cr,style->size*96/72.0);

    cairo_save(r->cr);
    cairo_translate(r->cr,MS_NINT(x),MS_NINT(y));
    if(style->rotation != 0.0)
       cairo_rotate(r->cr, -style->rotation);

    has_kerning = FT_HAS_KERNING((face->ftface));
    for(i=0;i<numglyphs;i++) {
        utfptr+=msUTF8ToUniChar(utfptr, &unicode);
        glyph.x=px;
        glyph.y=py;
        if(unicode=='\n') {
            py += ceil(style->size*CAIROLINESPACE);
            px = 0;
            previdx=0;
            continue;
        }
        glyph.index = FT_Get_Char_Index(face->ftface, unicode);
        if( has_kerning && previdx ) {
            FT_Vector delta;
            FT_Get_Kerning( face->ftface, previdx, glyph.index, FT_KERNING_DEFAULT, &delta );
            px += delta.x / 64.;
        }
        cairo_glyph_extents(r->cr,&glyph,1,&extents);
        cairo_glyph_path(r->cr,&glyph,1);
        px += extents.x_advance;
        previdx=glyph.index;
    }

    if (style->outlinewidth > 0) {
        cairo_save(r->cr);
        msCairoSetSourceColor(r->cr, style->outlinecolor);
        cairo_set_line_width(r->cr, style->outlinewidth + 1);
        cairo_stroke_preserve(r->cr);
        cairo_restore(r->cr);
    }
    if(style->color) {
        msCairoSetSourceColor(r->cr, style->color);
        cairo_fill(r->cr);
    }
    cairo_new_path(r->cr);
    cairo_restore(r->cr);
    return MS_SUCCESS;
}
Example #26
0
void
cairo_renderer_unset_cr (PinPointRenderer *pp_renderer)
{
  CairoRenderer *renderer = CAIRO_RENDERER (pp_renderer);
  renderer->ctx = NULL;
}
Example #27
0
int startLayerVectorCairo(imageObj *img, mapObj *map, layerObj *layer) {
   cairo_renderer *r = CAIRO_RENDERER(img);
   cairo_push_group (r->cr);
   return MS_SUCCESS;
}