• SOIL 创建图片


    #include <iostream>
    #include <string>
    using namespace std;
    #include "../../src/socket/TCPSocketEx.h"
    #include <cocos2d.h>
    using namespace cocos2d;
    #include "../../src/socket/Private/MemoryPool.h"
    #include "../../src/socket/ServerService.h"
    #include "external/xxtea/xxtea.h"
    #include "cocos/base/ccUtils.h"
    extern "C"
    {
    #include "md5/md5.h"
    }
    #include "SOIL2.h"


    int main()
    {
        const int w = 100;
        const int h = 100;
        const int size = w * h * 4;
        unsigned char data[size] = { 0 };
        
        for (int i = 0; i < size; i += 4)
        {
            data[i] = 255;//r
            data[i + 1] = 0;//g
            data[i + 2] = 0;//b
            data[i + 3] = 255;//a
        }

        auto ret = SOIL_save_image("D:/PriPro/NDKLIB/t.png", SOIL_SAVE_TYPE_PNG, w, h, SOIL_LOAD_RGBA, data);
        printf("ret %d ", ret);


        unsigned char buf[40000] = { 0 };
        int W, H, C;
        auto d = SOIL_load_image("D:/PriPro/NDKLIB/test.png", &W, &H, &C, 0);
        memcpy(buf, d,40000);





        int var = 0;
        return 0;
    }

  • 相关阅读:
    Mybatis专栏文章整理成册《Mybatis进阶》!!!
    Mybatis的几种传参方式,你了解吗?
    HDU 1890
    POJ 2186
    HDU 2896
    POJ 1322
    POJ 1276
    POJ 1208
    POJ 1189
    POJ 1178
  • 原文地址:https://www.cnblogs.com/YZFHKMS-X/p/13741409.html
Copyright © 2020-2023  润新知