【问题标题】:How to take screenshots using marmalade with c++?如何使用带有 C++ 的果酱截取屏幕截图?
【发布时间】:2014-04-28 19:39:00
【问题描述】:

我在文档中搜索并没有找到任何东西,然后在谷歌上搜索后我发现了这个 glReadPixels,我想我可以截屏。

我需要创建一个带有图像的 facebookdialog,所以我使用以下行:

static s3eFBRequest* req = s3eFBRequest_WithGraphPath(MultiLoginScene::getSession(), "me/photos", "POST");
s3eFBRequest_AddParamString(req, "picture", XXX);

XXX 是一个 const char*,这将是我需要截取的屏幕截图,然后我将发送请求。

我该怎么做?

【问题讨论】:

    标签: c++ screenshot marmalade


    【解决方案1】:

    果酱网站不见了。不幸的是,答案没有在这里发布,而是简短地发布:

    int w = s3eSurfaceGetInt(S3E_SURFACE_WIDTH);
    int h = s3eSurfaceGetInt(S3E_SURFACE_HEIGHT);
    
    int dataSize = w * h * 3;
    unsigned char *framebuffer = (unsigned char *) malloc(dataSize * sizeof(unsigned char));
    glReadPixels(0, 0, w, h, GL_RGB, GL_UNSIGNED_BYTE, framebuffer);
    flipVertical(framebuffer, w, h);
    
    CIwImage image;
    image.SetFormat(CIwImage::BGR_888);
    image.SetWidth(w);
    image.SetHeight(h);
    image.SetBuffers(framebuffer, dataSize);
    image.SavePng(filename);
    
    free(framebuffer);
    

    【讨论】:

      【解决方案2】:

      您必须先在果酱网站上搜索这些功能。已经有一个非常好的书面答案here

      PS:请停止发布多个问同一件事的问题。

      【讨论】:

        猜你喜欢
        • 2011-05-01
        • 1970-01-01
        • 1970-01-01
        • 2021-08-27
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-01-13
        相关资源
        最近更新 更多