begin process at 2012 05 27 13:34:06
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

GTK+

 > ANIMATION GTK QUI REPRÉSENTE L'ÉVOLUTION DES "CASES" D'UNE MATRICE

ANIMATION GTK QUI REPRÉSENTE L'ÉVOLUTION DES "CASES" D'UNE MATRICE


 Information sur la source

Note :
Aucune note
Catégorie :GTK+ Niveau :Initié Date de création :07/06/2004 Date de mise à jour :07/06/2004 23:11:30 Vu :6 708

Auteur : oz1kan

Ecrire un message privé
Site perso
Commentaire sur cette source (3)
Ajouter un commentaire et/ou une note

 Description

C'est une animation qui , suivant une liste de matrice, va nous le représenter graphiquement. Plus une case est sombre, plus le nombre que contient cette case est grand.
On peut ainsi suivre " visuellement " l'évolution de la matrice.


Source

  • #include <gtk/gtk.h>
  • #include <stdio.h>
  • #include <math.h>
  • #include <fcntl.h>
  • #define IMAGE_WIDTH 64
  • #define IMAGE_HEIGHT 64
  • #define N 5
  • struct liste{
  • int num;
  • struct liste *next;
  • };
  • struct matrice{
  • int num;
  • struct liste *liens;
  • int tableau [N][N];
  • };
  • struct liste_matrices{
  • struct matrice *m;
  • struct liste_matrices *next;
  • };
  • struct liste_liste_matrices{
  • struct liste_matrices *l;
  • struct liste_liste_matrices *next;
  • };
  • /**
  • * par default,pr une case on a une longueur et une largeur de 64;
  • * il nous suffira de multiplier ces valeurs par le nombre de grains au depart d un tas...
  • **/
  • typedef struct matrice Matrice;
  • typedef struct liste_matrices Liste;
  • guchar rgbbuf[IMAGE_WIDTH * IMAGE_HEIGHT * 3];
  • GdkPixmap *pixmap;
  • GdkGC *crayon;
  • GdkColor couleur;
  • GdkWindow *mywindow;
  • gboolean on_darea_expose (GtkWidget *widget,
  • GdkEventExpose *event,
  • gpointer user_data);
  • void dessine_carre (gint intensite,gint absc,gint ord) {
  • couleur.red = couleur.green = couleur.blue = intensite;
  • gdk_colormap_alloc_color(gdk_colormap_get_system(),&couleur,FALSE,TRUE);
  • gdk_gc_set_foreground(crayon,&couleur);
  • gdk_draw_rectangle(pixmap,crayon,1,ord,absc,IMAGE_WIDTH,IMAGE_HEIGHT);
  • }
  • void dessine_selon_matrice (Matrice *mat) {
  • /*
  • * il faut initialiser la taille de la fentre ->N*IMAGE_HEIGHT
  • * il faut determiner le nombre de case a afficher.-> cf taille de la matrice
  • * il faut initialiser l intensite max pr l element de valeur la plus grde
  • * pour chaque element de la matrice,il faut calculer l intensite.
  • */
  • gint unite,i,j,val_cur,tmp1,tmp2;
  • unite=65000/N;
  • for(i=0;i < N;i++){
  • for(j=0;j < N;j++){
  • tmp1=i+1;
  • tmp2=j+1;
  • val_cur=65000-unite*mat->tableau[i][j];
  • dessine_carre(val_cur,tmp1*64-64,tmp2*64-64);
  • /************
  • printf ("yo %d \n",val_cur);
  • printf ("yo %d \n",tmp1*64-64);
  • printf ("yo %d \n",tmp2*64-64);
  • **************/
  • }
  • }
  • }
  • void animation(Liste *lst){
  • /*
  • * il faut dessiner selon la matrice pour chaques matrices de la liste...
  • *
  • */
  • while (lst->next!=NULL) {
  • dessine_selon_matrice (lst->m);
  • gdk_draw_pixmap(mywindow, crayon,pixmap, 0,0,0,0, IMAGE_WIDTH*N, IMAGE_HEIGHT*N);
  • printf("yo %d\n",lst->m->num);
  • lst=lst->next;
  • sleep(1);
  • }
  • dessine_selon_matrice (lst->m);
  • sleep(1);
  • gdk_draw_pixmap(mywindow, crayon,pixmap, 0,0,0,0, IMAGE_WIDTH*N, IMAGE_HEIGHT*N);
  • printf("yoda %d\n",lst->m->num);
  • }
  • int main (int argc, char *argv[]) {
  • GtkWidget *window, *darea;
  • gint intensite,absc,ord,i2;
  • int p,q,z;
  • Matrice *mat,*mat2,*mat3,*mat4,*mat5,*mat6,*mat7,*mat8,*mat9;
  • Liste *lst,*lst2,*lst3,*lst4,*lst5,*lst6,*lst7,*lst8,*lst9;
  • gtk_init (&argc, &argv);
  • gdk_rgb_init();
  • gdk_colormap_alloc_color(gdk_colormap_get_system(),&couleur,FALSE,TRUE);
  • window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  • darea = gtk_drawing_area_new();
  • gtk_drawing_area_size (GTK_DRAWING_AREA (darea), IMAGE_WIDTH*N, IMAGE_HEIGHT*N);
  • gtk_container_add (GTK_CONTAINER (window), darea);
  • gtk_signal_connect (GTK_OBJECT (darea), "expose-event",
  • GTK_SIGNAL_FUNC (on_darea_expose), NULL);
  • gtk_widget_show_all (window);
  • pixmap=gdk_pixmap_new(window->window,IMAGE_WIDTH*N,IMAGE_HEIGHT*N,gdk_window_get_visual(window->window)->depth);
  • crayon=gdk_gc_new(pixmap);
  • gdk_gc_set_line_attributes(crayon,1,GDK_LINE_SOLID,GDK_CAP_BUTT,GDK_JOIN_BEVEL);
  • z=0;
  • mywindow=darea->window;
  • /******* test 1 *****
  • intensite=0;
  • absc=128;
  • ord=0;
  • dessine_carre(intensite,absc,ord);
  • ***********************/
  • /********* test 2 *****
  • mat = (Matrice*)malloc(sizeof(Matrice));
  • mat->tableau[0][0]=5;
  • mat->tableau[0][1]=4;
  • mat->tableau[0][2]=3;
  • mat->tableau[0][3]=2;
  • mat->tableau[0][4]=1;
  • for(p=1;p<N;p++){
  • for(q=0;q<N;q++){
  • mat->tableau[p][q]=abs(p-q);
  • }
  • }
  • dessine_selon_matrice (mat);
  • ***********************/
  • /********* test 3 *****
  • mat = (Matrice*)malloc(sizeof(Matrice));
  • mat2 = (Matrice*)malloc(sizeof(Matrice));
  • mat3 = (Matrice*)malloc(sizeof(Matrice));
  • mat4 = (Matrice*)malloc(sizeof(Matrice));
  • mat5 = (Matrice*)malloc(sizeof(Matrice));
  • mat6 = (Matrice*)malloc(sizeof(Matrice));
  • mat7 = (Matrice*)malloc(sizeof(Matrice));
  • mat8 = (Matrice*)malloc(sizeof(Matrice));
  • mat9 = (Matrice*)malloc(sizeof(Matrice));
  • lst=(Liste*)malloc(sizeof(Liste));
  • lst2=(Liste*)malloc(sizeof(Liste));
  • lst3=(Liste*)malloc(sizeof(Liste));
  • lst4=(Liste*)malloc(sizeof(Liste));
  • lst5=(Liste*)malloc(sizeof(Liste));
  • lst6=(Liste*)malloc(sizeof(Liste));
  • lst7=(Liste*)malloc(sizeof(Liste));
  • lst8=(Liste*)malloc(sizeof(Liste));
  • lst9=(Liste*)malloc(sizeof(Liste));
  • mat->num=0;
  • mat2->num=2;
  • mat3->num=3;
  • mat4->num=4;
  • mat5->num=5;
  • for(p=0;p<N;p++){
  • for(q=0;q<N;q++){
  • mat->tableau[p][q]=0;
  • mat2->tableau[p][q]=0;
  • mat3->tableau[p][q]=0;
  • mat4->tableau[p][q]=0;
  • mat5->tableau[p][q]=0;
  • mat6->tableau[p][q]=0;
  • mat7->tableau[p][q]=0;
  • mat8->tableau[p][q]=0;
  • mat9->tableau[p][q]=0;
  • }
  • }
  • mat->tableau[0][0]=3;
  • mat2->tableau[0][1]=3;
  • mat3->tableau[0][2]=3;
  • mat4->tableau[1][2]=3;
  • mat5->tableau[1][1]=3;
  • mat6->tableau[1][0]=3;
  • mat7->tableau[2][0]=3;
  • mat8->tableau[2][1]=3;
  • mat9->tableau[2][2]=3;
  • lst->m=(Matrice*)malloc(sizeof(Matrice));
  • lst->next =(Liste*)malloc(sizeof(Liste));
  • lst->m=mat;
  • lst->next =lst2;
  • lst2->m=(Matrice*)malloc(sizeof(Matrice));
  • lst2->next = (Liste*)malloc(sizeof(Liste));
  • lst2->m=mat2;
  • lst2->next=lst3;
  • lst3->m=(Matrice*)malloc(sizeof(Matrice));
  • lst3->next = (Liste*)malloc(sizeof(Liste));
  • lst3->m=mat3;
  • lst3->next=lst4;
  • lst4->m=(Matrice*)malloc(sizeof(Matrice));
  • lst4->next = (Liste*)malloc(sizeof(Liste));
  • lst4->m=mat4;
  • lst4->next=lst5;
  • lst5->m=(Matrice*)malloc(sizeof(Matrice));
  • lst5->next = (Liste*)malloc(sizeof(Liste));
  • lst5->m=mat5;
  • lst5->next=lst6;
  • lst6->m=(Matrice*)malloc(sizeof(Matrice));
  • lst6->next =(Liste*)malloc(sizeof(Liste));
  • lst6->m=mat6;
  • lst6->next =lst7;
  • lst7->m=(Matrice*)malloc(sizeof(Matrice));
  • lst7->next = (Liste*)malloc(sizeof(Liste));
  • lst7->m=mat7;
  • lst7->next=lst8;
  • lst8->m=(Matrice*)malloc(sizeof(Matrice));
  • lst8->next = (Liste*)malloc(sizeof(Liste));
  • lst8->m=mat8;
  • lst8->next=lst9;
  • lst9->m=(Matrice*)malloc(sizeof(Matrice));
  • lst9->next = (Liste*)malloc(sizeof(Liste));
  • lst9->m=mat9;
  • lst9->next=lst;
  • animation(lst);
  • ***************/
  • /************** test 4 **********
  • mat = (Matrice*)malloc(sizeof(Matrice));
  • mat2 = (Matrice*)malloc(sizeof(Matrice));
  • mat3 = (Matrice*)malloc(sizeof(Matrice));
  • mat4 = (Matrice*)malloc(sizeof(Matrice));
  • mat5 = (Matrice*)malloc(sizeof(Matrice));
  • lst=(Liste*)malloc(sizeof(Liste));
  • lst2=(Liste*)malloc(sizeof(Liste));
  • lst3=(Liste*)malloc(sizeof(Liste));
  • lst4=(Liste*)malloc(sizeof(Liste));
  • lst5=(Liste*)malloc(sizeof(Liste));
  • mat->num=0;
  • mat2->num=2;
  • mat3->num=3;
  • mat4->num=4;
  • mat5->num=5;
  • for(p=0;p<N;p++){
  • for(q=0;q<N;q++){
  • mat->tableau[p][q]=abs(q-p);
  • mat2->tableau[p][q]=abs(q-p)+4*p;
  • mat3->tableau[p][q]=abs(p-q)-5*q;
  • mat4->tableau[p][q]=p+q;
  • mat5->tableau[p][q]=abs(q-p);
  • }
  • }
  • lst->m=(Matrice*)malloc(sizeof(Matrice));
  • lst->next =(Liste*)malloc(sizeof(Liste));
  • lst->m=mat;
  • lst->next =lst2;
  • lst2->m=(Matrice*)malloc(sizeof(Matrice));
  • lst2->next = (Liste*)malloc(sizeof(Liste));
  • lst2->m=mat2;
  • lst2->next=lst3;
  • lst3->m=(Matrice*)malloc(sizeof(Matrice));
  • lst3->next = (Liste*)malloc(sizeof(Liste));
  • lst3->m=mat3;
  • lst3->next=lst4;
  • lst4->m=(Matrice*)malloc(sizeof(Matrice));
  • lst4->next = (Liste*)malloc(sizeof(Liste));
  • lst4->m=mat4;
  • lst4->next=lst5;
  • lst5->m=(Matrice*)malloc(sizeof(Matrice));
  • lst5->next = (Liste*)malloc(sizeof(Liste));
  • lst5->m=mat5;
  • lst5->next=lst;
  • animation(lst);
  • ***********************/
  • /************* test 5 **********/
  • mat = (Matrice*)malloc(sizeof(Matrice));
  • mat2 = (Matrice*)malloc(sizeof(Matrice));
  • mat3 = (Matrice*)malloc(sizeof(Matrice));
  • mat4 = (Matrice*)malloc(sizeof(Matrice));
  • mat5 = (Matrice*)malloc(sizeof(Matrice));
  • lst=(Liste*)malloc(sizeof(Liste));
  • lst2=(Liste*)malloc(sizeof(Liste));
  • lst3=(Liste*)malloc(sizeof(Liste));
  • lst4=(Liste*)malloc(sizeof(Liste));
  • lst5=(Liste*)malloc(sizeof(Liste));
  • mat->num=0;
  • mat2->num=2;
  • mat3->num=3;
  • mat4->num=4;
  • mat5->num=5;
  • for(p=0;p<N;p++){
  • for(q=0;q<N;q++){
  • mat->tableau[p][q]=0;
  • mat2->tableau[p][q]=0;
  • mat3->tableau[p][q]=0;
  • mat4->tableau[p][q]=0;
  • mat5->tableau[p][q]=0;
  • }
  • }
  • mat->tableau[0][0]=5;
  • mat2->tableau[0][0]=4;
  • mat2->tableau[0][1]=1;
  • mat3->tableau[0][0]=3;
  • mat3->tableau[0][1]=1;
  • mat3->tableau[1][0]=1;
  • mat4->tableau[0][0]=2;
  • mat4->tableau[0][1]=2;
  • mat4->tableau[1][0]=1;
  • mat5->tableau[0][0]=2;
  • mat5->tableau[0][1]=1;
  • mat5->tableau[1][0]=1;
  • mat5->tableau[1][1]=1;
  • lst->m=(Matrice*)malloc(sizeof(Matrice));
  • lst->next =(Liste*)malloc(sizeof(Liste));
  • lst->m=mat;
  • lst->next =lst2;
  • lst2->m=(Matrice*)malloc(sizeof(Matrice));
  • lst2->next = (Liste*)malloc(sizeof(Liste));
  • lst2->m=mat2;
  • lst2->next=lst3;
  • lst3->m=(Matrice*)malloc(sizeof(Matrice));
  • lst3->next = (Liste*)malloc(sizeof(Liste));
  • lst3->m=mat3;
  • lst3->next=lst4;
  • lst4->m=(Matrice*)malloc(sizeof(Matrice));
  • lst4->next = (Liste*)malloc(sizeof(Liste));
  • lst4->m=mat4;
  • lst4->next=lst5;
  • lst5->m=(Matrice*)malloc(sizeof(Matrice));
  • lst5->next = (Liste*)malloc(sizeof(Liste));
  • lst5->m=mat5;
  • lst5->next=lst;
  • animation(lst);
  • /****************************/
  • gtk_main();
  • return 0;
  • }
  • gboolean
  • on_darea_expose (GtkWidget *widget,
  • GdkEventExpose *event,
  • gpointer user_data)
  • {
  • gdk_draw_pixmap(widget->window, crayon,pixmap, 0,0,0,0, IMAGE_WIDTH*N, IMAGE_HEIGHT*N);
  • }
