# divers.c File Reference

`#include <SDL.h>`
`#include <string.h>`
`#include <strings.h>`
`#include <stdlib.h>`
`#include "struct.h"`
`#include "sdlscreen.h"`
`#include "global.h"`
`#include "erreurs.h"`
`#include "boutons.h"`
`#include "moteur.h"`
`#include "divers.h"`
`#include "clavier.h"`
`#include "windows.h"`
`#include "palette.h"`
`#include "input.h"`
`#include <sys/sysinfo.h>`

## Functions
word | Palette_Compter_nb_couleurs_utilisees (dword *Tableau)
void | Set_palette (T_Palette Palette)
void | Set_color (byte Couleur, byte Rouge, byte Vert, byte Bleu)
void | Attendre_fin_de_click (void)
void | Effacer_image_courante_Stencil (byte Couleur, byte *Pochoir)
void | Effacer_image_courante (byte Couleur)
void | Sensibilite_souris (__attribute__((unused)) word X, __attribute__((unused)) word Y)
void | Initialiser_chrono (dword Delai)
void | Wait_VBL (void)
void | Pixel_dans_brosse (word X, word Y, byte Couleur)
byte | Lit_pixel_dans_brosse (word X, word Y)
byte | Lit_pixel_dans_ecran_courant (word X, word Y)
void | Pixel_dans_ecran_courant (word X, word Y, byte Couleur)
void | Remplacer_une_couleur (byte Ancienne_couleur, byte Nouvelle_couleur)
void | Ellipse_Calculer_limites (short Rayon_horizontal, short Rayon_vertical)
byte | Pixel_dans_ellipse (void)
byte | Pixel_dans_cercle (void)
void | Copier_une_partie_d_image_dans_une_autre (byte *Source, word S_Pos_X, word S_Pos_Y, word Largeur, word Hauteur, word Largeur_source, byte *Destination, word D_Pos_X, word D_Pos_Y, word Largeur_destination)
byte | Lit_pixel_dans_ecran_brouillon (word X, word Y)
void | Rotate_90_deg_LOWLEVEL (byte *Source, byte *Destination)
void | Remap_general_LOWLEVEL (byte *Table_conv, byte *Buffer, short Largeur, short Hauteur, short Largeur_buffer)
void | Copier_image_dans_brosse (short Debut_X, short Debut_Y, short Brosse_Largeur, short Brosse_Hauteur, word Largeur_image)
byte | Lit_pixel_dans_ecran_feedback (word X, word Y)
dword | Round_div (dword Numerateur, dword Diviseur)
byte | Effet_Trame (word X, word Y)
void | Set_mouse_position (void)
void | Remplacer_toutes_les_couleurs_dans_limites (byte *Table_de_remplacement)
byte | Lit_pixel_dans_ecran_backup (word X, word Y)
void | Palette_256_to_64 (T_Palette Palette)
void | Palette_64_to_256 (T_Palette Palette)
byte | Effet_Colorize_interpole (word X, word Y, byte Couleur)
byte | Effet_Colorize_additif (word X, word Y, byte Couleur)
byte | Effet_Colorize_soustractif (word X, word Y, byte Couleur)
void | Tester_chrono (void)
void | Flip_Y_LOWLEVEL (void)
void | Flip_X_LOWLEVEL (void)
void | Rotate_180_deg_LOWLEVEL (void)
void | Tempo_jauge (byte Vitesse)
void | Scroll_picture (short Decalage_X, short Decalage_Y)
void | Zoomer_une_ligne (byte *Ligne_originale, byte *Ligne_zoomee, word Facteur, word Largeur)
unsigned long | Memoire_libre (void)
void | Num2str (dword Nombre, char *Chaine, byte Taille)
int | Str2num (char *Chaine)
short | Round (float Valeur)
short | Round_div_max (short Numerateur, short Diviseur)
int | Min (int A, int B)
int | Max (int A, int B)
char * | Libelle_mode (int Mode)
int | Conversion_argument_mode (const char *Argument)

## Function Documentation

word Palette_Compter_nb_couleurs_utilisees | ( | dword * | Tableau | ) |

References Principal_Ecran, Principal_Hauteur_image, and Principal_Largeur_image.

Referenced by Bouton_Stats(), Compter_nb_couleurs_utilisees(), Save_CEL(), Save_KCF(), and Trouver_recon().

