我在网上找到一个库中的以下代码中的原始RGBA值中有一个位图。 “svgren。从std :: vector中的原始RGB值的CBitmap <std :: uint32_t>控制数组
auto img = svgren::render(*dom, width, height); //uses 96 dpi by default
//At this point the 'width' and 'height' variables were filled with
//the actual width and height of the rendered image.
//Returned 'img' is a std::vector<std::uint32_t> holding array of RGBA values.
我需要知道如何让这幅画进入的CBitmap这样我就可以在一个MFC图片控件中显示它。我的前胶料它,我知道如何显示在控制位图什么我不能做的是RGBA值加载到该位图。任何想法吗?
直接使用createBitmap: –
CBitmap Chb; \t \t \t HBITMAP bmp = CreateBitmap(width,height,1,32,&* img.begin()); \t \t \t ASSERT_ALWAYS(BMP!= NULL) \t \t \t Chb.Attach(BMP); \t \t \t //PicControl.ModifyStyle(0xF,SS_BITMAP,SWP_NOSIZE); \t \t \t //PicControl.SetBitmap(Chb); \t \t \t mProjectorWindow.m_picControl.ModifyStyle(0xF,SS_BITMAP,SWP_NOSIZE); \t \t \t mProjectorWindow.m_picControl.SetBitmap(Chb); –
相关 - https://stackoverflow.com/questions/4993518/arraybyte-to-hbitmap-or-cbitmap – sashoalm