本文整理汇总了C++中cairo_matrix_init_identity函数的典型用法代码示例。如果您正苦于以下问题:C++ cairo_matrix_init_identity函数的具体用法?C++ cairo_matrix_init_identity怎么用?C++ cairo_matrix_init_identity使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cairo_matrix_init_identity函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: l_object_new
static int l_object_new(lua_State * L)
{
struct lobject_t * object = lua_newuserdata(L, sizeof(struct lobject_t));
object->width = 0;
object->height = 0;
object->x = 0;
object->y = 0;
object->rotation = 0;
object->scalex = 1;
object->scaley = 1;
object->anchorx = 0;
object->anchory = 0;
object->alpha = 1;
object->alignment = ALIGN_NONE;
object->visible = 1;
object->touchable = 1;
object->__translate = 0;
object->__rotate = 0;
object->__scale = 0;
object->__anchor = 0;
object->__obj_matrix_valid = 1;
cairo_matrix_init_identity(&object->__obj_matrix);
cairo_matrix_init_identity(&object->__transform_matrix);
luaL_setmetatable(L, MT_OBJECT);
return 1;
}
开发者ID:IngenicC,项目名称:xboot,代码行数:29,代码来源:l-object.c
示例2: draw
static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
cairo_text_extents_t extents;
cairo_font_options_t *font_options;
const char text[] = "cairo";
int x_off, y_off;
cairo_matrix_t m;
/* paint white so we don't need separate ref images for
* RGB24 and ARGB32 */
cairo_set_source_rgb (cr, 1., 1., 1.);
cairo_paint (cr);
cairo_select_font_face (cr, "Bitstream Vera Sans",
CAIRO_FONT_SLANT_NORMAL,
CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, TEXT_SIZE);
font_options = cairo_font_options_create ();
cairo_get_font_options (cr, font_options);
cairo_font_options_set_hint_metrics (font_options, CAIRO_HINT_METRICS_OFF);
cairo_set_font_options (cr, font_options);
cairo_font_options_destroy (font_options);
cairo_set_source_rgb (cr, 0, 0, 0);
cairo_translate (cr, WIDTH/2.0, HEIGHT/2.0);
cairo_text_extents (cr, text, &extents);
if (NUM_TEXT == 1) {
x_off = y_off = 0;
} else {
y_off = - floor (0.5 + extents.height / 2.0);
x_off = floor (0.5 + (extents.height+1) / (2 * tan (M_PI/NUM_TEXT)));
}
cairo_save (cr);
cairo_matrix_init_identity (&m);
draw_quadrant (cr, text, &extents, &m, x_off, y_off);
cairo_matrix_init (&m, 0, 1, -1, 0, 0, 0);
draw_quadrant (cr, text, &extents, &m, x_off, y_off);
cairo_restore (cr);
cairo_save (cr);
cairo_scale (cr, -1, -1);
cairo_matrix_init_identity (&m);
draw_quadrant (cr, text, &extents, &m, x_off, y_off);
cairo_matrix_init (&m, 0, 1, -1, 0, 0, 0);
draw_quadrant (cr, text, &extents, &m, x_off, y_off);
cairo_restore (cr);
return CAIRO_TEST_SUCCESS;
}
开发者ID:ghub,项目名称:NVprSDK,代码行数:57,代码来源:text-rotate.c
示例3: _cairo_draw_film_foreground
void
_cairo_draw_film_foreground (cairo_t *cr,
int x,
int y,
int width,
int height,
int thumbnail_size)
{
cairo_pattern_t *pattern;
double film_scale;
cairo_matrix_t matrix;
double film_strip;
/* left film strip */
pattern = _cairo_film_pattern_create ();
if (thumbnail_size > 128)
film_scale = 256.0 / thumbnail_size;
else
film_scale = 128.0 / thumbnail_size;
film_strip = 9.0 / film_scale;
cairo_matrix_init_identity (&matrix);
cairo_matrix_scale (&matrix, film_scale, film_scale);
cairo_matrix_translate (&matrix, -x, 0);
cairo_pattern_set_matrix (pattern, &matrix);
cairo_set_source (cr, pattern);
cairo_rectangle (cr,
x,
y,
film_strip,
height);
cairo_fill (cr);
/* right film strip */
x = x + width - film_strip;
cairo_matrix_init_identity (&matrix);
cairo_matrix_scale (&matrix, film_scale, film_scale);
cairo_matrix_translate (&matrix, -x, 0);
cairo_pattern_set_matrix (pattern, &matrix);
cairo_set_source (cr, pattern);
cairo_rectangle (cr,
x,
y,
film_strip,
height);
cairo_fill (cr);
cairo_pattern_destroy (pattern);
}
开发者ID:GNOME,项目名称:gthumb,代码行数:52,代码来源:cairo-utils.c
示例4: item_data_init
static void item_data_init (ItemData *item_data)
{
ItemDataPriv *priv;
priv = g_slice_new0 (ItemDataPriv);
priv->bounds.x1 = priv->bounds.x2 = priv->bounds.y1 = priv->bounds.y2 = 0;
cairo_matrix_init_identity (&(priv->translate));
cairo_matrix_init_identity (&(priv->rotate));
cairo_matrix_init_identity (&(priv->flip));
item_data->priv = priv;
}
开发者ID:LukasGibeh,项目名称:oregano,代码行数:14,代码来源:item-data.c
示例5: new_grid_viewport_node
/**
* Allocate a new \ref grid_viewport_node_t.
*/
static grid_viewport_node_t*
new_grid_viewport_node(void) {
grid_viewport_node_t *node = malloc(sizeof(grid_viewport_node_t));
node->parent = node->gege = node->didi = node->child = NULL;
node->name = NULL;
node->npc_to_dev = malloc(sizeof(cairo_matrix_t));
node->npc_to_ntv = malloc(sizeof(cairo_matrix_t));
node->par = NULL;
cairo_matrix_init_identity(node->npc_to_ntv);
cairo_matrix_init_identity(node->npc_to_dev);
return node;
}
开发者ID:jotok,项目名称:griddle,代码行数:17,代码来源:griddle.c
示例6: m_font
FontPlatformData::FontPlatformData(cairo_font_face_t* fontFace, float size, bool bold, bool oblique)
: m_font(0)
, m_size(size)
, m_fontFace(fontFace)
, m_scaledFont(0)
, m_syntheticBold(bold)
, m_syntheticOblique(oblique)
, m_useGDI(false)
{
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.
#if PLATFORM(APOLLO)
// In Apollo use the anti-aliasing mode selected by the user. See bug 2404418.
cairo_font_options_set_antialias(options, CAIRO_ANTIALIAS_DEFAULT);
#else
cairo_font_options_set_hint_style(options, CAIRO_HINT_STYLE_NONE);
cairo_font_options_set_antialias(options, CAIRO_ANTIALIAS_GRAY);
#endif
m_scaledFont = cairo_scaled_font_create(fontFace, &fontMatrix, &ctm, options);
cairo_font_options_destroy(options);
}
开发者ID:UIKit0,项目名称:WebkitAIR,代码行数:28,代码来源:FontPlatformDataCairoWin.cpp
示例7: l_matrix_new
static int l_matrix_new(lua_State * L)
{
cairo_matrix_t * matrix = lua_newuserdata(L, sizeof(cairo_matrix_t));
cairo_matrix_init_identity(matrix);
luaL_setmetatable(L, MT_NAME_MATRIX);
return 1;
}
开发者ID:philippe-nuaa,项目名称:xboot,代码行数:7,代码来源:l-matrix.c
示例8: source
static cairo_test_status_t
source (cairo_t *cr, int width, int height)
{
cairo_pattern_t *pattern;
cairo_matrix_t mat;
cairo_translate (cr, PAD, PAD);
pattern = create_pattern (cr);
cairo_matrix_init_identity (&mat);
cairo_matrix_scale (&mat, 2, 1.5);
cairo_matrix_rotate (&mat, 1);
cairo_matrix_translate (&mat, -PAT_WIDTH/4.0, -PAT_WIDTH/2.0);
cairo_pattern_set_matrix (pattern, &mat);
cairo_pattern_set_extend (pattern, CAIRO_EXTEND_NONE);
cairo_set_source (cr, pattern);
cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
cairo_paint (cr);
cairo_pattern_destroy (pattern);
return CAIRO_TEST_SUCCESS;
}
开发者ID:AZed,项目名称:cairo,代码行数:25,代码来源:recording-surface-pattern.c
示例9: 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
示例10: cairmat_create
static int
cairmat_create (lua_State *L) {
cairo_matrix_t mat;
cairo_matrix_init_identity(&mat);
create_lua_matrix(L, &mat);
return 1;
}
开发者ID:awesomeWM,项目名称:oocairo,代码行数:7,代码来源:obj_matrix.c
示例11: gimp_overlay_child_new
GimpOverlayChild *
gimp_overlay_child_new (GimpOverlayBox *box,
GtkWidget *widget,
gdouble xalign,
gdouble yalign,
gdouble angle,
gdouble opacity)
{
GimpOverlayChild *child;
g_return_val_if_fail (GIMP_IS_OVERLAY_BOX (box), NULL);
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
child = g_slice_new0 (GimpOverlayChild);
child->widget = widget;
child->xalign = CLAMP (xalign, 0.0, 1.0);
child->yalign = CLAMP (yalign, 0.0, 1.0);
child->x = 0.0;
child->y = 0.0;
child->has_position = FALSE;
child->angle = angle;
child->opacity = CLAMP (opacity, 0.0, 1.0);
cairo_matrix_init_identity (&child->matrix);
if (gtk_widget_get_realized (GTK_WIDGET (box)))
gimp_overlay_child_realize (box, child);
gtk_widget_set_parent (widget, GTK_WIDGET (box));
return child;
}
开发者ID:Amerekanets,项目名称:gimp-1,代码行数:33,代码来源:gimpoverlaychild.c
示例12: l_font_new
static int l_font_new(lua_State * L)
{
const char * family = luaL_checkstring(L, 1);
struct lfont_t * font = lua_newuserdata(L, sizeof(struct lfont_t));
if(FT_Init_FreeType(&font->library))
return 0;
if(FT_New_Xfs_Face(font->library, family, 0, &font->fface))
{
FT_Done_FreeType(font->library);
return 0;
}
font->face = cairo_ft_font_face_create_for_ft_face(font->fface, 0);
if(font->face->status != CAIRO_STATUS_SUCCESS)
{
FT_Done_Face(font->fface);
FT_Done_FreeType(font->library);
cairo_font_face_destroy(font->face);
return 0;
}
cairo_font_options_t * options = cairo_font_options_create();
cairo_matrix_t identity;
cairo_matrix_init_identity(&identity);
font->sfont = cairo_scaled_font_create(font->face, &identity, &identity, options);
cairo_font_options_destroy(options);
if(cairo_scaled_font_status(font->sfont) != CAIRO_STATUS_SUCCESS)
{
FT_Done_Face(font->fface);
FT_Done_FreeType(font->library);
cairo_font_face_destroy(font->face);
cairo_scaled_font_destroy(font->sfont);
return 0;
}
luaL_setmetatable(L, MT_FONT);
return 1;
}
开发者ID:IngenicC,项目名称:xboot,代码行数:35,代码来源:l-font.c
示例13: GetSurface
void
WriteableBitmap::Render (UIElement *element, Transform *transform)
{
CairoSurface *target;
if (!element)
return;
cairo_surface_t *surface = GetSurface (NULL);
if (!surface) {
Invalidate ();
// it could still be NULL (e.g. directly inheriting UIElement)
surface = GetSurface (NULL);
if (!surface)
return;
}
target = new CairoSurface (surface);
Rect bounds (0, 0, GetPixelWidth (), GetPixelHeight ());
cairo_matrix_t xform;
cairo_matrix_init_identity (&xform);
if (transform)
transform->GetTransform (&xform);
element->Paint (target, bounds, &xform);
target->unref ();
cairo_surface_flush (surface);
}
开发者ID:kangaroo,项目名称:moon,代码行数:32,代码来源:writeablebitmap.cpp
示例14: draw
static cairo_test_status_t
draw (cairo_t *cr, int width, int height)
{
cairo_font_face_t *font_face;
cairo_font_options_t *font_options;
cairo_scaled_font_t *scaled_font;
cairo_matrix_t identity;
cairo_matrix_t zero;
cairo_matrix_init_identity(&identity);
zero = identity;
cairo_matrix_scale(&zero, 0, 0);
font_face = cairo_get_font_face (cr);
font_options = cairo_font_options_create ();
cairo_get_font_options (cr, font_options);
scaled_font = cairo_scaled_font_create (font_face,
&identity,
&zero,
font_options);
cairo_set_scaled_font (cr, scaled_font);
cairo_show_text (cr, "Hello");
cairo_scaled_font_destroy (scaled_font);
cairo_font_options_destroy (font_options);
return cairo_test_status_from_status (cairo_test_get_context (cr),
cairo_status(cr));
}
开发者ID:AZed,项目名称:cairo,代码行数:29,代码来源:scaled-font-zero-matrix.c
示例15: ge_cairo_mirror
void
ge_cairo_mirror (cairo_t *cr,
CairoMirror mirror,
gint *x,
gint *y,
gint *width,
gint *height)
{
cairo_matrix_t matrix;
cairo_matrix_init_identity (&matrix);
cairo_translate (cr, *x, *y);
*x = 0;
*y = 0;
if (mirror & CR_MIRROR_HORIZONTAL)
{
cairo_matrix_scale (&matrix, -1, 1);
*x = -*width;
}
if (mirror & CR_MIRROR_VERTICAL)
{
cairo_matrix_scale (&matrix, 1, -1);
*y = -*height;
}
cairo_transform (cr, &matrix);
}
开发者ID:Distrotech,项目名称:gtk-engines,代码行数:29,代码来源:cairo-support.c
示例16: adg_gtk_area_reset
/**
* adg_gtk_area_reset:
* @area: an #AdgGtkArea
*
* Forcibly resets the zoom ratio and position of the canvas bound
* to @area. This means the canvas will be scaled and centered on
* the current available space.
**/
void
adg_gtk_area_reset(AdgGtkArea *area)
{
AdgGtkAreaPrivate *data;
GtkWidget *parent;
const CpmlExtents *sheet;
GtkAllocation allocation;
CpmlPair size;
gdouble zoom;
g_return_if_fail(ADG_GTK_IS_AREA(area));
data = adg_gtk_area_get_instance_private(area);
cairo_matrix_init_identity(&data->render_map);
sheet = _adg_get_extents(area);
if (!sheet->is_defined || sheet->size.x <= 0 || sheet->size.y <= 0)
return;
parent = gtk_widget_get_parent((GtkWidget *) area);
gtk_widget_get_allocation(parent, &allocation);
size.x = allocation.width;
size.y = allocation.height;
zoom = MIN(size.x / sheet->size.x, size.y / sheet->size.y);
cairo_matrix_scale(&data->render_map, zoom, zoom);
cairo_matrix_translate(&data->render_map,
(size.x / zoom - sheet->size.x) / 2 - sheet->org.x,
(size.y / zoom - sheet->size.y) / 2 - sheet->org.y);
/* Trigger a resize trying to hide the scrollbars on the parent */
gtk_widget_queue_resize(parent);
}
开发者ID:ntd,项目名称:adg,代码行数:41,代码来源:adg-gtk-area.c
示例17: ASSERT
void FontPlatformData::setOrientation(FontOrientation orientation)
{
ASSERT(m_scaledFont);
if (!m_scaledFont || (m_orientation == orientation))
return;
cairo_matrix_t transformationMatrix;
cairo_matrix_init_identity(&transformationMatrix);
cairo_matrix_t fontMatrix;
cairo_scaled_font_get_font_matrix(m_scaledFont, &fontMatrix);
cairo_font_options_t* options = getDefaultFontOptions();
// In case of vertical orientation, rotate the transformation matrix.
// Otherwise restore the horizontal orientation matrix.
if (orientation == Vertical)
rotateCairoMatrixForVerticalOrientation(&fontMatrix);
else
fontMatrix = m_horizontalOrientationMatrix;
cairo_font_face_t* fontFace = cairo_scaled_font_get_font_face(m_scaledFont);
cairo_scaled_font_destroy(m_scaledFont);
m_scaledFont = cairo_scaled_font_create(fontFace, &fontMatrix, &transformationMatrix, options);
cairo_font_options_destroy(options);
m_orientation = orientation;
}
开发者ID:MYSHLIFE,项目名称:webkit,代码行数:28,代码来源:FontPlatformDataFreeType.cpp
示例18: 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
示例19: m_font
FontPlatformData::FontPlatformData(cairo_font_face_t* fontFace, float size, bool bold, bool oblique)
: m_font(0)
, m_size(size)
, m_orientation(Horizontal)
, m_textOrientation(TextOrientationVerticalRight)
, m_widthVariant(RegularWidth)
, m_scaledFont(0)
, m_isColorBitmapFont(false)
, m_syntheticBold(bold)
, m_syntheticOblique(oblique)
, m_useGDI(false)
{
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_GRAY);
m_scaledFont = cairo_scaled_font_create(fontFace, &fontMatrix, &ctm, options);
cairo_font_options_destroy(options);
}
开发者ID:0omega,项目名称:platform_external_webkit,代码行数:26,代码来源:FontPlatformDataCairoWin.cpp
示例20: _cairo_skia_context_create
cairo_t *
_cairo_skia_context_create (void *target)
{
cairo_skia_surface_t *surface = (cairo_skia_surface_t *) target;
cairo_skia_context_t *cr;
cr = (cairo_skia_context_t *) _freed_pool_get (&context_pool);
if (unlikely (cr == NULL)) {
cr = new cairo_skia_context_t;
if (unlikely (cr == NULL))
return _cairo_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
cr->path = new SkPath;
cr->paint = new SkPaint;
}
_cairo_init (&cr->base, &_cairo_skia_context_backend);
cr->source = NULL;
cr->source_image = NULL;
cr->paint->setStrokeWidth (SkFloatToScalar (2.0));
cr->target = (cairo_skia_surface_t *) cairo_surface_reference ((cairo_surface_t *) target);
cr->original = (cairo_skia_surface_t *) cairo_surface_reference ((cairo_surface_t *) target);
cr->canvas = new SkCanvas (*surface->bitmap);
cr->canvas->save ();
cairo_matrix_init_identity (&cr->matrix);
return &cr->base;
}
开发者ID:Ashod,项目名称:WinCairoRequirements,代码行数:32,代码来源:cairo-skia-context.cpp
注:本文中的cairo_matrix_init_identity函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论