delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/14/00:33:59

From: gautam AT interlog DOT com (Gautam N. Lad)
Newsgroups: comp.os.msdos.djgpp
Subject: Allegro Truecolour (HELP!)
Date: Sun, 14 Dec 97 01:56:08 GMT
Organization: InterLog Internet Services
Lines: 57
Message-ID: <66vdid$gsm$1@news.interlog.com>
NNTP-Posting-Host: ip203-29.cc.interlog.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi,
I would like to use the truecolour video modes (preferablly 16-bit), and would 
like to use it on filtering images.  My algorithm goes like this:

RGB rgb;
int x, y, x2, y2, w, h;
w=the_image->w; h=the_image->h;

allegro_init();
install_keyboard();
install_timer();
install_mouse();
set_color_depth(16);
set_gfx_mode(GFX_AUTODETECT,640,480,0, 0);

for(y=0; y<=h; y++)  // for each pixel in the image
  for(x=0; x<=w; x++)
    {
      gc=0;			// filter counter
      rgb.r=rgb.g=rgb.b=0;	// final rgb
      for(y2=-2; y2<=2; y2++)
        for(x2=-2; x2<=2; x2++)
        {
        index=getpixel(the_image,x+x2,y+y2);	// get image from image

        ir=getr(index);	// obtain value of RED from palette index
        ig=getg(index); // obtain value of GREEN from palette index
        ib=getb(index); // obtain value of BLUE from palette index

        rgb.r += ir * filter[gc];	// apply filter to RGB
        rgb.g += ig * filter[gc];
        rgb.b += ib * filter[gc];

        gc++;
       }

      rgb.r /= division;	// divide values by division factor
      rgb.g /= division;
      rgb.b /= division;

       // draw pixel on screen
      putpixel(screen,x,y,makecol(rgb.r,rgb.g,rgb.b));
    }

What am I doing wrong? I'm not getting gpfs, or compilation errors. 

Please help!
Bye!

-------------------------------------------------------------
Gautam N. Lad
-------------------------------------------------------------
E-Mail:	gautam AT interlog DOT com
Website:	http://www.interlog.com/~gautam

POV-Ray Software, Gallery, and Links!
-------------------------------------------------------------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019