ImageGlyph::ImageGlyph(const ImageRGBA& rgba, AlloyContext* context, bool mipmap) : Glyph("image_rgba", GlyphType::Image, 0, 0) { handle = nvgCreateImageRGBA(context->nvgContext, rgba.width, rgba.height, (mipmap) ? NVG_IMAGE_GENERATE_MIPMAPS : 0, rgba.ptr()); width = (pixel) rgba.width; height = (pixel) rgba.height; }
void ImageGlyph::set(const ImageRGBA& rgba, AlloyContext* context) { nvgUpdateImage(context->nvgContext, handle, rgba.ptr()); }
void Application::getScreenShot(ImageRGBA& img) { int w = 0, h = 0; glfwGetFramebufferSize(context->window, &w, &h); img.resize(w, h); glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, img.ptr()); }