zoukankan      html  css  js  c++  java
  • 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;
    }

  • 相关阅读:
    Web 服务器配置
    Web 浏览
    C++ Web 编程
    C++ 多线程
    C++ 信号处理
    C++ 预处理器
    C++ 模板
    C++ 命名空间
    C++ 动态内存
    C++ 异常处理
  • 原文地址:https://www.cnblogs.com/YZFHKMS-X/p/13741409.html
Copyright © 2011-2022 走看看