Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
Importing Photoshop layers
Puzzle maker
Ripple General Settings-Alphamania
Check For Previous Open
Set FrameRate of a Animated Gif Cast Member
Export/Import Text and Filed Members for proofing
Check PM Group
Overlay Dragger
Import from Access - Valentina
Macromedia Director 8.5 Shockwave Studio for 3D: Training from the Source
 

 

 

Behavior Noise Algorithm 2

Added on 1/14/2006

 

Compatibilities:
behavior D8 D8_5 D9

This item has not yet been rated

Author: Chunick (website)

Adds random noise to an image. theImage - image object colorize - true or false. Either creates gray or colour noise theBlend - the level of blending to do. Value between 0-255 theInk - can apply an ink to the overlaying of the noise.

on Noise (theImage, colorize, theBlend, theInk)
  
  theWidth = theImage.width - 1
  theHeight = theImage.height - 1
  anImage = theImage.duplicate()
  if colorize then
    newImage = image(anImage.width, anImage.height, 8)
  else
    newImage = image(anImage.width, anImage.height, 8, #grayscale)
  end if
  
  repeat with y1 = 0 to theHeight  
    repeat with x1 = 0 to theWidth
      rnd = random(255)
      newImage.setPixel(point(x1,y1), color(rnd))
    end repeat
  end repeat
  
  anImage.copyPixels(newImage, anImage.rect, anImage.rect, [#ink: theInk, #blendLevel: theBlend])

  return anImage
  
end

 


Contact

MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA

Send e-mail