Setting Pixels

Chipp Walters chipp at chipp.com
Wed Jan 29 06:12:00 EST 2003


Hi Bob,

> From the examples, this seems to mean in practice that if I want 
> to change a
> single pixel in an image I need to read the whole image bitmap into a
> variable, change the pixel in the variable, and then copy the 
> whole variable
> contents back into the image.

Much easier to edit the image via script with a pencil.

on mouseUp
  select img 1
  choose pencil
  drag from topLeft of img 1 to botRight of img 1
  choose browse
end mouseUp

This could easily be set up to modify a single pixel in an image..

for instance a button with:

on mouseUp
  changeThisPixel 3,7,"test","red"
end mouseUp

on changeThisPixel pDeltaX,pDeltaY,pImg,pColor
  select img pImg
  choose pencil
  set the penColor to pColor
  put left of img pImg + pDeltaX into tXpixel
  put top of img pImg + pDeltaY into tYpixel
  click at tXpixel,tYpixel
  choose browse
end changeThisPixel

it's instant on my machine

-Chipp



More information about the use-livecode mailing list