[cairo] Regarding Porting/Compilation of Cairo in AOSP

cecashon at aol.com cecashon at aol.com
Fri Jun 1 18:08:20 UTC 2018


Hi Jaymin, 

It looks like you just have a typo there. Use cairo.h instead of cario.h.

Easy to use pkg-config to bring in the dependencies or to check the dependencies that cairo needs. Test a little sample code to see if it helps out.


//gcc -Wall cairo1.c -o cairo1 `pkg-config --cflags --libs cairo`


int main()
    double width=600.0;
    double height=600.0;
    cairo_surface_t *surface=cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height);
    cairo_t *cr=cairo_create(surface);
    //Paint the green background.
    cairo_set_source_rgba(cr, 0.0, 1.0, 0.0, 1.0);

    //Draw a blue rectangle.
    cairo_set_source_rgba(cr, 0.0, 0.0, 1.0, 1.0);
    cairo_translate(cr, width/4.0, height/4.0);
    cairo_rectangle(cr, 0.0, 0.0, width/2.0, height/2.0);

    printf("Output cairo1.png\n");
    cairo_surface_write_to_png(surface, "cairo1.png");
    printf("Status %i\n", cairo_status(cr));

    return 0;

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cairographics.org/archives/cairo/attachments/20180601/8f980e25/attachment.html>

More information about the cairo mailing list