Image

From Director Online Wiki
Jump to: navigation, search

Description

Properties

paletteRef

symbol like #systemWin, #rainbow etc..
Documented in DIR MX04 for bitmap cast members only.
Image objects do not offer the #palette property, use #paletteRef instead.

Methods

copyPixels()
floodFill()
Description

see: http://www.macromedia.com/devnet/mx/director/articles/imaging_lingo_06.html

Gamma Correction

a global handler to gamma-correct an image is here:

on imgGammaCorrect(afGamma, aImg)
  --@returns img newImage
  --@params  float gamma, image
  --@descr   returns a new, gamma corrected image. does not change orig image
  --@author  based on Joachim Baur (medienwerkstatt)
  --@xmp     member(1).image = imgGammaCorrect( 0.9, member(1).image )
   
  invGamma = 1/float(afGamma)
  reScale  = 255/power(255,invGamma)
  
  h        = aImg.height -1  
  w        = aImg.width  -1  
  tImg     = image(w+1, h+1,aImg.depth)
  
  repeat with y = 0 to h    
    repeat with x = 0 to w   
      
      origRGB           = aImg.getPixel(x,y)      
      origRGB.colorType = #rgb
      
      corrRed   = integer(power(origRGB.red,  invGamma)*reScale)      
      corrGreen = integer(power(origRGB.green,invGamma)*reScale)      
      corrBlue  = integer(power(origRGB.blue, invGamma)*reScale)
      
      tImg.setPixel(x,y,rgb(corrRed, corrGreen, corrBlue))
      
    end repeat    
  end repeat
  
  return tImg
end imgGammaCorrect

see: medienwerkstatt

Bugs