cairo_set_source_surface questions

唐博 <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
    I want to set the surface to itself and scaled the surface. That is , I want to  use just one surface( it has drawed path) to scaled. 

    I hope you can understand what I mean. This is the simple code. But the result (attachment) is very confused to me. wait fot your reply.
    Thank you very much.

    #define edge 600


    uchar * pbit = (uchar *)malloc(32*edge * edge);
    memset(pbit, 0, 32*edge * edge);       

    surface = cairo_image_surface_create_for_data((uchar *)pbit,
                                                  CAIRO_FORMAT_ARGB32,
                                                  edge, edge,
                                                  cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, edge));
    cr = cairo_create(surface);    

    cairo_set_source_rgba(cr, 1.0, 1.0, 0.0, 1);
    cairo_rectangle(cr, 150, 150, 300, 300);
    cairo_fill_preserve(cr);

    cairo_set_source_rgba(cr, 0.0, 1.0, 1.0, 1);
    cairo_stroke(cr);

    cairo_move_to(cr, 150, 150);
    cairo_line_to(cr, 450, 450);
    cairo_line_to(cr, 450, 150);
    cairo_line_to(cr, 150, 450);
    cairo_stroke(cr);

        cairo_save(cr);
        cairo_scale(cr, 1.0, 1.4);
        cairo_set_source_surface(cr, surface, 0, 0);
        cairo_rectangle(cr , 0, 0, edge, edge);
        cairo_fill(cr);
        cairo_restore(cr);

-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
question_pic.png (image/png, 166.7 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.