当前位置: 首页>>代码示例>>C++>>正文


C++ cairo_surface_finish函数代码示例

本文整理汇总了C++中cairo_surface_finish函数的典型用法代码示例。如果您正苦于以下问题:C++ cairo_surface_finish函数的具体用法?C++ cairo_surface_finish怎么用?C++ cairo_surface_finish使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了cairo_surface_finish函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: _cairo_paginated_surface_finish

static cairo_status_t
_cairo_paginated_surface_finish (void *abstract_surface)
{
    cairo_paginated_surface_t *surface = abstract_surface;
    cairo_status_t status = CAIRO_STATUS_SUCCESS;

    if (! surface->base.is_clear || surface->page_num == 1) {
	/* Bypass some of the sanity checking in cairo-surface.c, as we
	 * know that the surface is finished...
	 */
	status = (cairo_status_t)_cairo_paginated_surface_show_page (surface);
    }

     /* XXX We want to propagate any errors from destroy(), but those are not
      * returned via the api. So we need to explicitly finish the target,
      * and check the status afterwards. However, we can only call finish()
      * on the target, if we own it.
      */
    if (CAIRO_REFERENCE_COUNT_GET_VALUE (&surface->target->ref_count) == 1)
	cairo_surface_finish (surface->target);
    if (status == CAIRO_STATUS_SUCCESS)
	status = cairo_surface_status (surface->target);
    cairo_surface_destroy (surface->target);

    cairo_surface_finish (surface->recording_surface);
    if (status == CAIRO_STATUS_SUCCESS)
	status = cairo_surface_status (surface->recording_surface);
    cairo_surface_destroy (surface->recording_surface);

    return status;
}
开发者ID:Happy-Ferret,项目名称:webkit.js,代码行数:31,代码来源:cairo-paginated-surface.c

示例2: _cairo_paginated_surface_finish

static cairo_status_t
_cairo_paginated_surface_finish (void *abstract_surface)
{
    cairo_paginated_surface_t *surface = abstract_surface;
    cairo_status_t status = CAIRO_STATUS_SUCCESS;

    if (surface->page_is_blank == FALSE || surface->page_num == 1) {
	cairo_surface_show_page (abstract_surface);
	status = cairo_surface_status (abstract_surface);
    }

    if (status == CAIRO_STATUS_SUCCESS) {
	cairo_surface_finish (surface->target);
	status = cairo_surface_status (surface->target);
    }

    if (status == CAIRO_STATUS_SUCCESS) {
	cairo_surface_finish (surface->meta);
	status = cairo_surface_status (surface->meta);
    }

    cairo_surface_destroy (surface->target);

    cairo_surface_destroy (surface->meta);

    return status;
}
开发者ID:jwmcglynn,项目名称:Gadgets,代码行数:27,代码来源:cairo-paginated-surface.c

示例3: draw

static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
    const cairo_test_context_t *ctx = cairo_test_get_context (cr);
    cairo_surface_t *surface;
    cairo_status_t status;

    surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 1, 1);

    cairo_surface_finish (surface);
    status = cairo_surface_status (surface);
    if (status != CAIRO_STATUS_SUCCESS)
	return cairo_test_status_from_status (ctx, status);

    cairo_surface_finish (surface);
    status = cairo_surface_status (surface);
    if (status != CAIRO_STATUS_SUCCESS)
	return cairo_test_status_from_status (ctx, status);

    cairo_surface_finish (surface);
    status = cairo_surface_status (surface);
    if (status != CAIRO_STATUS_SUCCESS)
	return cairo_test_status_from_status (ctx, status);

    cairo_surface_destroy (surface);

    return CAIRO_TEST_SUCCESS;
}
开发者ID:499940913,项目名称:moon,代码行数:28,代码来源:surface-finish-twice.c

示例4: draw

static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
    cairo_surface_t *surface;
    uint32_t colors[4] = {
	0xffffffff, 0xffff0000,
	0xff00ff00, 0xff0000ff
    };
    int i;

    for (i=0; i < 4; i++) {
	surface = cairo_image_surface_create_for_data ((unsigned char *) &colors[i],
						       CAIRO_FORMAT_RGB24,
						       1, 1, 4);
	cairo_save (cr);
	{
	    cairo_translate (cr, i % 2, i / 2);
	    cairo_set_source_surface (cr, surface, 0, 0);
	    cairo_paint (cr);
	}
	cairo_restore (cr);
	cairo_surface_finish (surface); /* colors will go out of scope */
	cairo_surface_destroy (surface);
    }

    return CAIRO_TEST_SUCCESS;
}
开发者ID:499940913,项目名称:moon,代码行数:27,代码来源:translate-show-surface.c