#include <gtk/gtk.h>
#include <stdio.h>
#include <math.h>
#include <fcntl.h>


#define IMAGE_WIDTH	64
#define IMAGE_HEIGHT	64
#define N 5

struct liste{
  int num;
  struct liste *next;
};

struct matrice{
  int num;
  struct liste *liens;
  int tableau [N][N]; 
};

struct liste_matrices{
  struct matrice *m;
  struct liste_matrices *next;
};

struct liste_liste_matrices{
  struct liste_matrices *l;
  struct liste_liste_matrices *next;
};


/**

 * par default,pr une case on a une longueur et une largeur de 64;
 * il nous suffira de multiplier ces valeurs par le nombre de grains au depart d un tas...
 **/


typedef struct matrice Matrice;
typedef struct liste_matrices Liste;
guchar rgbbuf[IMAGE_WIDTH * IMAGE_HEIGHT * 3];
GdkPixmap *pixmap;
GdkGC *crayon;
GdkColor couleur;
GdkWindow *mywindow;


gboolean on_darea_expose (GtkWidget *widget,
			  GdkEventExpose *event,
			  gpointer user_data);



void dessine_carre (gint intensite,gint absc,gint ord) {

  couleur.red = couleur.green = couleur.blue = intensite;
  gdk_colormap_alloc_color(gdk_colormap_get_system(),&couleur,FALSE,TRUE);
  gdk_gc_set_foreground(crayon,&couleur);
  gdk_draw_rectangle(pixmap,crayon,1,ord,absc,IMAGE_WIDTH,IMAGE_HEIGHT);
  
}

