delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/13/10:16:06

From: cs19 AT cityscape DOT co DOT uk (BDC Client Team)
Newsgroups: comp.os.msdos.djgpp
Subject: Help with Allegro getpixel()
Date: Tue, 13 May 1997 12:07:08 GMT
Organization: IP-GOLD User
Message-ID: <863525228.17268.0.nnrp-2.9e9829a4@news.demon.co.uk>
NNTP-Posting-Host: itsb.demon.co.uk
Lines: 31
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I wonder if anyone can help me with the Allegro getpixel() function?

I am reading in a bitmap and then traversing the bitmap (left to right,
top to bottom) to determine what pixels in the bitmap are 'active' (ie
non-zero)

whatever I try to do, getpixel always returns a 0

Below is a snippet of the code I am using (p is an int, s2 is a bitmap 
containing a sprite):

 . 
 . 
 for (y1=0; y1++; y1<32) 
 {
  for (x1=0; x1++; x1<32) 
  {
   p=getpixel(s2,x1,y1);         
   if ((p!=0) && (p!=-1))                    
    {
     sprintf(msg,"Colour=%d\n", p);
     textout(screen, font, msg,0,0+(10*y1),38);
    }
   }
  }
     
Any ideas anyone?

Neil Chinnery
http://www.geocities.com/SiliconValley/Park/1077

- Raw text -


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