示例5: _cairo_qt_surface_unmap_image

static cairo_int_status_t
_cairo_qt_surface_unmap_image (void *abstract_surface,
			       cairo_image_surface_t *image)
{
    cairo_qt_surface_t *qs = (cairo_qt_surface_t *) abstract_surface;

    D(fprintf(stderr, "q[%p] release_dest_image\n", abstract_surface));

    if (!qs->image_equiv) {
	struct _qimage_surface  *qimage = (struct _qimage_surface  *)image;

        // XXX should I be using setBackgroundMode here instead of setCompositionMode?
        if (qs->supports_porter_duff)
            qs->p->setCompositionMode (QPainter::CompositionMode_Source);

        qs->p->drawImage ((int)qimage->image.base.device_transform.x0,
			  (int)qimage->image.base.device_transform.y0,
			  *qimage->qimg,
			  (int)qimage->image.base.device_transform.x0,
			  (int)qimage->image.base.device_transform.y0,
			  (int)qimage->image.width,
			  (int)qimage->image.height);

        if (qs->supports_porter_duff)
            qs->p->setCompositionMode (QPainter::CompositionMode_SourceOver);

	delete qimage->qimg;
    }

    cairo_surface_finish (&image->base);
    cairo_surface_destroy (&image->base);

    return CAIRO_INT_STATUS_SUCCESS;
}
开发者ID:AZed,项目名称:cairo,代码行数:34,代码来源:cairo-qt-surface.cpp

示例6: portal_end_run

static void
portal_end_run (GtkPrintOperation *op,
                gboolean           wait,
                gboolean           cancelled)
{
  GtkPrintOperationPortal *op_portal = op->priv->platform_data;

  cairo_surface_finish (op_portal->surface);

  if (cancelled)
    return;

  if (wait)
    op_portal->loop = g_main_loop_new (NULL, FALSE);

  /* TODO: Check for error */
  if (op_portal->job != NULL)
    {
      g_object_ref (op);
      gtk_print_job_send (op_portal->job, portal_job_complete, op, NULL);
    }

  if (wait)
    {
      g_object_ref (op);
      if (!op_portal->file_written)
        {
          gdk_threads_leave ();
          g_main_loop_run (op_portal->loop);
          gdk_threads_enter ();
        }
      g_object_unref (op);
    }
}
开发者ID:TingPing,项目名称:gtk,代码行数:34,代码来源:gtkprintoperation-portal.c

示例7: clutter_cairo_texture_surface_resize_internal

static inline void
clutter_cairo_texture_surface_resize_internal (ClutterCairoTexture *cairo)
{
  ClutterCairoTexturePrivate *priv = cairo->priv;

  if (priv->cr_surface != NULL)
    {
      cairo_surface_t *surface = priv->cr_surface;

      /* if the surface is an image one, and the size is already the
       * same, then we don't need to do anything
       */
      if (cairo_surface_get_type (surface) != CAIRO_SURFACE_TYPE_IMAGE)
        {
          gint surface_width = cairo_image_surface_get_width (surface);
          gint surface_height = cairo_image_surface_get_height (surface);

          if (priv->width == surface_width &&
              priv->height == surface_height)
            return;
        }

      cairo_surface_finish (surface);
      cairo_surface_destroy (surface);
      priv->cr_surface = NULL;
    }

  if (priv->width == 0 || priv->height == 0)
    return;

  g_signal_emit (cairo, cairo_signals[CREATE_SURFACE], 0,
                 priv->width,
                 priv->height,
                 &priv->cr_surface);
}
开发者ID:spatulasnout,项目名称:clutter,代码行数:35,代码来源:clutter-cairo-texture.c

示例8: _cairo_xcb_surface_finish

