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
Generic behavior to detect if the key has been pressed
Text Shifting
Dither Black and White Image - Imaging Lingo
Swipe Cast Members
3D Groove
DateTimeXtra
Install-us Pro
Media Player
Effector Set 1 Behavior Support
Building a Generic Card Shuffler
 

 

 

Behavior Fast Blur Algorithm

Added on 8/23/2005

 

Compatibilities:
behavior D8 D8_5 D9

This item has not yet been rated

Author: Chunick (website)

This imaging algorithm is a fast blur. It will not work in real time, but it's quick, nonetheless.

-- Fast Blur Imaging Code
-- 2005 by Josh Chunick (josh@chunick.com)
-- This code is free to use in commercial applications
-- or however you want. If you use this code you
-- must keep the comments, including this message,
-- intact. Feel free to add any changes or make
-- improvements.

-- anImage is an image object
-- hBlur is the amount of blurring as an integer or float
-- vBlur is the amount of blurring as an integer or float

on fastBlur (anImage, hBlur, vBlur)
  newImage = anImage.duplicate()
  theWidth = newImage.width - 1
  theHeight = newImage.height - 1
  
  -- draw each pixel in the new image
  repeat with y1 = 0 to theHeight
    
    repeat with x1 = 0 to theWidth
      
      interplY1 = max(min(y1 - vBlur, y1 - 1), 1)
      interplX1 = max(min(x1 - hBlur, x1 - 1), 1)
      interplY2 = min(max(y1 + vBlur, y1 + 1), theHeight)
      interplX2 = min(max(x1 + hBlur, x1 + 1), theWidth)
      newImage.copyPixels(anImage, rect(x1,y1,x1 + 1,y1 + 1), rect(interplX1,interplY1,interplX2,interplY2))
      
    end repeat
  end repeat
  
  return newImage
  
end

 


Contact

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

Send e-mail