drawing with libcairo - c

I try to draw with libcairo, it draws nothing. I downloaded the diagram sample, it works fine [draw.c], but code example from the site doesn't draw: like http://cairographics.org/samples/fill_and_stroke2/
why?
Thanks!

The code you linked to looks fine. But of course, it's not a complete program. Without seeing what code you've wrapped around the example to make it run, all I can guess is that you may need to call cairo_show_page() and cairo_surface_flush().

Related

CSFML : Draw Line

i'm working on a school project using CSFML (The SFML library but in C), i'm trying to display a line between two points but impossible for me to find any good documentation to do it, if someone know how to do it, please help me.
i've got his doc:
https://www.sfml-dev.org/tutorials/2.0/graphics-shape-fr.php
and my code look like this:
sfRenderWindow_clear(window.window, sfBlack);
sfRectangleShape *rectangle = sfRectangleShape_create();
sfRectangleShape line(rectangle);
sfRenderWindow_display(window.window);
but there is nothing on my window.
The doc tell something like window.draw(); to draw it but it's not recognized as a valid function so...
Thank you

how to save color using vcglib?

I'm trying to save color of vertices using vcglib but failed. Even if I read a file in and save it out without doing anything, the color of the original file is lost.
Here is the code I wrote:
vcg::tri::io::ImporterPLY<MyMesh>::Open(*srcMesh,"bunny.ply");
vcg::tri::io::ExporterPLY<MyMesh>::Save(*srcMesh,"out.ply");
After doing this, out.ply has no color while the source ply bunny.ply does.
Could anybody give me some sample code to make this thing done?
Thank you!
I had the exact same problem a couple of weeks ago.
After spending some time with the debugger and browsing through lots of source code, I discovered that the the open and save methods need to share an int mask. This allows the Open method to convey which attributes have been read from the original mesh (Also, make sure you've added the Colour4b attribute to your mesh definition.
int mask=0;
vcg::tri::io::ImporterPLY<MyMesh>::Open(*srcMesh,"bunny.ply",mask);
vcg::tri::io::ExporterPLY<MyMesh>::Save(*srcMesh,"out.ply",mask);
I hope that helps.

Camera will not move in OpenGL

I am having problems with using a camera in OpenGL/freeGLUT. Here is my code:
http://pastebin.com/VCi3Bjq5
(For some reason, when I paste the code into the code feature on this site, it gives extremely weird output.)
As far as I can tell this should rotate the camera when arrow keys are pressed - but it does nothing. It also seems that even the initial camera position is wrong. Any clue why this is?
The display function is only called once. You need to either set an idle function with glutIdleFunc() or tell GLUT that the display function must be called again with glutPostRedisplay().

Can I put letters instead of some numbers as ticks in a ValueAxis?

this is my program:
Program before
and I want it to look like this:
Program after
is this possible to add letters at some specific points in the ValueAxis?
I'm afraid that your links are not working, you may get a better responce using Imager and adding some example code or a Short, Self Contained, Correct Example.
In the meantime is this what you are trying to do

DropTarget ActionScript

i have 8 movie Clips that i stored in an array. i put the movie clips on the stage and i can move them around so everything work fine until now. I made a grid where the mc's can be droped.I saved the grid parts in an array,too.
after that gave names to the mc's and to the grid parts like that:
mc.name= number.toString();
gridpart.name= number.toString();
the movie clips and the grid parts have the same name like: mc1.name=1 and gridpart1.name=1 and so on.
Now I made an if statement to check if the right mc was droped on the right grid part, like that:
if(mc.name==gridpart.name)
{
trace("correct position")
}
But nothing happens. I used "dropTarget", too like that:
if(dropTarget.name==a.target.name)
{
//code
}
I don't know what to try now. I thought to put this code in the callback function of the mouse.CLICK event handler because i want that the mc should not be moved anymore if it is on hir correct position.
I would be happy if you have a better solution for this problem.
I tried to describe my problem so that you can imagine what I am trying to say.
Sorry about my English, I am not a native English speaker.
Thank you for your time
I think you wrong using dropTarget.name. Try dropTarget.parent.name. This why dropTarget is referred to content of the DisplayObject onto which you release your dragged MovieClip.
I hope this will be usefull to you!

Resources