Re: offset drawing in a surface
Bill Spitzak <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <[email protected]> |
swati upadhyaya wrote: > Hi Henry and Andrea, > > First of all thanks for reply > > I didn't get what you people mentioned > as I am new to cairo lib . Let me explain my problem briefly, Suppose I > have a device with screen width and height as 400 x 400. And I have an > image with 200 x 200. Now in my device for this image start of x=100 and > end of x = 300. Now I have to draw the line from 100 to 300..I am using > the API > surface = cairo_image_surface_create_for _data(unsigned char > *buff,CAIRO_FORMAT_ARGB32,width,height,cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32,width)) > where width is image width = 200 > height is image height = 200. > Then I am doing > cr = cairo_create(surface); > > Now the problem is as the surface starts from top left only so it will > go from 0 to 200 but I want to draw form 100 to 300. So > 1) what can I do to shift the origin of the surface fom 0 to 100 ? So > that it will draw on the same.. You want to do cairo_translate(cr, -100, -100) Then the point 100,100 will be in the top-left of your image. -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo