[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.
Eric
//gcc -Wall cairo1.c -o cairo1 `pkg-config --cflags --libs cairo`
#include<stdio.h>
#include<cairo.h>
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);
cairo_paint(cr);
//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);
cairo_fill(cr);
printf("Output cairo1.png\n");
cairo_surface_write_to_png(surface, "cairo1.png");
printf("Status %i\n", cairo_status(cr));
cairo_destroy(cr);
cairo_surface_destroy(surface);
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