Firewall-Masquerade avec interface http

crabs_firewall-3.0.1 ©2005-2011 - Christophe CAZAJUS (crabs-mettre_le_signe_at-crabs-world.com)

libgraph.a~~ / LIB / GRAPH / graph_util.cpp
Makefile graph.h serie.cpp timestamp.cpp graph.cpp graph_creer.cpp graph_util.cpp graph_titre_axe.cpp
    1 /*
    2 **=============================================================================
    3 ** crabs_firewall-3.0.1 : Firewall-Masquerade avec interface http
    4 ** Copyright (C) 2005-2011 : Christophe CAZAJUS (crabs-mettre_le_signe_at-crabs-world.com)
    5 **
    6 ** Ce source fait partie d'un projet logiciel libre. Vous pouvez le distribuer
    7 ** et/ou le modifier en respectant les termes de la GNU General Public License
    8 ** version 2 ou (suite a votre propre choix) une version ulterieure.
    9 **
   10 ** Ce programme est distribue dans l'espoir qu'il puisse etre utile, mais
   11 ** sans aucune garantie, meme si il est associe a un produit qui vous en
   12 ** propose une. Conformez-vous a la GNU General Public License pour avoir
   13 ** plus de precisions.
   14 **
   15 ** L'auteur ne peut etre tenu responsable de l'utilisation faite des
   16 ** composantes associees a ce projet (en partie ou dans leur totalite).
   17 **
   18 ** Une copie du fichier de la GNU GPL est fournie dans le repertoire DOC
   19 ** de ce projet sous le nom gnu_gpl.txt
   20 **
   21 **=============================================================================
   22 */
   23 #include "graph.h"
   24 #include <string.h>
   25 
   26 int CGgraph::Max( int n, int a, ... )
   27     {
   28     va_list args ;
   29     int max = a ;
   30     va_start( args, a ) ;
   31     for( int i=1; i<n; i++ ) { a=(int)va_arg(args,int); if (a>max) max=a; }
   32     va_end( args ) ;
   33     return max ;
   34     }
   35 
   36 int CGgraph::Min( int n, int a, ... )
   37     {
   38     va_list args ;
   39     int min = a ;
   40     va_start( args, a ) ;
   41     for( int i=1; i<n; i++ ) { a=(int)va_arg(args,int); if (a<min) min=a; }
   42     va_end( args ) ;
   43     return min ;
   44     }
   45 
   46 char* CGgraph::textSize( char* txt, char* font, int sz, int& w, int& h )
   47     {
   48     int brect[8];
   49     char* err = gdImageStringFT(NULL,brect,0,font,sz,0.,0,0,txt);
   50     if ( err ) return err ;
   51     int xbg = brect[0] ; int ybg = brect[1] ;
   52     int xbd = brect[2] ; int ybd = brect[3] ;
   53     int xhd = brect[4] ; int yhd = brect[5] ;
   54     int xhg = brect[6] ; int yhg = brect[7] ;
   55     int miny = Min(4,ybg,ybd,yhd,yhg), maxy = Max(4,ybg,ybd,yhd,yhg) ;
   56     int minx = Min(4,xbg,xbd,xhd,xhg), maxx = Max(4,xbg,xbd,xhd,xhg) ;
   57     w = maxx - minx ; h = maxy - miny ;
   58     return NULL ;
   59     }
   60 
   61 void CGgraph::dessineTexte( gdImagePtr im, char* txt, int x, int y, int mode,
   62         char* font, int sz )
   63     {
   64     int w, h, brect[8] ;
   65     char *err = textSize( txt, font, sz, w, h ) ; if (err) return ;
   66     // default mGX & mBY
   67     if ( (mode & mCX) == mCX ) x -= w / 2 ;
   68     if ( (mode & mDX) == mDX ) x -= w ;
   69     if ( (mode & mCY) == mCY ) y += h/2 ;
   70     if ( (mode & mHY) == mCY ) y += h ;
   71     err = gdImageStringFT(im,brect,noir,font,sz,0.,x,y,txt);
   72     }
   73 
Makefile graph.h serie.cpp timestamp.cpp graph.cpp graph_creer.cpp graph_util.cpp graph_titre_axe.cpp
libgraph.a~~ / LIB / GRAPH / graph_util.cpp

Haut de page

Contacter crabs

Date de génération : 22/09/2011 21:48