scanBitmap

  how to use getPixel and setPixel undocumented functions in d7 for scanning a bitmap line by line
getpixel setpixel sinewave




  scanBitmap
>Bjarne Nyquist wrote:
>>I thought I herad that in Director7 it would be possible to check the color
>>of the pixel under the mouse.
>>I cant find this in the docs though. I really need it. Anyone who knows?
>
>Your looking for the undocumented getPixel(x,y) and setPixel(x,y).
>

I experimented with this when I tried to understand/clone nonoche's sinewave 
and got something running with this handler:

on scan dMbr
  if voidP(dMbr) then set dMbr = (member 1)
  set dRect = the rect of dMbr
  set nol = the height of dREct  -- number of lines
  set lol = the width of dREct   -- length of line
  
  set cRect = the rect of member "Modell"
  set cLol = the width of cRect
  
  set LMbr = []
  
  -- zeile fuer Zeile
  repeat with dline = nol down to 1 --nol
    -- set cMbr = new(#bitmap)  -- so geht es nicht
    set cMbr = duplicate(member "Modell")
    append LMbr, cMbr
    
    -- pixel fuer Pixel
    repeat with dPix = 1 to lol
      -- einlesen
      set aVal = getPixel(dMbr,dPix,dline)
      -- put "  " & string(aVal) after field "vals"
      
      -- setPixel scheint mit offset 0 zu arbeiten, getPixel aber mit Offset 1
      setPixel ((member cMbr),dPix -1,0,aVal)
    end repeat
    
    -- und jetzt noch den ueberstaendigen Rest des Modells erledigen
    repeat with aPix = dPix to cLol
      setPixel ((member cMbr),aPix -1,0,-1)
    end repeat
    
  end repeat
  
  return LMbr
end

It only worked fer me with 32 bit graphics, setpixel apparently wanted offset 0 
while getpixel used offset 1, etc. 
It lives at <http://www.lingo.de/util/scantest8.htm> (but it is slooww :( )
I think MM had reason not to include it in the docu...



Home shock + cgi Bits 'n pieces Director Lingo Shocklets Contact










pageID=l_scanBitmap