예제 #1
0
파일: l-object.c 프로젝트: IngenicC/xboot
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;
}
예제 #2
0
파일: text-rotate.c 프로젝트: ghub/NVprSDK
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;
}
예제 #3
0
파일: cairo-utils.c 프로젝트: GNOME/gthumb
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);
}
예제 #4
0
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;
}
예제 #5
0
파일: griddle.c 프로젝트: jotok/griddle
/**
 * 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;
}
예제 #6
0
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);
}
예제 #7
0
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;
}
예제 #8
0
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;
}
예제 #9
0
void FontPlatformData::initializeWithFontFace(cairo_font_face_t* fontFace)
{
    cairo_font_options_t* options = getDefaultFontOptions();

    cairo_matrix_t ctm;
    cairo_matrix_init_identity(&ctm);

    // Scaling a font with width zero size leads to a failed cairo_scaled_font_t instantiations.
    // Instead we scale we scale the font to a very tiny size and just abort rendering later on.
    float realSize = m_size ? m_size : 1;

    cairo_matrix_t fontMatrix;
    if (!m_pattern)
        cairo_matrix_init_scale(&fontMatrix, realSize, realSize);
    else {
        setCairoFontOptionsFromFontConfigPattern(options, m_pattern.get());

        // FontConfig may return a list of transformation matrices with the pattern, for instance,
        // for fonts that are oblique. We use that to initialize the cairo font matrix.
        FcMatrix fontConfigMatrix, *tempFontConfigMatrix;
        FcMatrixInit(&fontConfigMatrix);

        // These matrices may be stacked in the pattern, so it's our job to get them all and multiply them.
        for (int i = 0; FcPatternGetMatrix(m_pattern.get(), FC_MATRIX, i, &tempFontConfigMatrix) == FcResultMatch; i++)
            FcMatrixMultiply(&fontConfigMatrix, &fontConfigMatrix, tempFontConfigMatrix);
        cairo_matrix_init(&fontMatrix, fontConfigMatrix.xx, -fontConfigMatrix.yx,
                          -fontConfigMatrix.xy, fontConfigMatrix.yy, 0, 0);

        // The matrix from FontConfig does not include the scale. 
        cairo_matrix_scale(&fontMatrix, realSize, realSize);
    }

    m_scaledFont = cairo_scaled_font_create(fontFace, &fontMatrix, &ctm, options);
    cairo_font_options_destroy(options);
}
예제 #10
0
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);
}
예제 #11
0
static int
cairmat_create (lua_State *L) {
    cairo_matrix_t mat;
    cairo_matrix_init_identity(&mat);
    create_lua_matrix(L, &mat);
    return 1;
}
예제 #12
0
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;
}
예제 #13
0
파일: l-font.c 프로젝트: IngenicC/xboot
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;
}
예제 #14
0
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);
}
예제 #15
0
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));
}
예제 #16
0
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);
}
예제 #17
0
파일: adg-gtk-area.c 프로젝트: ntd/adg
/**
 * 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);
}
예제 #18
0
void FontPlatformData::initializeWithFontFace(cairo_font_face_t* fontFace)
{
    cairo_font_options_t* options = cairo_font_options_copy(getDefaultFontOptions());

    cairo_matrix_t ctm;
    cairo_matrix_init_identity(&ctm);

    cairo_matrix_t fontMatrix;
    if (!m_pattern)
        cairo_matrix_init_scale(&fontMatrix, m_size, m_size);
    else {
        setCairoFontOptionsFromFontConfigPattern(options, m_pattern.get());

        // FontConfig may return a list of transformation matrices with the pattern, for instance,
        // for fonts that are oblique. We use that to initialize the cairo font matrix.
        FcMatrix fontConfigMatrix, *tempFontConfigMatrix;
        FcMatrixInit(&fontConfigMatrix);

        // These matrices may be stacked in the pattern, so it's our job to get them all and multiply them.
        for (int i = 0; FcPatternGetMatrix(m_pattern.get(), FC_MATRIX, i, &tempFontConfigMatrix) == FcResultMatch; i++)
            FcMatrixMultiply(&fontConfigMatrix, &fontConfigMatrix, tempFontConfigMatrix);
        cairo_matrix_init(&fontMatrix, fontConfigMatrix.xx, -fontConfigMatrix.yx,
                          -fontConfigMatrix.xy, fontConfigMatrix.yy, 0, 0);

        // The matrix from FontConfig does not include the scale.
        cairo_matrix_scale(&fontMatrix, m_size, m_size);
    }

    m_scaledFont = adoptPlatformRef(cairo_scaled_font_create(fontFace, &fontMatrix, &ctm, options));
    cairo_font_options_destroy(options);
}
예제 #19
0
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;
}
예제 #20
0
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);
    }
}
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);
}
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;
}
예제 #23
0
파일: pen.c 프로젝트: mono/libgdiplus
static void
gdip_pen_init (GpPen *pen)
{
	pen->color = 0;
	pen->brush = NULL;
	pen->own_brush = FALSE;
	pen->width = 1;
	pen->miter_limit = 10;
	pen->line_join = LineJoinMiter;
	pen->dash_style = DashStyleSolid;
	pen->line_cap = LineCapFlat;
	pen->end_cap = LineCapFlat;		/* ignored, Cairo only support a single start/end line cap */
	pen->dash_cap = DashCapFlat;		/* ignored */
	pen->mode = PenAlignmentCenter;
	pen->dash_offset = 0;
	pen->dash_count = 0;
	pen->own_dash_array = FALSE;
	pen->dash_array = NULL;
	pen->compound_count = 0;
	pen->compound_array = NULL;
	pen->unit = UnitWorld;
	pen->changed = TRUE;
	pen->custom_start_cap = NULL;
	pen->custom_end_cap = NULL;
	cairo_matrix_init_identity (&pen->matrix);
}
static cairo_status_t
_cairo_skia_context_set_identity_matrix (void *abstract_cr)
{
    cairo_skia_context_t *cr = (cairo_skia_context_t *) abstract_cr;

    cairo_matrix_init_identity (&cr->matrix);
    return CAIRO_STATUS_SUCCESS;
}
void ofCairoRenderer::draw(vector<ofPoint> & vertexData, ofPrimitiveMode drawMode){
	if(vertexData.size()==0) return;
	pushMatrix();
	cairo_matrix_init_identity(getCairoMatrix());
	cairo_new_path(cr);
	//if(indices.getNumIndices()){

		int i = 1;
		ofVec3f v = transform(vertexData[0]);
		ofVec3f v2;
		cairo_move_to(cr,v.x,v.y);
		if(drawMode==OF_PRIMITIVE_TRIANGLE_STRIP){
			v = transform(vertexData[1]);
			cairo_line_to(cr,v.x,v.y);
			v = transform(vertexData[2]);
			cairo_line_to(cr,v.x,v.y);
			i=2;
		}
		for(; i<(int)vertexData.size(); i++){
			v = transform(vertexData[i]);
			switch(drawMode){
			case(OF_PRIMITIVE_TRIANGLES):
				if((i+1)%3==0){
					cairo_line_to(cr,v.x,v.y);
					v2 = transform(vertexData[i-2]);
					cairo_line_to(cr,v2.x,v2.y);
					cairo_move_to(cr,v.x,v.y);
				}else if((i+3)%3==0){
					cairo_move_to(cr,v.x,v.y);
				}else{
					cairo_line_to(cr,v.x,v.y);
				}

			break;
			case(OF_PRIMITIVE_TRIANGLE_STRIP):
					v2 = transform(vertexData[i-2]);
					cairo_line_to(cr,v.x,v.y);
					cairo_line_to(cr,v2.x,v2.y);
					cairo_move_to(cr,v.x,v.y);
			break;
			case(OF_PRIMITIVE_TRIANGLE_FAN):
					/*triangles.addIndex((GLuint)0);
						triangles.addIndex((GLuint)1);
						triangles.addIndex((GLuint)2);
						for(int i = 2; i < primitive.getNumVertices()-1;i++){
							triangles.addIndex((GLuint)0);
							triangles.addIndex((GLuint)i);
							triangles.addIndex((GLuint)i+1);
						}*/
			break;
			default:break;
			}
		}

	cairo_move_to(cr,vertexData[vertexData.size()-1].x,vertexData[vertexData.size()-1].y);
	cairo_stroke( cr );
	popMatrix();
}
예제 #26
0
static cairo_status_t
cairo_type1_font_create (cairo_scaled_font_subset_t  *scaled_font_subset,
                         cairo_type1_font_t         **subset_return,
                         cairo_bool_t                 hex_encode)
{
    cairo_type1_font_t *font;
    cairo_font_face_t *font_face;
    cairo_matrix_t font_matrix;
    cairo_matrix_t ctm;
    cairo_font_options_t font_options;
    cairo_status_t status;

    font = calloc (1, sizeof (cairo_type1_font_t));
    if (font == NULL)
	return _cairo_error (CAIRO_STATUS_NO_MEMORY);

    font->widths = calloc (scaled_font_subset->num_glyphs,
                           sizeof (int));
    if (font->widths == NULL) {
	free (font);
	return _cairo_error (CAIRO_STATUS_NO_MEMORY);
    }

    font->scaled_font_subset = scaled_font_subset;
    font->hex_encode = hex_encode;

    font_face = cairo_scaled_font_get_font_face (scaled_font_subset->scaled_font);

    cairo_matrix_init_scale (&font_matrix, 1000, -1000);
    cairo_matrix_init_identity (&ctm);

    _cairo_font_options_init_default (&font_options);
    cairo_font_options_set_hint_style (&font_options, CAIRO_HINT_STYLE_NONE);
    cairo_font_options_set_hint_metrics (&font_options, CAIRO_HINT_METRICS_OFF);

    font->type1_scaled_font = cairo_scaled_font_create (font_face,
							&font_matrix,
							&ctm,
							&font_options);
    status = font->type1_scaled_font->status;
    if (status)
        goto fail;

    _cairo_array_init (&font->contents, sizeof (unsigned char));
    font->output = NULL;

    *subset_return = font;

    return CAIRO_STATUS_SUCCESS;

fail:
    free (font->widths);
    free (font);

    return status;
}
예제 #27
0
GpStatus WINGDIPAPI
GdipResetTextureTransform (GpTexture *texture)
{
	if (!texture)
		return InvalidParameter;

	cairo_matrix_init_identity (&texture->matrix);
	texture->base.changed = TRUE;
	return Ok;
}
예제 #28
0
static void
clutter_input_device_evdev_init (ClutterInputDeviceEvdev *self)
{
  cairo_matrix_init_identity (&self->device_matrix);
  self->device_aspect_ratio = 0;
  self->output_ratio = 0;

  self->touches = g_hash_table_new_full (NULL, NULL,
                                         NULL, release_device_touch_slot);
}
예제 #29
0
파일: pen.c 프로젝트: mono/libgdiplus
GpStatus WINGDIPAPI
GdipResetPenTransform (GpPen *pen)
{
	if (!pen)
		return InvalidParameter;

	cairo_matrix_init_identity (&pen->matrix);
	pen->changed = TRUE;

	return Ok;
}
예제 #30
0
GXPSMatrix *
gxps_matrix_new (GXPSRenderContext *ctx)
{
        GXPSMatrix *matrix;

        matrix = g_slice_new0 (GXPSMatrix);
        matrix->ctx = ctx;
        cairo_matrix_init_identity (&matrix->matrix);

        return matrix;
}