如何使用带有c++的果酱进行屏幕截图

How to take screenshots using marmalade with c++?

本文关键字:果酱 屏幕截图 c++ 何使用      更新时间:2023-10-16

我沿着文档进行了搜索,但一无所获,然后在谷歌上搜索后,我找到了这个glReadPixels,我想我可能可以截屏了。

我需要创建一个有图像的Facebook对话框,所以我使用以下行:

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

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

我该怎么做?

Marmalade网站不见了。不幸的是,这里没有公布答案,只是简短地说:

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);

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

附言:请停止发布多个问题问同一件事。