void Set_palette | ( | T_Palette | Palette | ) |

References Ecran_SDL, and Palette_Scale_Component().

Referenced by Bouton_Kill(), Bouton_Load_ou_Save(), Bouton_Page(), Bouton_Palette(), Bouton_Palette_secondaire(), Bouton_Redo(), Bouton_Undo(), Erreur_fonction(), Get_colors_from_brush(), Initialiser_mode_video(), Initialiser_preview_24b(), Load_BMP(), Load_GIF(), Load_IMG(), Load_KCF(), Load_LBM(), Load_PAL(), Load_PC1(), Load_PCX(), Load_PI1(), Load_picture(), Load_PKM(), Load_PNG(), Load_SCx(), Remapper_fileselect(), and Save_picture().

void Set_color | ( | byte | Couleur,
|  | byte | Rouge,
|  | byte | Vert,
|  | byte | Bleu |
| ) |  |  |

References Ecran_SDL.

Referenced by Modifier_Bleu(), Modifier_Rouge(), and Modifier_Vert().

void Attendre_fin_de_click | ( | void |  | ) |

References Get_input(), Mouse_K, and Wait_VBL().

Referenced by Bouton_Degrades(), Bouton_Load_ou_Save(), Bouton_Message_initial(), Bouton_Palette(), Bouton_Resol(), Bouton_Settings(), Bouton_Spray_Menu(), Cercle_degrade_12_8(), Courbe_3_points_12_11(), Courbe_4_points_2_9(), Ellipse_degradee_12_8(), Enclencher_bouton(), Etirer_brosse_12_0(), Fenetre_aide(), Fill_1_0(), Fill_2_0(), Filled_polyform_12_8(), K_Ligne_12_7(), Lignes_centrees_12_7(), Loupe_12_0(), Menu_Shade(), Menu_Tag_couleurs(), Polybrosse_12_8(), Polyfill_12_9(), Polyform_12_8(), Polygone_12_9(), Rectangle_Degrade_0_9(), Remplacer_1_0(), Remplacer_2_0(), and Tourner_brosse_12_0().

void Effacer_image_courante_Stencil | ( | byte | Couleur,
|  | byte * | Pochoir |
| ) |  |  |

References Ecran, Principal_Hauteur_image, and Principal_Largeur_image.

Referenced by Bouton_Clear(), and Bouton_Clear_colore().

void Effacer_image_courante | ( | byte | Couleur | ) |

References Principal_Ecran, Principal_Hauteur_image, and Principal_Largeur_image.

Referenced by Bouton_Clear(), and Bouton_Clear_colore().

void Sensibilite_souris | ( | __attribute__((unused)) word | X,
|  | __attribute__((unused)) word | Y |
| ) |  |  |

Referenced by Bouton_Settings(), and Initialiser_mode_video().

void Initialiser_chrono | ( | dword | Delai | ) |

References Chrono_cmp, and Chrono_delay.

Referenced by Bouton_Load_ou_Save().

void Wait_VBL | ( | void |  | ) |

Referenced by Attendre_click_dans_palette(), Attendre_fin_de_click(), Bouton_Message_initial(), Deplacer_fenetre(), Deplacer_Split(), Fenetre_Bouton_clicke(), Fenetre_bouton_normal_click(), Fenetre_Dropdown_click(), Freehand_Mode2_1_0(), Freehand_Mode2_1_2(), Freehand_Mode2_2_0(), Freehand_Mode2_2_2(), Gestion_principale(), Readline_ex(), Recuperer_couleur_derriere_fenetre(), Redefinir_controle(), and Tempo_jauge().

void Pixel_dans_brosse | ( | word | X,
|  | word | Y,
|  | byte | Couleur |
| ) |  |  |

References Brosse, and Brosse_Largeur.

Referenced by Bouton_Trame_Menu(), Capturer_brosse_au_lasso(), Nibble_brush(), Outline_brush(), Pixel_Chargement_dans_brosse(), and Pixel_figure_Dans_brosse().

byte Lit_pixel_dans_brosse | ( | word | X,
|  | word | Y |
| ) |  |  |

References Brosse, and Brosse_Largeur.

