[cairo] cairo_write_func_t
Dominic Lachowicz
domlachowicz at gmail.com
Thu Feb 12 09:27:25 PST 2009
Please refer to the stdio_write_func() in the cairo-png.c file that I
linked to in a previous email. Or even better - stdio_write() in
http://cgit.freedesktop.org/cairo/tree/src/cairo-output-stream.c
Using stdout is probably not the best way to get PNG data to
ImageMagick. Also, you probably don't need ImageMagick to set the PNG
compression level. As has been suggested a few times, you can
cut+paste about 50 lines from cairo-png.c to control the compression
yourself.
There's no need to send several follow-up emails on the same subject,
especially in the span of a few hours. Hopefully, someone will reply
to your original post. If you need a more real-time response, please
stop by the IRC channel.
Best regards,
Dom
On Thu, Feb 12, 2009 at 12:10 PM, Pablo Romero <romero619 at hotmail.com> wrote:
>
> hello,
> I need help setting up a write function for cairo_image_surface_write_to_png_stream()
>
> I've set up the following function to print to stdout...
>
>
> cairo_status_t my_stdout_write_fn(void *closure,unsigned char *data,unsigned int lngth){
> unsigned int i;
> printf("png length: %u\n",lngth);
>
> for(i=0;i
> #include
>
> cairo_status_t my_stdout_write_fn(void *closure,unsigned char *data, unsigned int lngth);
>
> int main (int argc, char *argv[])
> {
> cairo_surface_t *surface;
> cairo_t *cr;
>
> surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 200, 200);
> cr = cairo_create (surface);
>
> cairo_select_font_face (cr, "serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
> cairo_set_font_size (cr, 32.0);
> cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
> cairo_paint(cr);
>
> cairo_set_source_rgb (cr, 0.0, 0.0, 1.0);
> cairo_move_to (cr, 10.0, 50.0);
> cairo_show_text (cr, "Hello, world");
>
> cairo_surface_write_to_png_stream (surface,my_stdout_write_fn, NULL);
> cairo_surface_write_to_png(surface,"hello.png");
> return 0;
> }
>
>
> cairo_status_t my_stdout_write_fn(void *closure,unsigned char *data,unsigned int lngth){
> unsigned int i;
> printf("png length: %u\n",lngth);
>
> for(i=0;i
> _________________________________________________________________
> Windows Live™: E-mail. Chat. Share. Get more ways to connect.
> http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t2_allup_explore_022009
> _______________________________________________
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo
>
--
Counting bodies like sheep to the rhythm of the war drums.
More information about the cairo
mailing list