Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simpledisplay: Sprite.takeScreenshot() returns a completely black MemoryImage #432

Open
TheZipCreator opened this issue Apr 29, 2024 · 1 comment

Comments

@TheZipCreator
Copy link

Sprite's takeScreenshot() function returns an entirely black TrueColorImage. It should just return an image containing what was on the sprite.
This works correctly on Linux, but not on Windows

example code:

import arsd.simpledisplay, arsd.png;

void main() {
	auto win = new SimpleWindow(500, 500, "Test");
	auto img = Image.fromMemoryImage(readPng("./smiley.png")); // replace "./smiley.png" with a path to an image on your computer
	auto sprite = new Sprite(win, img);
	auto sprite2 = Sprite.fromMemoryImage(win, sprite.takeScreenshot(), true); // *should* just copy the data in the other sprite
	scope(exit) {
		sprite.dispose();
		sprite2.dispose();
	}
	win.eventLoop(10, delegate() {
		auto sp = win.draw;
		// this should be two copies of the same image, but on Windows it doesn't work
		sprite.drawAt(sp, Point(0, 0));
		sprite2.drawAt(sp, Point(100, 0));
	});
}
@adamdruppe
Copy link
Owner

I might have only implemented it on windows themselves, will need to check if it does win32 bitmap copy too (which is an easy operation but ... maybe i missed a spot)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants