MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / GetTexDataAsRGBA32

Method GetTexDataAsRGBA32

lib/imgui/imgui_draw.cpp:1671–1693  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1669}
1670
1671void ImFontAtlas::GetTexDataAsRGBA32(unsigned char** out_pixels, int* out_width, int* out_height, int* out_bytes_per_pixel)
1672{
1673 // Convert to RGBA32 format on demand
1674 // Although it is likely to be the most commonly used format, our font rendering is 1 channel / 8 bpp
1675 if (!TexPixelsRGBA32)
1676 {
1677 unsigned char* pixels = NULL;
1678 GetTexDataAsAlpha8(&pixels, NULL, NULL);
1679 if (pixels)
1680 {
1681 TexPixelsRGBA32 = (unsigned int*)IM_ALLOC((size_t)TexWidth * (size_t)TexHeight * 4);
1682 const unsigned char* src = pixels;
1683 unsigned int* dst = TexPixelsRGBA32;
1684 for (int n = TexWidth * TexHeight; n > 0; n--)
1685 *dst++ = IM_COL32(255, 255, 255, (unsigned int)(*src++));
1686 }
1687 }
1688
1689 *out_pixels = (unsigned char*)TexPixelsRGBA32;
1690 if (out_width) *out_width = TexWidth;
1691 if (out_height) *out_height = TexHeight;
1692 if (out_bytes_per_pixel) *out_bytes_per_pixel = 4;
1693}
1694
1695ImFont* ImFontAtlas::AddFont(const ImFontConfig* font_cfg)
1696{

Calls

no outgoing calls

Tested by

no test coverage detected