Referenced by Afficher_pinceau(), Bouton_Trame_Menu(), Calculer_quad_texture(), Capturer_brosse_au_lasso(), Dessiner_quad_texture_preview(), Effet_Tiling(), Etirer_brosse(), Etirer_brosse_preview(), Get_colors_from_brush(), Remap_brosse(), and Sauver_image().

byte Lit_pixel_dans_ecran_courant | ( | word | X,
|  | word | Y |
| ) |  |  |

References Principal_Ecran, and Principal_Largeur_image.

Referenced by Afficher_pinceau(), Afficher_pixel(), Capturer_brosse_au_lasso(), Effacer_pinceau(), Effet_Smooth(), Fill(), Pipette_1_1(), Pipette_2_1(), Pixel_figure_Effacer_preview(), Pixel_figure_Preview_auto(), Print_coordonnees(), Remplacer(), Remplir(), Sauver_image(), and Save_PNG().

void Pixel_dans_ecran_courant | ( | word | X,
|  | word | Y,
|  | byte | Couleur |
| ) |  |  |

References Principal_Ecran, and Principal_Largeur_image.

Referenced by Afficher_pixel(), Capturer_brosse(), Capturer_brosse_au_lasso(), Fill(), Pixel_Chargement_dans_ecran_courant(), and Remplir().

void Remplacer_une_couleur | ( | byte | Ancienne_couleur,
|  | byte | Nouvelle_couleur |
| ) |  |  |

References Principal_Ecran, Principal_Hauteur_image, Principal_Largeur_image, and UpdateRect().

Referenced by Remplacer().

void Ellipse_Calculer_limites | ( | short | Rayon_horizontal,
|  | short | Rayon_vertical |
| ) |  |  |

References Ellipse_Limite, Ellipse_Rayon_horizontal_au_carre, and Ellipse_Rayon_vertical_au_carre.

Referenced by Tracer_ellipse_degradee(), Tracer_ellipse_pleine(), and Tracer_ellipse_vide_General().

byte Pixel_dans_ellipse | ( | void |  | ) |

References Ellipse_Curseur_X, Ellipse_Curseur_Y, Ellipse_Limite, Ellipse_Rayon_horizontal_au_carre, and Ellipse_Rayon_vertical_au_carre.

Referenced by Tracer_ellipse_degradee(), Tracer_ellipse_pleine(), and Tracer_ellipse_vide_General().

byte Pixel_dans_cercle | ( | void |  | ) |

References Cercle_Curseur_X, Cercle_Curseur_Y, and Cercle_Limite.

Referenced by Tracer_cercle_degrade(), Tracer_cercle_plein(), and Tracer_cercle_vide_General().

void Copier_une_partie_d_image_dans_une_autre | ( | byte * | Source,
|  | word | S_Pos_X,
|  | word | S_Pos_Y,
|  | word | Largeur,
|  | word | Hauteur,
|  | word | Largeur_source,
|  | byte * | Destination,
|  | word | D_Pos_X,
|  | word | D_Pos_Y,
|  | word | Largeur_destination |
| ) |  |  |

Referenced by Afficher_pinceau(), Nibble_brush(), Outline_brush(), Redimentionner_image(), and Remplir().

byte Lit_pixel_dans_ecran_brouillon | ( | word | X,
|  | word | Y |
| ) |  |  |

References Brouillon_Ecran, and Brouillon_Largeur_image.

Referenced by Afficher_pixel(), and Remap_picture().

void Rotate_90_deg_LOWLEVEL | ( | byte * | Source,
|  | byte * | Destination |
| ) |  |  |

References Brosse_Hauteur, and Brosse_Largeur.

Referenced by Rotate_90_deg().

void Remap_general_LOWLEVEL | ( | byte * | Table_conv,
|  | byte * | Buffer,
|  | short | Largeur,
|  | short | Hauteur,
|  | short | Largeur_buffer |
| ) |  |  |

Referenced by Remap_brosse(), Remap_image_HIGH(), and Remap_picture().

void Copier_image_dans_brosse | ( | short | Debut_X,
|  | short | Debut_Y,
|  | short | Brosse_Largeur,
|  | short | Brosse_Hauteur,
|  | word | Largeur_image |
| ) |  |  |

References Brosse, and Principal_Ecran.

Referenced by Capturer_brosse().

