void ColorScale::draw(sf::Image& img,const sf::Vector2f& start,const sf::Vector2f& end,GradientStyle::GradientStyle style, int size) const { sf::Color (*pFunction)(sf::Color*,int,const sf::Vector2f&,const sf::Vector2f&,int,int); sf::Color* tab =new sf::Color[size]; fillTab(tab,size); switch (style) { case GradientStyle::Linear : pFunction = GradientLinear; break; case GradientStyle::Circle : pFunction = GradientCircle; break; case GradientStyle::Radial : pFunction = GradientRadial; break; case GradientStyle::Reflex : pFunction = GradientReflex; break; default: pFunction = GradientLinear; break; } for(int i=0;i<img.GetWidth();i++) { for(int j=0;j<img.GetHeight();j++) { img.SetPixel(i,j,pFunction(tab,size,start,end,i,j)); } } delete[] tab; }
int main(int argc, char **argv){ if(argc != 3){ printf("Veuillez entrez la taille du tableau en premier parametre de lancement svp\n"); printf("Veuillez entrez le mode verbeux ou non en second parametre\n"); return EXIT_FAILURE; } if(atoi(argv[2]) == 1){ thread_set_verbose(TRUE); } else{ thread_set_verbose(FALSE); } srand(time(NULL)); int *x = malloc(atoi(argv[1])*sizeof(int)); fillTab(x, atoi(argv[1])); struct arrayAndIndexes *theStruc = malloc(sizeof (struct arrayAndIndexes)); theStruc->x = x; theStruc->left = 0; theStruc->right = atoi(argv[1])-1; printf("Avant quickSort:\n"); debugTab(theStruc->x, atoi(argv[1])); quickSort((void*) theStruc); printf("Apres quickSort:\n"); debugTab(theStruc->x, atoi(argv[1])); free(theStruc); free(x); return EXIT_SUCCESS; }
int main(int argc, char **argv){ if(argc != 2){ printf("Veuillez entrez la taille du tableau en parametre de lancement svp\n"); return EXIT_FAILURE; } srand(time(NULL)); int *x = malloc(atoi(argv[1])*sizeof(int)); fillTab(x, atoi(argv[1])); struct arrayAndIndexes *theStruc = malloc(sizeof (struct arrayAndIndexes)); theStruc->x = x; theStruc->left = 0; theStruc->right = atoi(argv[1])-1; printf("Avant quickSort:\n"); debugTab(theStruc->x, atoi(argv[1])); quickSort((void*) theStruc); printf("Apres quickSort:\n"); debugTab(theStruc->x, atoi(argv[1])); free(theStruc); return EXIT_SUCCESS; }