void dessine_selon_matrice (Matrice *mat) {

  /*
   * il faut initialiser la taille de la fentre ->N*IMAGE_HEIGHT
   * il faut determiner le nombre de case a afficher.-> cf taille de la matrice
   * il faut initialiser l intensite max pr l element de valeur la plus grde
   * pour chaque element de la matrice,il faut calculer l intensite. 
   */
 
  gint unite,i,j,val_cur,tmp1,tmp2;
  unite=65000/N;

  for(i=0;i < N;i++){
     for(j=0;j < N;j++){
      tmp1=i+1;
      tmp2=j+1;
      val_cur=65000-unite*mat->tableau[i][j];
      dessine_carre(val_cur,tmp1*64-64,tmp2*64-64);
      
      /************
		   printf ("yo %d \n",val_cur);
		   printf ("yo %d \n",tmp1*64-64);
		   printf ("yo %d \n",tmp2*64-64);
      **************/
      
    }
  }

}


void animation(Liste *lst){
  /*
   * il faut dessiner selon la matrice pour chaques matrices de la liste...
   * 
   */
  
  while (lst->next!=NULL) {
    dessine_selon_matrice (lst->m);
    gdk_draw_pixmap(mywindow, crayon,pixmap, 0,0,0,0, IMAGE_WIDTH*N, IMAGE_HEIGHT*N);
    printf("yo %d\n",lst->m->num);
    lst=lst->next;
    
    sleep(1);
     
  }
 
  dessine_selon_matrice (lst->m);
  sleep(1);
  gdk_draw_pixmap(mywindow, crayon,pixmap, 0,0,0,0, IMAGE_WIDTH*N, IMAGE_HEIGHT*N);
  printf("yoda %d\n",lst->m->num);
  
}

