Re: [AD] getpixel error

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Sat, Jan 17, 2009 at 5:13 PM, frederico schardong
<frede.sch@xxxxxxxxxx> wrote:
> when I try set_color_depth(32), my laptop halt!!
>
> set_color_depth(16) work.
>

No, use 32 (16 will work, but reduce quality of the input bitmap) -
the reason for the crash is that you swapped w and h here as well:

>
>     int matrizPixel[imagem->h][imagem->w];
>     rgb matrizRgb[imagem->h][imagem->w];
>

Use getpixel, not _getpixel. The latter is not at all what you want:

>                             matrizPixel[x][y] = _getpixel(imagem, x, y);

Replace pal with NULL (unless you really want to save a palette and
know what you are doing):

>     save_bitmap("picture_gray.bmp", imagem_gray, pal);




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/