MCPcopy Create free account
hub / github.com/Wemino/MarkerPatch / ImFontAtlasBuildRenderBitmapFromString

Function ImFontAtlasBuildRenderBitmapFromString

include/imgui/imgui_draw.cpp:3550–3575  ·  view source on GitHub ↗

Render a white-colored bitmap encoded in a string

Source from the content-addressed store, hash-verified

3548
3549// Render a white-colored bitmap encoded in a string
3550void ImFontAtlasBuildRenderBitmapFromString(ImFontAtlas* atlas, int x, int y, int w, int h, const char* in_str, char in_marker_char)
3551{
3552 ImTextureData* tex = atlas->TexData;
3553 IM_ASSERT(x >= 0 && x + w <= tex->Width);
3554 IM_ASSERT(y >= 0 && y + h <= tex->Height);
3555
3556 switch (tex->Format)
3557 {
3558 case ImTextureFormat_Alpha8:
3559 {
3560 ImU8* out_p = (ImU8*)tex->GetPixelsAt(x, y);
3561 for (int off_y = 0; off_y < h; off_y++, out_p += tex->Width, in_str += w)
3562 for (int off_x = 0; off_x < w; off_x++)
3563 out_p[off_x] = (in_str[off_x] == in_marker_char) ? 0xFF : 0x00;
3564 break;
3565 }
3566 case ImTextureFormat_RGBA32:
3567 {
3568 ImU32* out_p = (ImU32*)tex->GetPixelsAt(x, y);
3569 for (int off_y = 0; off_y < h; off_y++, out_p += tex->Width, in_str += w)
3570 for (int off_x = 0; off_x < w; off_x++)
3571 out_p[off_x] = (in_str[off_x] == in_marker_char) ? IM_COL32_WHITE : IM_COL32_BLACK_TRANS;
3572 break;
3573 }
3574 }
3575}
3576
3577static void ImFontAtlasBuildUpdateBasicTexData(ImFontAtlas* atlas)
3578{

Callers 1

Calls 1

GetPixelsAtMethod · 0.80

Tested by

no test coverage detected