int main (int argc, char *argv[]) {

  GtkWidget *window, *darea;
  gint intensite,absc,ord,i2;
  int p,q,z;
  Matrice *mat,*mat2,*mat3,*mat4,*mat5,*mat6,*mat7,*mat8,*mat9;
  Liste *lst,*lst2,*lst3,*lst4,*lst5,*lst6,*lst7,*lst8,*lst9;
  gtk_init (&argc, &argv);
  gdk_rgb_init();

  gdk_colormap_alloc_color(gdk_colormap_get_system(),&couleur,FALSE,TRUE);
  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  darea = gtk_drawing_area_new();
  gtk_drawing_area_size (GTK_DRAWING_AREA (darea), IMAGE_WIDTH*N, IMAGE_HEIGHT*N);
  
  gtk_container_add (GTK_CONTAINER (window), darea);

  gtk_signal_connect (GTK_OBJECT (darea), "expose-event",
                      GTK_SIGNAL_FUNC (on_darea_expose), NULL);
  
  gtk_widget_show_all (window);
  pixmap=gdk_pixmap_new(window->window,IMAGE_WIDTH*N,IMAGE_HEIGHT*N,gdk_window_get_visual(window->window)->depth);
  crayon=gdk_gc_new(pixmap);
  gdk_gc_set_line_attributes(crayon,1,GDK_LINE_SOLID,GDK_CAP_BUTT,GDK_JOIN_BEVEL);

  z=0;
  mywindow=darea->window;
  /******* test 1 *****
	   intensite=0;
	   absc=128;
	   ord=0;
	   
	   dessine_carre(intensite,absc,ord);
  ***********************/
  

  /********* test 2 *****
	     mat = (Matrice*)malloc(sizeof(Matrice));
	     
	     mat->tableau[0][0]=5;
	     mat->tableau[0][1]=4;
	     mat->tableau[0][2]=3;
	     mat->tableau[0][3]=2;
	     mat->tableau[0][4]=1;
	     
	     
	     for(p=1;p<N;p++){
	       for(q=0;q<N;q++){
		 mat->tableau[p][q]=abs(p-q);
		
	       }
	     } 
	     
	     dessine_selon_matrice (mat);
  ***********************/   


  /********* test 3 *****
	     mat = (Matrice*)malloc(sizeof(Matrice));
	     mat2 = (Matrice*)malloc(sizeof(Matrice));
	     mat3 = (Matrice*)malloc(sizeof(Matrice));
	     mat4 = (Matrice*)malloc(sizeof(Matrice));
	     mat5 = (Matrice*)malloc(sizeof(Matrice));
	     mat6 = (Matrice*)malloc(sizeof(Matrice));
	     mat7 = (Matrice*)malloc(sizeof(Matrice));
	     mat8 = (Matrice*)malloc(sizeof(Matrice));
	     mat9 = (Matrice*)malloc(sizeof(Matrice));
	     
	     lst=(Liste*)malloc(sizeof(Liste));
	     lst2=(Liste*)malloc(sizeof(Liste));
	     lst3=(Liste*)malloc(sizeof(Liste));
	     lst4=(Liste*)malloc(sizeof(Liste));
	     lst5=(Liste*)malloc(sizeof(Liste));
	     lst6=(Liste*)malloc(sizeof(Liste));
	     lst7=(Liste*)malloc(sizeof(Liste));
	     lst8=(Liste*)malloc(sizeof(Liste));
	     lst9=(Liste*)malloc(sizeof(Liste));
	     
	     
	     
	     mat->num=0;
	     mat2->num=2;
	     mat3->num=3;
	     mat4->num=4;
	     mat5->num=5;
	     
	     
	     for(p=0;p<N;p++){
	     for(q=0;q<N;q++){
	     
	     mat->tableau[p][q]=0;
	     mat2->tableau[p][q]=0;
	     mat3->tableau[p][q]=0;
	     mat4->tableau[p][q]=0;
	     mat5->tableau[p][q]=0;
	     mat6->tableau[p][q]=0;
	     mat7->tableau[p][q]=0;
	     mat8->tableau[p][q]=0;
	     mat9->tableau[p][q]=0;
	     
	     
	     }
	     }
	     
	     mat->tableau[0][0]=3;
	     mat2->tableau[0][1]=3;
	     mat3->tableau[0][2]=3;
	     mat4->tableau[1][2]=3;
	     mat5->tableau[1][1]=3;
	     mat6->tableau[1][0]=3;
	     mat7->tableau[2][0]=3;
	     mat8->tableau[2][1]=3;
	     mat9->tableau[2][2]=3;
	     
	     lst->m=(Matrice*)malloc(sizeof(Matrice));
	     lst->next =(Liste*)malloc(sizeof(Liste));
	     lst->m=mat;
	     lst->next =lst2;
	     
	     lst2->m=(Matrice*)malloc(sizeof(Matrice));
	     lst2->next = (Liste*)malloc(sizeof(Liste));
	     lst2->m=mat2;
	     lst2->next=lst3;
	     
	     lst3->m=(Matrice*)malloc(sizeof(Matrice));
	     lst3->next = (Liste*)malloc(sizeof(Liste));
	     lst3->m=mat3;
	     lst3->next=lst4;
	     
	     lst4->m=(Matrice*)malloc(sizeof(Matrice));
	     lst4->next = (Liste*)malloc(sizeof(Liste));
	     lst4->m=mat4;
	     lst4->next=lst5;
	     
	     lst5->m=(Matrice*)malloc(sizeof(Matrice));
	     lst5->next = (Liste*)malloc(sizeof(Liste));
	     lst5->m=mat5;
	     lst5->next=lst6;
	     
	     lst6->m=(Matrice*)malloc(sizeof(Matrice));
	     lst6->next =(Liste*)malloc(sizeof(Liste));
	     lst6->m=mat6;
	     lst6->next =lst7;
	     
	     lst7->m=(Matrice*)malloc(sizeof(Matrice));
	     lst7->next = (Liste*)malloc(sizeof(Liste));
	     lst7->m=mat7;
	     lst7->next=lst8;
	     
	     lst8->m=(Matrice*)malloc(sizeof(Matrice));
	     lst8->next = (Liste*)malloc(sizeof(Liste));
	     lst8->m=mat8;
	     lst8->next=lst9;
	     
	     lst9->m=(Matrice*)malloc(sizeof(Matrice));
	     lst9->next = (Liste*)malloc(sizeof(Liste));
	     lst9->m=mat9;
	     lst9->next=lst;
	     
	     animation(lst);
	     
  ***************/
  
			
	     /************** test 4 **********
					
		  mat = (Matrice*)malloc(sizeof(Matrice));
		  mat2 = (Matrice*)malloc(sizeof(Matrice));
		  mat3 = (Matrice*)malloc(sizeof(Matrice));
		  mat4 = (Matrice*)malloc(sizeof(Matrice));
		  mat5 = (Matrice*)malloc(sizeof(Matrice));
		  
		  lst=(Liste*)malloc(sizeof(Liste));
		  lst2=(Liste*)malloc(sizeof(Liste));
		  lst3=(Liste*)malloc(sizeof(Liste));
		  lst4=(Liste*)malloc(sizeof(Liste));
		  lst5=(Liste*)malloc(sizeof(Liste));
		  
		  
		  mat->num=0;
		  mat2->num=2;
		  mat3->num=3;
		  mat4->num=4;
		  mat5->num=5;
		  
		  
		  for(p=0;p<N;p++){
		  for(q=0;q<N;q++){
		  
		  mat->tableau[p][q]=abs(q-p);
		  mat2->tableau[p][q]=abs(q-p)+4*p;
		  mat3->tableau[p][q]=abs(p-q)-5*q;
		  mat4->tableau[p][q]=p+q;
		  mat5->tableau[p][q]=abs(q-p);
		  }
		  }
		  
		  lst->m=(Matrice*)malloc(sizeof(Matrice));
		  lst->next =(Liste*)malloc(sizeof(Liste));
		  lst->m=mat;
		  lst->next =lst2;
		  
		  lst2->m=(Matrice*)malloc(sizeof(Matrice));
		  lst2->next = (Liste*)malloc(sizeof(Liste));
		  lst2->m=mat2;
		  lst2->next=lst3;
		  
		  lst3->m=(Matrice*)malloc(sizeof(Matrice));
		  lst3->next = (Liste*)malloc(sizeof(Liste));
		  lst3->m=mat3;
		  lst3->next=lst4;
		  
		  lst4->m=(Matrice*)malloc(sizeof(Matrice));
		  lst4->next = (Liste*)malloc(sizeof(Liste));
		  lst4->m=mat4;
		  lst4->next=lst5;
		  
		  lst5->m=(Matrice*)malloc(sizeof(Matrice));
		  lst5->next = (Liste*)malloc(sizeof(Liste));
		  lst5->m=mat5;
		  lst5->next=lst;
		  
		  animation(lst);
		  
  ***********************/
		  
		  
  /************* test 5 **********/
  
  
		 mat = (Matrice*)malloc(sizeof(Matrice));
		  mat2 = (Matrice*)malloc(sizeof(Matrice));
		  mat3 = (Matrice*)malloc(sizeof(Matrice));
		  mat4 = (Matrice*)malloc(sizeof(Matrice));
		  mat5 = (Matrice*)malloc(sizeof(Matrice));
		  
		  lst=(Liste*)malloc(sizeof(Liste));
		  lst2=(Liste*)malloc(sizeof(Liste));
		  lst3=(Liste*)malloc(sizeof(Liste));
		  lst4=(Liste*)malloc(sizeof(Liste));
		  lst5=(Liste*)malloc(sizeof(Liste));
		  
		  
		  mat->num=0;
		  mat2->num=2;
		  mat3->num=3;
		  mat4->num=4;
		  mat5->num=5;
		  
		  
		  for(p=0;p<N;p++){
		    for(q=0;q<N;q++){
		      
		      mat->tableau[p][q]=0;
		      mat2->tableau[p][q]=0;
		      mat3->tableau[p][q]=0;
		      mat4->tableau[p][q]=0;
		      mat5->tableau[p][q]=0;
		    }
		  }
		  mat->tableau[0][0]=5;
		  mat2->tableau[0][0]=4;
		  mat2->tableau[0][1]=1;
		  mat3->tableau[0][0]=3;
		  mat3->tableau[0][1]=1;
		  mat3->tableau[1][0]=1;
		  mat4->tableau[0][0]=2;
		  mat4->tableau[0][1]=2;
		  mat4->tableau[1][0]=1;
		  mat5->tableau[0][0]=2;
		  mat5->tableau[0][1]=1;
		  mat5->tableau[1][0]=1;
		  mat5->tableau[1][1]=1;

		  lst->m=(Matrice*)malloc(sizeof(Matrice));
		  lst->next =(Liste*)malloc(sizeof(Liste));
		  lst->m=mat;
		  lst->next =lst2;
		  
		  lst2->m=(Matrice*)malloc(sizeof(Matrice));
		  lst2->next = (Liste*)malloc(sizeof(Liste));
		  lst2->m=mat2;
		  lst2->next=lst3;
		  
		  lst3->m=(Matrice*)malloc(sizeof(Matrice));
		  lst3->next = (Liste*)malloc(sizeof(Liste));
		  lst3->m=mat3;
		  lst3->next=lst4;
		  
		  lst4->m=(Matrice*)malloc(sizeof(Matrice));
		  lst4->next = (Liste*)malloc(sizeof(Liste));
		  lst4->m=mat4;
		  lst4->next=lst5;
		  
		  lst5->m=(Matrice*)malloc(sizeof(Matrice));
		  lst5->next = (Liste*)malloc(sizeof(Liste));
		  lst5->m=mat5;
		  lst5->next=lst;
		  
		  animation(lst);
		  







		  /****************************/
  gtk_main();
  return 0;
}



