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


C++ cairo_matrix_multiply函数代码示例

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


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

示例1: _cairo_type3_glyph_surface_emit_image_pattern

static cairo_status_t
_cairo_type3_glyph_surface_emit_image_pattern (cairo_type3_glyph_surface_t *surface,
					       cairo_image_surface_t       *image,
					       cairo_matrix_t              *pattern_matrix)
{
    cairo_matrix_t mat, upside_down;
    cairo_status_t status;

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

    mat = *pattern_matrix;

    /* Get the pattern space to user space matrix  */
    status = cairo_matrix_invert (&mat);

    /* cairo_pattern_set_matrix ensures the matrix is invertible */
    assert (status == CAIRO_STATUS_SUCCESS);

    /* Make this a pattern space to Type 3 font space matrix */
    cairo_matrix_multiply (&mat, &mat, &surface->cairo_to_pdf);

    /* PDF images are in a 1 unit by 1 unit image space. Turn the 1 by
     * 1 image upside down to convert to flip the Y-axis going from
     * cairo to PDF. Then scale the image up to the required size. */
    cairo_matrix_scale (&mat, image->width, image->height);
    cairo_matrix_init (&upside_down, 1, 0, 0, -1, 0, 1);
    cairo_matrix_multiply (&mat, &upside_down, &mat);

    return _cairo_type3_glyph_surface_emit_image (surface, image, &mat);
}
开发者ID:jwmcglynn,项目名称:Gadgets,代码行数:31,代码来源:cairo-type3-glyph-surface.c

示例2: GdipMultiplyTextureTransform

GpStatus WINGDIPAPI
GdipMultiplyTextureTransform (GpTexture *texture, GpMatrix *matrix, GpMatrixOrder order)
{
	GpStatus status;
	BOOL invertible = FALSE;
	cairo_matrix_t mat;

	if ((texture == NULL) || (matrix == NULL)) {
		return InvalidParameter;
	}

	/* the matrix MUST be invertible to be used */
	status = GdipIsMatrixInvertible ((GpMatrix*) matrix, &invertible);
	if (!invertible || (status != Ok))
		return InvalidParameter;

	if (order == MatrixOrderPrepend)
		cairo_matrix_multiply (&mat, matrix, &texture->matrix);
	else if (order == MatrixOrderAppend)
		cairo_matrix_multiply (&mat, &texture->matrix, matrix);

	gdip_cairo_matrix_copy (&texture->matrix, &mat);
	texture->base.changed = TRUE;
	return status;
}
开发者ID:directhex,项目名称:xamarin-libgdiplus,代码行数:25,代码来源:texturebrush.c

示例3: _cairo_surface_wrapper_get_transform

static void
_cairo_surface_wrapper_get_transform (cairo_surface_wrapper_t *wrapper,
				      cairo_matrix_t *m)
{
    cairo_matrix_init_identity (m);

    if (! _cairo_matrix_is_identity (&wrapper->transform))
	cairo_matrix_multiply (m, &wrapper->transform, m);

    if (! _cairo_matrix_is_identity (&wrapper->target->device_transform))
	cairo_matrix_multiply (m, &wrapper->target->device_transform, m);
}
开发者ID:MiKTeX,项目名称:miktex,代码行数:12,代码来源:cairo-surface-wrapper.c

示例4: _cairo_surface_wrapper_get_transform

static void
_cairo_surface_wrapper_get_transform (cairo_surface_wrapper_t *wrapper,
				      cairo_matrix_t *m)
{
    cairo_matrix_init_identity (m);

    if (wrapper->has_extents && (wrapper->extents.x || wrapper->extents.y))
	cairo_matrix_translate (m, -wrapper->extents.x, -wrapper->extents.y);

    if (! _cairo_matrix_is_identity (&wrapper->transform))
	cairo_matrix_multiply (m, &wrapper->transform, m);

    if (! _cairo_matrix_is_identity (&wrapper->target->device_transform))
	cairo_matrix_multiply (m, &wrapper->target->device_transform, m);
}
开发者ID:igagis,项目名称:cairo,代码行数:15,代码来源:cairo-surface-wrapper.c

