[Previo por Fecha] [Siguiente por Fecha] [Previo por Hilo] [Siguiente por Hilo]
[Hilos de Discusión] [Fecha] [Tema] [Autor]On 10 Sep 1998, Miguel de Icaza wrote: > Imlib hace exactamente eso de una manera óptima. > > La complicación de usar XImage.data es que debes de tener presente el > visual, el endianess de cada lado y otros detalles que son harto > divertidos. > > Imlib ya hace todas esas cosas por ti. Gracias por el tip... dando una serie de factores por sentado, pude convertir esto: int transforma(XImage *ximage, unsigned int owidth, unsigned long oheight) { int x, y; unsigned long pixel; unsigned long *imagen; imagen = (unsigned long *) calloc(owidth*oheight,sizeof(pixel)); for (y=0; y<(int)oheight; y++) { for(x=0;x<(int)oheight; x++) { *(imagen+((y * (int)owidth)+x)) = XGetPixel(ximage, x, y); } } for (y=0; y<(int)oheight; y++) { for(x=(int)oheight;x>=0; x--) { XPutPixel(ximage,x,y,*(imagen+((((int)oheight-x) *(int)owidth)+y))); } } free(imagen); return 0; } en esto otro: int transforma2(XImage *ximage, unsigned int owidth, unsigned long oheight) { int x,y; unsigned short *imagen; imagen = (unsigned short *)malloc((size_t)(owidth*oheight*2)); memcpy(imagen,ximage->data,(size_t)(owidth*oheight*2)); for (x=0; x<(int)oheight; x++) { for(y=0; y<(int)oheight; y++) { *((unsigned short *)ximage->data+((x * (int)owidth)+y)) = *(imagen+((y * (int)owidth)+x)); } } free(imagen); return 0; } La mejoria es sustancial... ¿habra forma de acelerarlo mas? Saludos, Raymond