分享

错误Error>: CGBitmapContextCreate

 勤奋不止 2014-02-28

错误Error>: CGBitmapContextCreate

: CGBitmapContextCreate: unsupported parameter combination: 8 integer bits/component; 24 bits/pixel; 3-component color space; kCGImageAlphaNone; 363 bytes/row.

发表于:2013-01-21 17:3

这个问题我升级ios7的时候遇到,现已经解决,修改cocos2dx底层

找到

static bool _initWithString(const char * pText, cocos2d::CCImage::ETextAlign eAlign, const char * pFontName, int nSize, tImageInfo* pInfo)

这个函数底下

做此修改

const int _width  = dim.width;

        const int _height = dim.height;

        

        unsigned char* data = new unsigned char[(int)(dim.width * dim.height * 4)];

        memset(data, 0, (int)(_width * _height * 4));

        

        // draw text

        CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();    

        CGContextRef context =

        CGBitmapContextCreate(data, _width, _height, 8, _width * 4, colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big);


道理很简单,因为浮点数 * 4以后再取整, 有可能不是4的倍数

然后显示也正常了

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多