je souhaite développer un outils d'affichage des graphes , j'ai découvert GtkCurve , mais j'ai pas trouvé mon bonheur , donc je me suis lancé avec pixbuf,
mais j'aimerai bien trouver des gens qui veulent développer avec moi cet outil afin de le rendre complet et professionnel .
j'ai commencé par tracer les axes , et dessiner une équation du genre y=ax+b.

mais j'aimerai aussi pouvoir écrire des chiffres sur les axes ...
quelqu'un veux m'aider a développer cet outils et le rendre dispo pour tout le monde ?
voila mon code actuel :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
 
#include <gtk/gtk.h>
#include <math.h>
 
void dessin(guchar *pixel,guint width, guint height)
{
 
    gint x,y,equation;
    gfloat j;
    guint n_coord;
 
 
    y=0;j=0;
 
int n=40 ,i;
    for(x=20; x<=width-20; x++)
    {
        y=(height) - 20 ;
        if(y<=height)
        {
        n_coord = ((x*3)+(3*y*640));
        pixel[n_coord]      = 255;
        pixel[n_coord+1]    = 255;
        pixel[n_coord+2]    = 255;
        }
 
 
        y=20;
        n_coord = ((x*3)+(3*y*640));
        pixel[n_coord]      = 255;
        pixel[n_coord+1]    = 255;
        pixel[n_coord+2]    = 255;
 
 
        if(x==n)
        {
            n=n+20;
            for(i=0;i<=5;i++)
            {
                y=(height) - 18-i ;
                if(y<=height)
                {
                    n_coord = ((x*3)+(3*y*640));
                    pixel[n_coord]      = 255;
                    pixel[n_coord+1]    = 255;
                    pixel[n_coord+2]    = 255;
                }
 
                y=18+i ;
                n_coord = ((x*3)+(3*y*640));
                pixel[n_coord]      = 255;
                pixel[n_coord+1]    = 255;
                pixel[n_coord+2]    = 255;
            }
        }
    }
 
int m=40;
    for(y=20; y<=height-20; y++)
    {
        x=20 ;
        if(y<=width)
        {
            n_coord = ((x*3)+(3*y*640));
            pixel[n_coord] = 255;
            pixel[n_coord+1] = 255;
            pixel[n_coord+2] = 255;
        }
 
        x=width-20;
        n_coord = ((x*3)+(3*y*640));
        pixel[n_coord] = 255;
        pixel[n_coord+1] = 255;
        pixel[n_coord+2] = 255;
 
        if(y==m)
        {
            m=m+20;
 
            for(i=0;i<=5;i++)
            {
                 x=18+i ;
                if(y<=width)
                {
                    n_coord = ((x*3)+(3*y*640));
                    pixel[n_coord] = 255;
                    pixel[n_coord+1] = 255;
                    pixel[n_coord+2] = 255;
                }
                x=width-(18+i) ;
                n_coord = ((x*3)+(3*y*640));
                pixel[n_coord] = 255;
                pixel[n_coord+1] = 255;
                pixel[n_coord+2] = 255;
            }
        }
    }
//*______________________________equation:_______________________________*
    for(x=20; x<=width-20; x++)
    {
        //equation de la droite en fesant un changement de variable x->x-10
       equation = (x-20) ;
 
       y=(height-20) - equation;
 
        if((y>=20) && (y<=height-20))
        {
        n_coord = ((x*3)+(3*y*640));
        pixel[n_coord] = 255;
        pixel[n_coord+1] = 158;
        pixel[n_coord+2] = 120;
 
        }
    }
//*________________________________________________________________________*
 
}
 
int main(int argc, char **argv)
{
    GtkWidget *pWindow;
    GtkWidget *graph;
    GdkPixbuf *pxgraph;
    guchar * pixel;
 
    // Initialisation des librairies GTK+
    gtk_init(&argc, &argv);
 
    // Création d'une fenêtre principale.
    pWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title(GTK_WINDOW(pWindow), "Fenêtre principale");
    gtk_window_set_default_size(GTK_WINDOW(pWindow), 640,480);
 
    pxgraph = gdk_pixbuf_new(GDK_COLORSPACE_RGB,FALSE,8,640,480);
    pixel = gdk_pixbuf_get_pixels(pxgraph);
 
    dessin(pixel, 640, 480);
 
    graph = gtk_image_new_from_pixbuf(pxgraph);
    gtk_container_add(GTK_CONTAINER(pWindow),graph);
 
    // Signaux associés à la fenêtre principale pour quitter.
    g_signal_connect(G_OBJECT(pWindow), "destroy", G_CALLBACK(gtk_main_quit), NULL);
    g_signal_connect(G_OBJECT(pWindow), "delete_event", G_CALLBACK(gtk_main_quit), NULL);
 
 
    // Boucle principale GTK+
    gtk_widget_show_all(pWindow);
    gtk_main();
 
    return 0;
}

j'attend vos propositions et vos critiques et vos conseils ...
merci a tout le monde ...