标签:
Corona 提供了很多图像处理方法,今天研究了下,做个记录
直接上图,下面有代码
-- -- Abstract: Filter Demo sample app -- -- Date: 3-13-2015 -- -- Version: 1.0 -- -- File name: main.lua -- -- Author: siyuan Openpad Project -- -- Demonstrates: graphics, shaders, filters -- -- File dependencies: none -- -- Target devices: Simulator and devices -- -- Limitations: none -- -- Update History: none -- -- Comments: none --------------------------------------------------------------------------------------- -- do start and fill screen print("----Start Lua...") CONSTANT_SCREEN_WIDTH = display.contentWidth CONSTANT_SCREEN_HEIGHT = display.contentHeight halfW = CONSTANT_SCREEN_WIDTH * 0.33 halfH = CONSTANT_SCREEN_HEIGHT * 0.33 offectW = halfW * 0.5 offectH = halfH * 0.5 local group = display.newGroup() print("----Screen w = "..CONSTANT_SCREEN_WIDTH.."\t h = "..CONSTANT_SCREEN_WIDTH) function drawImage( ) -- for j=1,9 do -- local image = display.newImageRect( "colmdog.jpg", halfW, halfH) -- group:insert( image ) -- end -- group[1]:translate(offectW, offectH) -- group[2]:translate(offectW * 3, offectH) -- group[3]:translate(offectW * 5, offectH) -- group[4]:translate(offectW, offectH * 3) -- group[5]:translate(offectW * 3, offectH * 3) -- group[6]:translate(offectW * 5, offectH * 3) -- group[7]:translate(offectW, offectH * 5) -- group[8]:translate(offectW * 3, offectH * 5) -- group[9]:translate(offectW * 5, offectH * 5) for i = 1,3 do for j = 1,3 do local image = display.newImageRect( "colmdog.jpg", halfW, halfH) local translateX,translateY image:translate(offectW * (2 * j - 1), offectH * (2 * i - 1)) group:insert( image ) end end end function doEffects() --group[1] is orignal group[1].fill.effect = "filter.saturate" group[1].fill.effect.intensity = 4 group[2].fill.effect = "filter.bloom" group[2].fill.effect.levels.white = 0.8 group[2].fill.effect.levels.black = 0.4 group[2].fill.effect.levels.gamma = 1 group[2].fill.effect.add.alpha = 0.8 group[2].fill.effect.blur.horizontal.blurSize = 20 group[2].fill.effect.blur.horizontal.sigma = 140 group[2].fill.effect.blur.vertical.blurSize = 20 group[2].fill.effect.blur.vertical.sigma = 240 group[3].fill.effect = "filter.blurVertical" group[3].fill.effect.blurSize = 20 group[3].fill.effect.sigma = 140 group[4].fill.effect = "filter.brightness" group[4].fill.effect.intensity = 0.4 group[5].fill.effect = "filter.blurGaussian" group[5].fill.effect.horizontal.blurSize = 20 group[5].fill.effect.horizontal.sigma = 140 group[5].fill.effect.vertical.blurSize = 20 group[5].fill.effect.vertical.sigma = 140 group[6].fill.effect = "filter.bulge" group[6].fill.effect.intensity = 1.8 group[7].fill.effect = "filter.grayscale" group[8].fill.effect = "filter.colorChannelOffset" group[8].fill.effect.xTexels = 8 group[8].fill.effect.yTexels = 8 group[9].fill.effect = "filter.emboss" group[9].fill.effect.intensity = 0.2 end drawImage() doEffects() -- do end print("----End of Lua...")
标签:
原文地址:http://www.cnblogs.com/LiuSiyuan/p/4335379.html