//测试如何调用 lua 中graySprite的方法 SpriteFrame*spFrame1 = SpriteFrame::create("dog.png",Rect(0,210,95)); //Filter*gg = GrayFilter::create(color4F(0,1,0.5)); //变灰,颜色值变,灰度也变 //Filter*gg = HueFilter::create(0);//无效果,似乎没有任何用 //Filter*gg = BrightnessFilter::create(0.6); //效果为:让图片明亮一些,缺点是整张图都变亮了 //Filter*gg = SaturationFilter::create(1);//更改图片饱和度,0的时候似乎全部变灰,1为正常 //Filter*gg = ContrastFilter::create(0.5);//更改对比度 //Filter*gg = ExposureFilter::create(1);//更改曝光度 //Filter*gg = GammaFilter::create(1);// //Filter*gg = Hazefilter::create(0.5,0);// 第一个雾距 第二个 边坡 肯能由于地图山地类型使用 //Filter*gg = SepiaFilter::create(1);// 分辨率 /* local FILTERS = { -- colors GRAY = {cc.GrayFilter},-- {r 0.299,g 0.587,b 0.114,a 0.0} or no parameters RGB = {cc.RGBFilter,3,{1,1}},-- {0.0~1.0,0.0~1.0,0.0~1.0} HUE = {cc.HueFilter,{0}},-- {-180~ 180} see photoshop BRIGHTnesS = {cc.BrightnessFilter,-- {-1.0~1.0} SATURATION = {cc.SaturationFilter,{1}},-- {0.0~2.0} CONTRAST = {cc.ContrastFilter,-- {0.0~4.0} EXPOSURE = {cc.ExposureFilter,-- {-10.0,10.0} GAMMA = {cc.GammaFilter,-- {0.0,3.0} HAZE = {cc.Hazefilter,2,{0,0}},-- {distance -0.5~0.5,slope -0.5~0.5} SEPIA = {cc.SepiaFilter},-- {no parameters} -- blurs GAUSSIAN_VBLUR = {cc.GaussianVBlurFilter,-- {pixel} GAUSSIAN_HBLUR = {cc.GaussianHBlurFilter,-- {pixel} ZOOM_BLUR = {cc.ZoomBlurFilter,0.5,0.5}},-- {size,centerX,centerY} MOTION_BLUR = {cc.MotionBlurFilter,angle} -- others SHARPEN = {cc.SharpenFilter,-- {sharpness,amount} MASK = {cc.MaskFilter,1},-- {DO NOT USE IT} DROP_SHADOW = {cc.DropShadowFilter,-- {DO NOT USE IT} -- custom CUSTOM = {cc.CustomFilter,1} } local MulTI_FILTERS = { GAUSSIAN_BLUR = {},} */ FilteredSpriteWithOne*sp = FilteredSpriteWithOne::createWithSpriteFrame(spFrame1); sp->setposition(Vec2(480,320)); sp->setFilter(gg); this->addChild(sp); //参照图 auto canzhaosp = Sprite::createWithSpriteFrame(spFrame1); this->addChild(canzhaosp); canzhaosp->setposition(Vec2(480,220));
#include "filters/cocos2dFilters.h"USING_NS_CC_EXT;
lua 中的写法类似,如下:
display.newGraySprite("button.png"):align(display.CENTER,display.cx,display.cy):addTo(self) local spFrame = cc.SpriteFrame:create("button.png",cc.rect(0,200,200)) local gfilter = cc.GrayFilter:create(cc.c4f(1,0.5)) local sp=cc.FilteredSpriteWithOne:createWithSpriteFrame(spFrame); sp:setFilter(gfilter) sp:setposition(display.cx,200) self:addChild(sp)最大的缺点就是一种类型的效果,只能有一种情况存在,为什么设计者不设计成相互独立的呢? 总结
以上是内存溢出为你收集整理的quick cocos2dx FilteredSprite c++使用全部内容,希望文章能够帮你解决quick cocos2dx FilteredSprite c++使用所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)