[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 494
  • Last Modified:

C++ to Delphi

Hi,

Could you please convert to delphi:
public static BufferedImage glScreenshot() {
	glReadBuffer(GL_FRONT);
	int w = Display.getDisplayMode().getWidth();
	int h = Display.getDisplayMode().getHeight();
	int bpp = 4;
	ByteBuffer buffer = BufferUtils.createByteBuffer(w * h * bpp);
 
	glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
 
	BufferedImage image = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB);
 
	for (int x = 0; x < w; x++) {
		for (int y = 0; y < h; y++) {
			int i = (x + (w * y)) * bpp;
			int r = buffer.get(i) & 0xFF;
			int g = buffer.get(i + 1) & 0xFF;
			int b = buffer.get(i + 2) & 0xFF;
			image.setRGB(x, h - (y + 1), (0xFF << 24) | (r << 16) | (g << 8) | b);
		}
	}
 
	return image;
}

Open in new window


Ty!
0
Júlio
Asked:
Júlio
1 Solution
 
jkrCommented:
This might not help much, but: That's not valid C++ code. "public static" wouldn't compile.
0
 
JúlioAuthor Commented:
ok ty!
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now