示例5: Rect

Rect
Image::GetCoverageBounds ()
{
	// FIXME: SL3 final only supports PixelFormatPbgra32 which makes this optimization
	// obsolete - unless we keep an "has_alpha" flag with each image ?!?
	return Rect ();
#if FALSE
	ImageSource *source = GetSource ();

	if (!source || source->GetPixelFormat () == PixelFormatPbgra32)
		return Rect ();

	Stretch stretch = GetStretch ();
	if (stretch == StretchFill || stretch == StretchUniformToFill)
		return bounds;

	cairo_matrix_t matrix;
	Rect image = Rect (0, 0, source->GetPixelWidth (), source->GetPixelHeight ());
	Rect paint = Rect (0, 0, GetActualWidth (), GetActualHeight ());

	image_brush_compute_pattern_matrix (&matrix, 
					    paint.width, paint.height,
					    image.width, image.height, stretch, 
					    AlignmentXCenter, AlignmentYCenter, NULL, NULL);

	cairo_matrix_invert (&matrix);
	cairo_matrix_multiply (&matrix, &matrix, &absolute_xform);

	image = image.Transform (&matrix);
	image = image.Intersection (bounds);
	
	return image;
#endif
}
开发者ID:snorp,项目名称:moon,代码行数:34,代码来源:media.cpp

示例6: m_update_transform_matrix

static int m_update_transform_matrix(lua_State * L)
{
	struct lobject_t * obj1 = luaL_checkudata(L, 1, MT_OBJECT);
	struct lobject_t * obj2 = luaL_checkudata(L, 2, MT_OBJECT);
	cairo_matrix_multiply(&obj1->__transform_matrix, &obj1->__transform_matrix, __get_obj_matrix(obj2));
	return 0;
}
开发者ID:IngenicC,项目名称:xboot,代码行数:7,代码来源:l-object.c

示例7: clutter_input_device_evdev_set_property

static void
clutter_input_device_evdev_set_property (GObject      *object,
                                         guint         prop_id,
                                         const GValue *value,
                                         GParamSpec   *pspec)
{
  ClutterInputDeviceEvdev *device = CLUTTER_INPUT_DEVICE_EVDEV (object);

  switch (prop_id)
    {
    case PROP_DEVICE_MATRIX:
      {
        const cairo_matrix_t *matrix = g_value_get_boxed (value);
        cairo_matrix_init_identity (&device->device_matrix);
        cairo_matrix_multiply (&device->device_matrix,
                               &device->device_matrix, matrix);
        break;
      }
    case PROP_OUTPUT_ASPECT_RATIO:
      device->output_ratio = g_value_get_double (value);
      break;
    default:
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
    }
}
开发者ID:GNOME,项目名称:mutter,代码行数:25,代码来源:clutter-input-device-evdev.c

示例8: _cairo_type3_glyph_surface_create

cairo_surface_t *
_cairo_type3_glyph_surface_create (cairo_scaled_font_t	 		 *scaled_font,
				   cairo_output_stream_t 		 *stream,
				   cairo_type3_glyph_surface_emit_image_t emit_image,
				   cairo_scaled_font_subsets_t 		 *font_subsets)
{
    cairo_type3_glyph_surface_t *surface;
    cairo_matrix_t invert_y_axis;

    surface = malloc (sizeof (cairo_type3_glyph_surface_t));
    if (surface == NULL)
	return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));

    _cairo_surface_init (&surface->base, &cairo_type3_glyph_surface_backend,
			 CAIRO_CONTENT_COLOR_ALPHA);

    surface->scaled_font = scaled_font;
    surface->stream = stream;
    surface->emit_image = emit_image;

    /* Setup the transform from the user-font device space to Type 3
     * font space. The Type 3 font space is defined by the FontMatrix
     * entry in the Type 3 dictionary. In the PDF backend this is an
     * identity matrix. */
    surface->cairo_to_pdf = scaled_font->scale_inverse;
    cairo_matrix_init_scale (&invert_y_axis, 1, -1);
    cairo_matrix_multiply (&surface->cairo_to_pdf, &surface->cairo_to_pdf, &invert_y_axis);

    _cairo_pdf_operators_init (&surface->pdf_operators,
			       surface->stream,
			       &surface->cairo_to_pdf,
			       font_subsets);

    return &surface->base;
}
开发者ID:jwmcglynn,项目名称:Gadgets,代码行数:35,代码来源:cairo-type3-glyph-surface.c