byte Lit_pixel_dans_ecran_feedback | ( | word | X,
|  | word | Y |
| ) |  |  |

References FX_Feedback_Ecran, and Principal_Largeur_image.

Referenced by Effet_Quick_shade(), Effet_Shade(), and Effet_Smooth().

dword Round_div | ( | dword | Numerateur,
|  | dword | Diviseur |
| ) |  |  |

Referenced by Courbe_4_points_0_5(), Effet_Smooth(), Fenetre_Dessiner_jauge(), Fenetre_Numero_bouton_clicke(), and Reduce_palette().

byte Effet_Trame | ( | word | X,
|  | word | Y |
| ) |  |  |

References Trame, Trame_Hauteur, and Trame_Largeur.

Referenced by Afficher_pixel().

void Set_mouse_position | ( | void |  | ) |

References Mouse_X, Mouse_Y, Pixel_height, and Pixel_width.

void Remplacer_toutes_les_couleurs_dans_limites | ( | byte * | Table_de_remplacement | ) |

References Limite_Bas, Limite_Droite, Limite_Gauche, Limite_Haut, Principal_Ecran, and Principal_Largeur_image.

Referenced by Remplir().

byte Lit_pixel_dans_ecran_backup | ( | word | X,
|  | word | Y |
| ) |  |  |

References Ecran_backup, and Principal_Largeur_image.

Referenced by Remplir().

void Palette_256_to_64 | ( | T_Palette | Palette | ) |

Referenced by Load_LBM(), Save_PAL(), Save_PKM(), and Save_SCx().

void Palette_64_to_256 | ( | T_Palette | Palette | ) |

Referenced by Load_LBM(), Load_PAL(), Load_PKM(), and Load_SCx().

byte Effet_Colorize_interpole | ( | word | X,
|  | word | Y,
|  | byte | Couleur |
| ) |  |  |

References FX_Feedback_Ecran, Meilleure_couleur(), Principal_Largeur_image, Principal_Palette, Table_de_multiplication_par_Facteur_A, and Table_de_multiplication_par_Facteur_B.

Referenced by Bouton_Colorize_Mode().

byte Effet_Colorize_additif | ( | word | X,
|  | word | Y,
|  | byte | Couleur |
| ) |  |  |

References FX_Feedback_Ecran, Meilleure_couleur(), Principal_Largeur_image, and Principal_Palette.

Referenced by Bouton_Colorize_Mode().

byte Effet_Colorize_soustractif | ( | word | X,
|  | word | Y,
|  | byte | Couleur |
| ) |  |  |

References FX_Feedback_Ecran, Meilleure_couleur(), Principal_Largeur_image, and Principal_Palette.

Referenced by Bouton_Colorize_Mode().

void Tester_chrono | ( | void |  | ) |

References Chrono_cmp, Chrono_delay, and Etat_chrono.

Referenced by Bouton_Load_ou_Save().

void Flip_Y_LOWLEVEL | ( | void |  | ) |

References Brosse, Brosse_Hauteur, and Brosse_Largeur.

Referenced by Bouton_Brush_FX(), and Gestion_principale().

void Flip_X_LOWLEVEL | ( | void |  | ) |

References Brosse, Brosse_Hauteur, and Brosse_Largeur.

Referenced by Bouton_Brush_FX(), and Gestion_principale().

void Rotate_180_deg_LOWLEVEL | ( | void |  | ) |

References Brosse, Brosse_Hauteur, and Brosse_Largeur.

Referenced by Bouton_Brush_FX(), and Gestion_principale().

void Tempo_jauge | ( | byte | Vitesse | ) |

References Get_input(), Mouse_K, and Wait_VBL().

Referenced by Fenetre_Numero_bouton_clicke(), and Fenetre_Numero_bouton_touche().

void Scroll_picture | ( | short | Decalage_X,
|  | short | Decalage_Y |
| ) |  |  |

References Ecran_backup, Principal_Ecran, Principal_Hauteur_image, Principal_Largeur_image, and UpdateRect().

Referenced by Scroll_12_4().

void Zoomer_une_ligne | ( | byte * | Ligne_originale,
|  | byte * | Ligne_zoomee,
|  | word | Facteur,
|  | word | Largeur |
| ) |  |  |

