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

support android ARGB format #655

Open
mgood7123 opened this issue Mar 22, 2023 · 1 comment
Open

support android ARGB format #655

mgood7123 opened this issue Mar 22, 2023 · 1 comment

Comments

@mgood7123
Copy link

No description provided.

@j-kaltes
Copy link

j-kaltes commented Sep 30, 2023

nanovg.h:
// Returns a color value from red, green, blue and alpha values.
NVGcolor nvgRGBA(unsigned char r, unsigned char g, unsigned char b, unsigned char a);

// Returns a color value from red, green, blue and alpha values.
NVGcolor nvgRGBAf(float r, float g, float b, float a);

See also: https://developer.android.com/reference/android/graphics/Color

constexpr const NVGcolor android2NVGcolor(const uint32_t get) {
        return {{{(((get>>16)&0xFF)/255.0f),(0xFF&(get>>8))/255.0f,(get&0xFF)/255.0f,(get>>24)/255.0f}}};
        }    

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