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] = 80;//a
    }


    auto texture = new (std::nothrow) Texture2D();
    texture->initWithData(data, size, Texture2D::PixelFormat::RGBA8888, w, h, Size(100, 100));

相关文章:

  • 2021-11-03
  • 2021-08-17
  • 2022-01-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-26
  • 2022-12-23
  • 2022-12-23
  • 2021-07-21
  • 2021-08-18
  • 2022-02-22
  • 2022-02-21
相关资源
相似解决方案