? How to get the pixel color without relying on mouseColor

David Bovill david at anon.nu
Mon Aug 11 07:03:00 EDT 2003


On Sun, 2003-08-10 at 14:02, Sparticus Zarris wrote:

> Please, don't tell me to write a function like this:
> 
> function convolutedGetPixelColor  aPoint
>   set the screenMouseLoc to aPoint
>   get the mouseColor
> 
>   return it
> 
> end convolutedGetPixelColor

Oh go on - let me :)

Not done it - but thought that you'd need to use a combination of...
using the imagedata property and working out the dimensions of the image
(the tricky bit). You can get the original dimensions of the image using
the formattedHeight/Width and there is also some feature I could not
find in the MC documentation which returns the dimensions of the data
returned by the imagedata.

function convolutedGetPixelColor  apoint, imageName
  -- something like this ???
  put the imageData of image imageName into someImageData
  put the formattedWidth of image imageName into oWidth
  -- put the formattedHeight of image imageName into oHeight
  
  put (item 1 of apoint) * 8 into endChar
  put endChar - 8 into startChar
  
  put item 2 of apoint into lineNum
  put (lineNum - 1) * 8 * oWidth into extraBit
  add extraBit to startChar
  add extraBit to endChar

  - now you should have the 8 
  
end convolutedGetPixelColor

Hope you get the principle - I have some functions on another machine
that work with imagedata if you are still stuck?

david




More information about the metacard mailing list