as I promised (in sdk forum), here is my thread about cairo.
For a week, I am testing cairo functions with some success. Here I will discuss about failures of course.
First, I tried to declare an image surface to save to png file (cairo_surface_write_to_png (surface, "stroke.png") ) after some drawings.
The png filesize is always 0. May be the origin of error is the result of the warnings in the compile (see sdk forum/ subject sdk cairo).
The same happens with cairo_image_surface_create_from_png, if I read the width and height of the surface, they are equal to 0.
I have no clue because I have no compile error and no error during execution.
Second as png didn't work, I tried svg. It is better, that worked almost...
In fact, during my testing procedures, I created two contexts to use composition.
Except for two operators (clear and over), the result was a corrupted svg file. The size is 330 bytes and if I want to see it, I have a window which opens to ask me to give an assign to data:.
My cairo code is good because as soon as I changed the surface creation by cairo_pdf_surface_create, all worked.
Third, it is about cairo_amigaos_surface_create(BitMap *) function.
I didn't see any docs about it, so I don't know how to use it.
I used a previous code which displays an image on a private screen. In there, I created and initialize a bitmap codeI tried to create and initialize with :
Code: Select all
bitmap = IGraphics->AllocBitMap(width, height, depth, BMF_CLEAR | BMF_DISPLAYABLE, NULL);
surface = cairo_amigaos_surface_create (bitmap);
//Now I pass the bitmap pointer to window previously created
IGraphics->BltBitMapRastPort(bitmap, 0, 0, window->RPort, 0, 0, width, height, 0xc0);
Yes I know, there is a lot of questions, may be the answers are going to be difficult to give.
I hope that at last someone has the solution.
Thanks,
YesCop