Referenced by Afficher_partie_de_l_ecran_zoomee_Double(), Afficher_partie_de_l_ecran_zoomee_Simple(), Afficher_partie_de_l_ecran_zoomee_Tall(), Afficher_partie_de_l_ecran_zoomee_Wide(), Clear_brush_zoom_Double(), Clear_brush_zoom_Simple(), Clear_brush_zoom_Tall(), Clear_brush_zoom_Wide(), Display_brush_Color_zoom_Double(), Display_brush_Color_zoom_Simple(), Display_brush_Color_zoom_Tall(), Display_brush_Color_zoom_Wide(), Display_brush_Mono_zoom_Double(), Display_brush_Mono_zoom_Simple(), Display_brush_Mono_zoom_Tall(), and Display_brush_Mono_zoom_Wide().

unsigned long Memoire_libre | ( | void |  | ) |

Referenced by Bouton_Stats(), Creer_nouvelle_page(), Emprunt_memoire_de_page_possible(), Emprunter_memoire_de_page(), and Nouvelle_page_possible().

void Num2str | ( | dword | Nombre,
|  | char * | Chaine,
|  | byte | Taille |
| ) |  |  |

Referenced by Aff_coords_rel_ou_abs(), Afficher_couleur_case_selectionnee(), Afficher_couleur_selectionnee(), Afficher_liste_modes(), Afficher_menu(), Bouton_Colorize_Menu(), Bouton_Degrades(), Bouton_Menu_Grille(), Bouton_Palette(), Bouton_Palette_secondaire(), Bouton_Quick_shade_Menu(), Bouton_Resol(), Bouton_Settings(), Bouton_Smooth_Menu(), Bouton_Spray_Menu(), Bouton_Texte(), Bouton_Tiling_Menu(), Bouton_Trame_Menu(), Brosse_12_5(), Cercle_12_5(), Cercle_degrade_12_6(), Compter_nb_couleurs_utilisees(), Etirer_brosse_0_7(), Etirer_brosse_1_7(), Formate_composante(), Initialiser_preview(), Menu_Shade(), Pipette_1_1(), Pipette_2_1(), Print_coordonnees(), Rectangle_12_5(), Rectangle_Degrade_12_5(), Reduce_palette(), Settings_Afficher_config(), Spray_Rafficher_infos(), Tourner_brosse_0_5(), and Tourner_brosse_1_5().

int Str2num | ( | char * | Chaine | ) |

short Round | ( | float | Valeur | ) |

Referenced by Calculer_courbe_3_points(), Calculer_quad_texture(), Calculer_split(), Dessiner_quad_texture_preview(), Distance(), Tourner_brosse_0_5(), Tracer_courbe_General(), and Transformer_point().

short Round_div_max | ( | short | Numerateur,
|  | short | Diviseur |
| ) |  |  |

Referenced by Initialiser_preview().

int Min | ( | int | A,
|  | int | B |
| ) |  |  |

Referenced by Bouton_Texte(), Calculer_quad_texture(), Changer_nombre_de_pages_d_une_liste(), Cursor_displace(), Dessiner_quad_texture_preview(), Dessiner_trames_predefinies(), Etirer_brosse_preview(), Fill(), Flush_update(), Load_GIF(), Load_PNG(), Rectangle_Degrade_0_5(), Rectangle_Degrade_0_9(), Rectangle_Degrade_12_7(), Redimentionner_image(), Tourner_brosse(), Tourner_brosse_preview(), and Tracer_courbe_General().

int Max | ( | int | A,
|  | int | B |
| ) |  |  |

Referenced by Afficher_curseur(), Cursor_displace(), Dessiner_quad_texture_preview(), Effacer_curseur(), Etirer_brosse_preview(), Rectangle_Degrade_0_5(), Rectangle_Degrade_0_9(), Rectangle_Degrade_12_7(), Tourner_brosse(), Tourner_brosse_preview(), and Tracer_courbe_General().

char* Libelle_mode | ( | int | Mode | ) |

References Hauteur, Largeur, and Mode_video.

Referenced by Afficher_syntaxe(), Conversion_argument_mode(), and Sauver_INI().

int Conversion_argument_mode | ( | const char * | Argument | ) |

References Libelle_mode(), and Nb_modes_video.

Referenced by Analyse_de_la_ligne_de_commande(), and Charger_INI().