static cairo_status_t
_cairo_xcb_surface_finish (void *abstract_surface)
{
    cairo_xcb_surface_t *surface = abstract_surface;
    cairo_status_t status;

    if (surface->fallback != NULL) {
	cairo_surface_finish (&surface->fallback->base);
	cairo_surface_destroy (&surface->fallback->base);
    }
    _cairo_boxes_fini (&surface->fallback_damage);

    cairo_list_del (&surface->link);

    status = _cairo_xcb_connection_acquire (surface->connection);
    if (status == CAIRO_STATUS_SUCCESS) {
	if (surface->picture != XCB_NONE) {
	    _cairo_xcb_connection_render_free_picture (surface->connection,
						       surface->picture);
	}

	if (surface->owns_pixmap)
	    _cairo_xcb_connection_free_pixmap (surface->connection, surface->drawable);
	_cairo_xcb_connection_release (surface->connection);
    }

    _cairo_xcb_connection_destroy (surface->connection);

    return status;
}
开发者ID:mrobinson,项目名称:cairo,代码行数:30,代码来源:cairo-xcb-surface.c

示例9: _cairo_boilerplate_xcb_cleanup

static void
_cairo_boilerplate_xcb_cleanup (void *closure)
{
    xcb_target_closure_t *xtc = closure;
    cairo_status_t status;

    cairo_surface_finish (xtc->surface);
    if (xtc->is_pixmap)
	xcb_free_pixmap (xtc->c, xtc->drawable);
    else
	xcb_destroy_window (xtc->c, xtc->drawable);
    cairo_surface_destroy (xtc->surface);

    cairo_device_finish (xtc->device);
    cairo_device_destroy (xtc->device);

    /* First synchronize with the X server to make sure there are no more errors
     * in-flight which we would miss otherwise */
    _cairo_boilerplate_xcb_sync_server (xtc);
    status = _cairo_boilerplate_xcb_handle_errors (xtc);
    assert (status == CAIRO_STATUS_SUCCESS);

    xcb_disconnect (xtc->c);

    free (xtc);
}
开发者ID:GuoCheng111,项目名称:WinCairoRequirements,代码行数:26,代码来源:cairo-boilerplate-xcb.c

示例10: export_pdf

static void
export_pdf (void)
{
  cairo_surface_t *surface;
  cairo_rectangle_t extents;
  cairo_matrix_t mtx;
  cairo_t *cr;
  GList *iter;

  /* Create a surface. To begin with, we don't know the size. */
  surface = cairo_pdf_surface_create (settings.outfile, 1, 1);
  cr = cairo_create (surface);
  g_object_set (renderer, "cairo-context", cr, NULL);

  for (iter = geda_list_get_glist (toplevel->pages);
       iter != NULL;
       iter = g_list_next (iter)) {
    PAGE *page = (PAGE *) iter->data;

    export_layout_page (page, &extents, &mtx);
    cairo_pdf_surface_set_size (surface, extents.width, extents.height);
    cairo_set_matrix (cr, &mtx);
    export_draw_page (page);
    cairo_show_page (cr);
  }

  cairo_surface_finish (surface);
  export_cairo_check_error (cairo_surface_status (surface));
}
开发者ID:SayCV,项目名称:geda-gaf,代码行数:29,代码来源:export.c

示例11: export_svg

static void
export_svg ()
{
  cairo_surface_t *surface;
  cairo_rectangle_t extents;
  cairo_matrix_t mtx;
  cairo_t *cr;

  /* Create a surface and run export_layout_page() to figure out
   * the picture extents and set up the cairo transformation
   * matrix.  The surface is created only in order to force
   * eda_renderer_default_get_user_bounds() to behave quietly. */
  surface = cairo_svg_surface_create (settings.outfile, 0, 0);
  cr = cairo_create (surface);
  g_object_set (renderer, "cairo-context", cr, NULL);
  export_layout_page (NULL, &extents, &mtx);
  cairo_destroy (cr);

  /* Now create a new surface with the known extents. */
  surface = cairo_svg_surface_create (settings.outfile,
                                      extents.width,
                                      extents.height);
  cr = cairo_create (surface);
  g_object_set (renderer, "cairo-context", cr, NULL);

  cairo_set_matrix (cr, &mtx);
  export_draw_page (NULL);

  cairo_show_page (cr);
  cairo_surface_finish (surface);
  export_cairo_check_error (cairo_surface_status (surface));
}
开发者ID:SayCV,项目名称:geda-gaf,代码行数:32,代码来源:export.c

