简体   繁体   English

如何将 gdImagePtr 转换为 base64 字符串

[英]How to convert gdImagePtr to base64 string

I am working on streamdeck plugin.我正在研究streamdeck插件。 Streamdeck supports showing custom images is base64 format. Streamdeck 支持显示自定义图像是 base64 格式。 I would like to generate an image using libgd and send the base64 string to streamdeck.我想使用 libgd 生成图像并将 base64 字符串发送到 streamdeck。

You would need to first render to a framebuffer (virtual screen), then capture the texture from that (because no direct reads on a framebuffer), then convert that captured texture to a pixmap, then get the pixels to a bytebuffer, then convert to base64.您需要首先渲染到帧缓冲区(虚拟屏幕),然后从中捕获纹理(因为没有直接读取帧缓冲区),然后将捕获的纹理转换为像素图,然后将像素获取到字节缓冲区,然后转换为base64。

Framebuffer https://libgdx.com/wiki/graphics/opengl-utils/frame-buffer-objects缓冲区 https://libgdx.com/wiki/graphics/opengl-utils/frame-buffer-objects

Framebuffer conversion libgdx TextureRegion to Pixmap帧缓冲区转换libgdx TextureRegion 到 Pixmap

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM