Página principal | Jerarquía de la clase | Lista alfabética | Lista de componentes | Lista de archivos | Miembros de las clases | Archivos de los miembros | Páginas relacionadas

img_rgb.h

Ir a la documentación de este archivo.
00001 //===========================================================================
00002 //= img_rgb.h                                             Noviembre de 1999 =
00003 //=-------------------------------------------------------------------------=
00004 //= Clases de representacion y procesamiento basico de imagenes digitales   =
00005 //=-------------------------------------------------------------------------=
00006 //= ADVERTENCIA: ESTE SOFTWARE NO ESTA CONCEBIDO NI DISENNADO PARA EL USO   =
00007 //= EN EQUIPO DE CONTROL EN LINEA EN ENTORNOS PELIGROSOS QUE REQUIERAN UN   =
00008 //= DESEMPENNO LIBRE DE FALLAS, COMO LA OPERACION DE PLANTAS NUCLEARES,     = 
00009 //= SISTEMAS DE NAVEGACION O COMUNICACION EN AVIONES, TRAFICO AEREO,        =
00010 //= EQUIPO MEDICO DEL CUAL DEPENDAN VIDAS HUMANAS O SISTEMAS DE ARMAMENTO,  =
00011 //= EN LOS CUALES UNA FALLA EN EL SOFTWARE PUEDA IMPLICAR DIRECTAMENTE LA   =
00012 //= MUERTE, DANNOS PERSONALES O DANNOS FISICOS Y/O AMBIENTALES GRAVES       =
00013 //= ("ACTIVIDADES DE ALGO RIESGO").                                         =
00014 //=-------------------------------------------------------------------------=
00015 //= Autor original: Oscar J. Chavarro G.  A.K.A. JEDILINK. Copyright (c),   =
00016 //= 1997 - 2003, oscarchavarro@hotmail.com                                  =
00017 //= AQUYNZA es software libre, y se rige bajo los terminos de la licencia   =
00018 //= LGPL de GNU (http://www.gnu.org). Para mayor informacion respecto a la  =
00019 //= licencia de uso, consulte el archivo ./doc/LICENCIA en la distribucion. =
00020 //===========================================================================
00021 
00022 #include "jed_defs.h"
00023 
00024 #ifndef __JEDILINK_IMG__
00025     #error "No incluya a img_rgb.h, incluya a jed_img.h!"
00026 #endif
00027 
00028 #ifdef VEL_ROSITA
00029     #include "toolkits/media/jed_img.h"
00030 #endif
00031 
00032 class IMAGEN_RGB : public IMAGEN {
00033   private:
00034 #if PLATAFORMA != PALM_PALMOS_CODEWARRIOR
00035     PIXEL_RGB *Data;  // Arreglo dinamico de pixel's. Notese que este formato
00036                       // es requerido por las operaciones OpenGL!
00037 #endif
00038 #if PLATAFORMA == PALM_PALMOS_CODEWARRIOR
00039     PIXEL_RGB **Data;
00040 #endif
00041 
00042     // Para soportar anx_BYTE
00043     int _anx_x;
00044     int _anx_y;
00045     BYTE _anx_r;
00046     BYTE _anx_g;
00047     BYTE _anx_b;
00048     BYTE _anx_c;
00049 
00050   #ifdef MESA_ENABLED
00051     OSMesaContext _contexto_osmesa;
00052   #endif
00053 
00054   #ifdef X_ENABLED
00055     //- Funciones de soporte a la integracion con el sistema X11 ------------
00056     XImage *crear_imagenX_depth8(Display *Mi_display);
00057     XImage *crear_imagenX_depth16(Display *Mi_display);
00058     XImage *crear_imagenX_depth24(Display *Mi_display);
00059     void copiar_imagenX_depth8(Display *Mi_display, XImage *imagen);
00060     void copiar_imagenX_depth16(Display *Mi_display, XImage *imagen);
00061     void copiar_imagenX_depth24(Display *Mi_display, XImage *imagen);
00062   #endif
00063 
00064   public:
00065     //- Metodos standard de la clase IMAGEN ---------------------------------
00066     IMAGEN_RGB();
00067     virtual ~IMAGEN_RGB();
00068   #ifdef GL_ENABLED
00069     void pintar_gl(void);
00070     void activar_gl(void);
00071     BOOLEAN importar_gl(int x, int y, int xtam, int ytam);
00072   #endif
00073     BOOLEAN init(int width, int height);
00074     void elim(void);
00075 
00076     //- Metodos especificos de IMAGEN_RGB -----------------------------------
00077     BOOLEAN importar_ppm(FILE *fd);               // Persistencia
00078     BOOLEAN importar_sgirgb(FILE *fd);
00079     BOOLEAN importar_pcx(FILE *fd);
00080     BOOLEAN importar_jpeg(FILE *fd);
00081     BOOLEAN exportar_jpeg(FILE *fd, int calidad_jpeg);
00082     BOOLEAN importar_png(FILE *fd);
00083     void exportar_ppm(FILE *fd);
00084     inline void anx_BYTE(BYTE b);
00085 
00086     inline void putpixel(int x, int y, BYTE r, BYTE g, BYTE b); // Acceso
00087     inline void getpixel(int x, int y, BYTE &r, BYTE &g, BYTE &b);
00088     void linea(int x0, int y0, int x1, int y1, BYTE r, BYTE g, BYTE b);
00089 
00090     void activar_como_contexto_gl(void);            // Soporte OpenGL
00091     void desactivar_como_contexto_gl(void);
00092 
00093     BOOLEAN combinar_stereo(IMAGEN_RGB *Izq, IMAGEN_RGB *Der, int modo);
00094 
00095   #ifdef X_ENABLED
00096     Pixmap
00097     exportar_pixmap(Display *_display, Screen *_screen, Window _window);
00098     XImage* exportar_ximage(Display *Mi_display);
00099     void copiar_ximage(Display *Mi_display, XImage *imagen);
00100   #endif
00101 
00102   #if PLATAFORMA == i386_WIN32_VC
00103     void importar_win32dc(HDC dc, int xpos, int ypos, int ancho, int alto);
00104     void exportar_win32dc(HDC dc, int xpos, int ypos);
00105   #endif
00106   #if PLATAFORMA == PALM_PALMOS_CODEWARRIOR
00107     void exportar_palm(int xpos, int ypos);
00108   #endif
00109 
00110     void tmp_degradecito(int tipo);                 // Undocumented features!
00111 
00112     //- Procesamiento de imagenes -------------------------------------------
00113     void aplicar_correccion_gamma(BYTE funcion_gamma[256]);
00114 
00115 #ifdef NNN
00116     IMAGEN *copie(void);
00117     IMAGEN_PAL *exportar_a_grises(PALETA *Pal);
00118 #endif // NNN
00119 };
00120 
00121 //- Definicion de metodos inline de la clase IMAGEN_RGB ---------------------
00122 
00123 inline void
00124 IMAGEN_RGB::anx_BYTE(BYTE b)
00125 {
00126     if ( _anx_x >= x_tam || _anx_y >= y_tam ) return;
00127 
00128     switch ( _anx_c ) {
00129       case 0: default:
00130         _anx_c = 1;
00131         _anx_r = b;
00132         break;
00133       case 1:
00134         _anx_c = 2;
00135         _anx_g = b;
00136         break;
00137       case 2:
00138         _anx_c = 0;
00139         _anx_b = b;
00140         putpixel(_anx_x, _anx_y, _anx_r, _anx_g, _anx_b);
00141         _anx_x++;
00142         if ( _anx_x >= x_tam ) {
00143             _anx_x = 0;
00144             _anx_y++;
00145         }
00146         if ( _anx_y >= y_tam) {
00147             _anx_x = 0;
00148             _anx_y = 0;
00149         }
00150         break;
00151     }
00152 }
00153 
00154 inline void
00155 IMAGEN_RGB::putpixel(int x, int y, BYTE r, BYTE g, BYTE b)
00156 {
00157 #if PLATAFORMA != PALM_PALMOS_CODEWARRIOR
00158     int i = x_tam * (y_tam - y - 1) + x;
00159 
00160     Data[i].r = r;
00161     Data[i].g = g;
00162     Data[i].b = b;
00163 #endif
00164 #if PLATAFORMA == PALM_PALMOS_CODEWARRIOR
00165     Data[y][x].r = r;
00166     Data[y][x].g = g;
00167     Data[y][x].b = b;
00168 #endif
00169 }
00170 
00171 inline void
00172 IMAGEN_RGB::getpixel(int x, int y, BYTE &r, BYTE &g, BYTE &b)
00173 {
00174 #if PLATAFORMA != PALM_PALMOS_CODEWARRIOR
00175     long int i = x_tam * (y_tam - y - 1) + x;
00176 
00177     r = Data[i].r;
00178     g = Data[i].g;
00179     b = Data[i].b;
00180 #endif
00181 #if PLATAFORMA == PALM_PALMOS_CODEWARRIOR
00182     r = Data[y][x].r;
00183     g = Data[y][x].g;
00184     b = Data[y][x].b;
00185 #endif
00186 }
00187 
00188 //===========================================================================
00189 //= EOF                                                                     =
00190 //===========================================================================
00191 

Este archivo HTML ha sido generado automáticamente a partir del código fuente AQUYNZA. NO LO EDITE. Para mayor información contacte al autor.