Pasting a png image on another through CAIRO library
I could easily paste images on each other in Python through PIL (Python Imaging Library)
Now I need to use Cairo with C++ for the above purpose. I have referred the following but couldn't get much help ! http://www.cairographics.org/manual/ http://www.cairographics.org/manual/...e-write-to-png Kindly guide ! |
http://www.cairographics.org/samples/
Look for: Code:
int w, h; |
Many thanks for bothering to reply !
I had seen this before, but somehow I couldn't get the code pointed out by you to work , maybe because of my lack of understanding the maths involved in arcs and scale. Meanwhile I found this : http://zetcode.com/tutorials/cairogr...l/compositing/ That shows how to paint one image over the other, let me see if I can get it to work with png, I NEED SOME WAY TO PASTE A PNG ON ANOTHER W.R.T MY SPECIFIED X,Y COORDINATES, I DON'T WANT IT TO OVERWRITE THE WHOLE IMAGE ! Thanks again :) |
I've only played around with Cairo before, so I am no expert at it, so I don't know how to do what you want. But I am certain is it possible.
One thing that bothers me about most Cairo tutorials is that they assume you will use it with GTK, and I certainly don't understand all the details of it's inner workings. Can't they just use PNG or Xlib? |
Thanks again !
I am trying to get the problem solved, if I manage to find something interesting, I shall report back here. |
Now here's the good news,
I've managed to paste 2 png images on a base png image w.r.t Cairo! No I didn't copy this whole code from somewhere, I applied little logic and got the problem solved :D Here by I have attached the final png. The base is a black colored png image. On the right side of the base image there is a map png pasted. On the left side of the base image there is a box png pasted (blue one). I have pasted the code here, so that it may help someone else. The important links w.r.t to above problem are: http://zetcode.com/tutorials/cairogr...l/compositing/ and http://zetcode.com/tutorials/cairogr...l/shapesfills/ Code:
cairo_surface_t *surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 240, 80); |
All times are GMT -5. The time now is 04:03 AM. |