示例9: _cairo_type3_glyph_surface_emit_fallback_image

static cairo_status_t
_cairo_type3_glyph_surface_emit_fallback_image (cairo_type3_glyph_surface_t *surface,
						unsigned long		     glyph_index)
{
    cairo_scaled_glyph_t *scaled_glyph;
    cairo_status_t status;
    cairo_image_surface_t *image;
    cairo_matrix_t mat;
    double x, y;

    status = _cairo_scaled_glyph_lookup (surface->scaled_font,
					 glyph_index,
					 CAIRO_SCALED_GLYPH_INFO_METRICS |
					 CAIRO_SCALED_GLYPH_INFO_SURFACE,
					 &scaled_glyph);
    if (status)
	return status;

    image = scaled_glyph->surface;
    if (image->width == 0 || image->height == 0)
	return CAIRO_STATUS_SUCCESS;

    x = _cairo_fixed_to_double (scaled_glyph->bbox.p1.x);
    y = _cairo_fixed_to_double (scaled_glyph->bbox.p2.y);
    mat.xx = image->width;
    mat.xy = 0;
    mat.yx = 0;
    mat.yy = image->height;
    mat.x0 = x;
    mat.y0 = y;
    cairo_matrix_multiply (&mat, &mat, &surface->scaled_font->scale_inverse);
    mat.y0 *= -1;

    return _cairo_type3_glyph_surface_emit_image (surface, image, &mat);
}
开发者ID:jwmcglynn,项目名称:Gadgets,代码行数:35,代码来源:cairo-type3-glyph-surface.c

示例10: matrix_multiply

static PyObject *
matrix_multiply (PycairoMatrix *o, PycairoMatrix *o2)
{
    cairo_matrix_t result;
    cairo_matrix_multiply (&result, &o->matrix, &o2->matrix);
    return PycairoMatrix_FromMatrix (&result);
}
开发者ID:anarcher,项目名称:enso-launcher-continued,代码行数:7,代码来源:pycairo-matrix.c

示例11: cmd_flip_z

static void cmd_flip_z (struct document *doc)
{
	int width = (doc->flags & NO_GENERIC_SCALE) ?
		doc->width : ceil(doc->scale * doc->width);
	int height = (doc->flags & NO_GENERIC_SCALE) ?
		doc->height : ceil(doc->scale * doc->height);

	int dir = (this_command == (KEY_Z | SHIFT)) ? 1 : -1;
	cairo_matrix_t flipz;
	cairo_matrix_init (&flipz, 0, dir, -dir, 0,
			   (dir == 1) ? height : 0,
			   (dir == -1) ? width : 0);

	/* TODO: fix images
	 *   dir = 1          dir = -1
	 *
	 * .y         x	   .y      .┌─y
	 *  │   ->    │	    │   ->  │
	 *  └─x    .y─┘	    └─x     x
	 */
	cairo_matrix_multiply (&doc->transform, &doc->transform, &flipz);

	int tmp = doc->height;
	doc->height = doc->width;
	doc->width = tmp;
}
开发者ID:darcyg,项目名称:fbcanvas,代码行数:26,代码来源:commands.c

示例12: m_font

FontPlatformData::FontPlatformData(GDIObject<HFONT> font, cairo_font_face_t* fontFace, float size, bool bold, bool oblique)
    : m_font(SharedGDIObject<HFONT>::create(WTFMove(font)))
    , m_size(size)
    , m_syntheticOblique(oblique)
{
    cairo_matrix_t fontMatrix;
    cairo_matrix_init_scale(&fontMatrix, size, size);
    cairo_matrix_t ctm;
    cairo_matrix_init_identity(&ctm);
    cairo_font_options_t* options = cairo_font_options_create();

    // We force antialiasing and disable hinting to provide consistent
    // typographic qualities for custom fonts on all platforms.
    cairo_font_options_set_hint_style(options, CAIRO_HINT_STYLE_NONE);
    cairo_font_options_set_antialias(options, CAIRO_ANTIALIAS_BEST);

    if (syntheticOblique()) {
        static const float syntheticObliqueSkew = -tanf(14 * acosf(0) / 90);
        cairo_matrix_t skew = {1, 0, syntheticObliqueSkew, 1, 0, 0};
        cairo_matrix_multiply(&fontMatrix, &skew, &fontMatrix);
    }

    m_scaledFont = adoptRef(cairo_scaled_font_create(fontFace, &fontMatrix, &ctm, options));
    cairo_font_options_destroy(options);
}
开发者ID:eocanha,项目名称:webkit,代码行数:25,代码来源:FontPlatformDataCairoWin.cpp

示例13: _cairo_pdf_operators_set_text_matrix

/* Use 'Tm' operator to set the PDF text matrix. */
static cairo_status_t
_cairo_pdf_operators_set_text_matrix (cairo_pdf_operators_t  *pdf_operators,
				      cairo_matrix_t         *matrix)
{
    cairo_matrix_t inverse;
    cairo_status_t status;

    /* We require the matrix to be invertable. */
    inverse = *matrix;
    status = cairo_matrix_invert (&inverse);
    if (unlikely (status))
	return status;

    pdf_operators->text_matrix = *matrix;
    pdf_operators->cur_x = 0;
    pdf_operators->cur_y = 0;
    pdf_operators->glyph_buf_x_pos = 0;
    _cairo_output_stream_printf (pdf_operators->stream,
				 "%f %f %f %f %f %f Tm\n",
				 pdf_operators->text_matrix.xx,
				 pdf_operators->text_matrix.yx,
				 pdf_operators->text_matrix.xy,
				 pdf_operators->text_matrix.yy,
				 pdf_operators->text_matrix.x0,
				 pdf_operators->text_matrix.y0);

    pdf_operators->cairo_to_pdftext = *matrix;
    status = cairo_matrix_invert (&pdf_operators->cairo_to_pdftext);
    assert (status == CAIRO_STATUS_SUCCESS);
    cairo_matrix_multiply (&pdf_operators->cairo_to_pdftext,
			   &pdf_operators->cairo_to_pdf,
			   &pdf_operators->cairo_to_pdftext);

    return _cairo_output_stream_get_status (pdf_operators->stream);
}
开发者ID:Blueprintts,项目名称:npm-pdf2svg,代码行数:36,代码来源:cairo-pdf-operators.c

示例14: cairo_matrix_multiply

const Matrix& Matrix::operator*=( const Matrix &rhs )
{
	cairo_matrix_t r;
	cairo_matrix_multiply( &r, &getCairoMatrix(), &rhs.getCairoMatrix() );
	init( r.xx, r.yx, r.xy, r.yy, r.x0, r.y0 );
	return *this;
}
开发者ID:Justinmaurer,项目名称:Cinder,代码行数:7,代码来源:Cairo.cpp

示例15: terranova_mirror_rotate

void
terranova_mirror_rotate (cairo_t *cr, double radius, double x, double y,
				boolean mirror_horizontally, boolean mirror_vertically)
{
	cairo_matrix_t matrix_rotate;
	cairo_matrix_t matrix_mirror;
	cairo_matrix_t matrix_result;

	double r_cos = cos(radius);
	double r_sin = sin(radius);

	cairo_matrix_init (&matrix_rotate, r_cos,
	                                   r_sin,
	                                   r_sin,
	                                   r_cos,
	                                   x, y);

	cairo_matrix_init (&matrix_mirror, mirror_horizontally ? -1 : 1,
	                                   0,
	                                   0,
	                                   mirror_vertically ? -1 : 1,
								  0, 0);

	cairo_matrix_multiply (&matrix_result, &matrix_mirror, &matrix_rotate);

	cairo_set_matrix (cr, &matrix_result);
}
开发者ID:Nanolx,项目名称:TerraNova-GTK2,代码行数:27,代码来源:terranova_functions.c


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