示例12: _cairo_win32_display_surface_finish

static cairo_status_t
_cairo_win32_display_surface_finish (void *abstract_surface)
{
    cairo_win32_display_surface_t *surface = abstract_surface;

    if (surface->image && to_image_surface(surface->image)->parent) {
	assert (to_image_surface(surface->image)->parent == &surface->win32.base);
	/* Unhook ourselves first to avoid the double-unref from the image */
	to_image_surface(surface->image)->parent = NULL;
	cairo_surface_finish (surface->image);
	cairo_surface_destroy (surface->image);
    }

    /* If we created the Bitmap and DC, destroy them */
    if (surface->bitmap) {
	SelectObject (surface->win32.dc, surface->saved_dc_bitmap);
	DeleteObject (surface->bitmap);
	DeleteDC (surface->win32.dc);
    }

    _cairo_win32_display_surface_discard_fallback (surface);

    if (surface->initial_clip_rgn)
	DeleteObject (surface->initial_clip_rgn);

    return CAIRO_STATUS_SUCCESS;
}
开发者ID:AlexShiLucky,项目名称:luapower-all,代码行数:27,代码来源:cairo-win32-display-surface.c

示例13: mergeRasterBufferCairo

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;
}
开发者ID:geographika,项目名称:mapserver,代码行数:28,代码来源:mapcairo.c

示例14: drawFrame

// Draw a single frame, do all your drawing/animation from in here.
void drawFrame(buffer *buffer, long frame) {
	cairo_t *cr;

	/* We are just going to attach cairo directly to the buffer in the rsx memory.
	 * If this gets too slow later with blending, we will need to create a buffer
         * on cell then copy the finished result accross.
	 */
	//cairo_surface_t *surface = cairo_image_surface_create_for_data((u8 *) buffer->ptr,
	//	CAIRO_FORMAT_RGB24, buffer->width, buffer->height, buffer->width * 4);
	cairo_surface_t *surface = cairo_image_surface_create_for_data((u8 *) buffer,
		CAIRO_FORMAT_RGB16_565, offWidth, offHeight, offWidth * 2);
	assert(surface != NULL);
	cr = cairo_create(surface);
	assert(cr != NULL);

	// Lets start by clearing everything
	cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); // White
	cairo_paint(cr);

	cairo_set_line_width(cr, 10.0); // 30 pixel wide line
	cairo_set_source_rgb (cr, 1.0, 0.5, 0.0); // Orange

	float angle = (frame % 600) / 100.0; // Rotation animaton, rotate once every 10 seconds.
	cairo_arc(cr, offWidth/2, offHeight/2, offHeight/3, angle*M_PI, (angle-0.3)*M_PI);
	cairo_stroke(cr); // Stroke the arc with our 30px wide orange line

	cairo_destroy(cr); // Realease Surface
	cairo_surface_finish(surface);
	cairo_surface_destroy(surface); // Flush and destroy the cairo surface
}
开发者ID:lousyphreak,项目名称:PSL1GHT,代码行数:31,代码来源:main.c

示例15: drawin_wipe

static void
drawin_wipe(drawin_t *w)
{
    /* The drawin must already be unmapped, else it
     * couldn't be garbage collected -> no unmap needed */
    p_delete(&w->cursor);
    if(w->surface)
    {
        /* Make sure that cairo knows that this surface can't be unused anymore.
         * This is needed since lua could still have a reference to it. */
        cairo_surface_finish(w->surface);
        cairo_surface_destroy(w->surface);
        w->surface = NULL;
    }
    if(w->window)
    {
        /* Activate BMA */
        client_ignore_enterleave_events();
        /* Make sure we don't accidentally kill the systray window */
        drawin_systray_kickout(w);
        xcb_destroy_window(globalconf.connection, w->window);
        /* Deactivate BMA */
        client_restore_enterleave_events();
        w->window = XCB_NONE;
    }
    if(w->pixmap)
    {
        xcb_free_pixmap(globalconf.connection, w->pixmap);
        w->pixmap = XCB_NONE;
    }
}
开发者ID:raedwulf,项目名称:awesome,代码行数:31,代码来源:drawin.c


注:本文中的cairo_surface_finish函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。