gboolean
on_darea_expose (GtkWidget *widget,
		 GdkEventExpose *event,
		 gpointer user_data)
{
 
  gdk_draw_pixmap(widget->window, crayon,pixmap, 0,0,0,0, IMAGE_WIDTH*N, IMAGE_HEIGHT*N);
}



 Sources du même auteur

SYSTÈME DE DÉCOUPE DE FICHIER

 Sources de la même categorie

Source avec Zip Source avec une capture INFORMATION GTK CONCERNANT UNE TOUCHE par Phelim
Source avec Zip Source avec une capture BINARY CLOCK GTK AVEC CONTRÔLE EN TRAY SOUS LINUX par dje_jay
Source avec Zip Source avec une capture [GTK+] FENÊTRE POPUP ANIMÉE EN BAS À DROITE DE L' ÉCRAN par katsankat
Source avec Zip GTK _CALCUL par jabirmed
Source avec Zip DICTIONNER RECHERCHE GTK par jabirmed

Commentaires et avis

Commentaire de DeAtHCrAsH le 08/06/2004 14:57:23

Un screen et une capture d'écran seront les bienvenues surtout pour une application graphique =)

Commentaire de xarier le 09/06/2004 13:06:14

Hi j'ai une question peut etre bete mais j'ai pas trouver ou je peut telecharger GTK POUR VC++

Commentaire de trystan007 le 22/04/2005 19:38:51

http://www.dropline.net/gtk/ Ca marche pour Dev C++, amis je pense qu'on peut l'utiliser avec VC++

 Ajouter un commentaire




Nos sponsors


Sondage...

CalendriCode

Mai 2012
LMMJVSD
 123456
78910111213
14151617181920
21222324252627
28293031   

Consulter la suite du CalendriCode

A découvrir



 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,484 sec (4)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales