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

Implement Bitmap editing #110

Closed
CPKreu opened this issue Dec 17, 2020 · 0 comments
Closed

Implement Bitmap editing #110

CPKreu opened this issue Dec 17, 2020 · 0 comments
Labels
enhancement New feature or request extension Extra features or bug fixing for extensions up-for-grabs

Comments

@CPKreu
Copy link
Member

CPKreu commented Dec 17, 2020

Add a class for interacting with the currently open bitmap. Use ExtensionManager.RegisterGlobal() to register a class.
Classes that are gonna be used in lua need to have the [MoonSharpUserData] attribute

The class could look something like this

[MoonSharpUserData]
class LuaBitmapEditor
{
	public void SetPixel(int x, int y, byte r, byte g, byte b, byte a)
	{
		BitmapManager.activeBitmap.SetPixel(x, y, Color.FromArgb(a, r, g, b));
	}
}

On application start, ExtensionManager.RegisterGlobal<LuaBitmapEditor>("Bitmap") has to be called

A lua script would then be able to set a pixel like this

function Test()
	Bitmap.SetPixel(2, 2, 3, 255, 80, 90, 255);
end

Classes for interacting with lua should be put in Models/ExtensionsModule/

@CPKreu CPKreu created this issue from a note in Extension Module (To do) Dec 17, 2020
@CPKreu CPKreu added enhancement New feature or request extension Extra features or bug fixing for extensions up-for-grabs labels Dec 17, 2020
@CPKreu CPKreu closed this as completed May 30, 2021
Extension Module automation moved this from To do to Done May 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request extension Extra features or bug fixing for extensions up-for-grabs
Projects
Development

No branches or pull requests

1 participant