9 #define GLFW_EXPOSE_NATIVE_WIN32 10 #define GLFW_EXPOSE_NATIVE_WGL 37 if (DrawList ==
nullptr)
40 DrawList->AddRectFilled({ 0,0 }, { 1,1 },
ImColor(
MAGIC / 255.
f, 0.
f, 0.
f, 1.
f));
60 std::shared_ptr<HDC> shared_hdc(&hdc, [&](HDC* hdc) {ReleaseDC(hwn, *hdc); DeleteDC(*hdc);});
62 HDC hCaptureDC = CreateCompatibleDC(hdc);
63 if (hCaptureDC ==
nullptr)
66 std::shared_ptr<HDC> shared_capture_hdc(&hCaptureDC, [&](HDC* hdc) {ReleaseDC(hwn, *hdc); DeleteDC(*hdc);});
68 HBITMAP hCaptureBitmap = CreateCompatibleBitmap(hdc, width, height);
69 if (hCaptureBitmap ==
nullptr)
72 std::shared_ptr<HBITMAP> shared_bmp(&hCaptureBitmap, [&](HBITMAP* bmp) {DeleteObject(bmp);});
74 auto original = SelectObject(hCaptureDC, hCaptureBitmap);
75 if (original ==
nullptr)
78 if (!BitBlt(hCaptureDC, 0, 0, width, height, hdc, 0, 0, SRCCOPY | CAPTUREBLT))
81 BITMAPINFO bmi = { 0 };
82 bmi.bmiHeader.biSize =
sizeof(bmi.bmiHeader);
83 bmi.bmiHeader.biWidth =
width;
84 bmi.bmiHeader.biHeight =
height;
85 bmi.bmiHeader.biPlanes = 1;
86 bmi.bmiHeader.biBitCount = 32;
87 bmi.bmiHeader.biCompression = BI_RGB;
89 std::vector<RGBQUAD> pPixels(width * height);
101 if (
res <= 0 ||
res == ERROR_INVALID_PARAMETER)
104 auto ret = pPixels[0].rgbRed ==
MAGIC;
IMGUI_API void PushStyleVar(ImGuiStyleVar idx, float val)
IMGUI_API void SetNextWindowPos(const ImVec2 &pos, ImGuiSetCond cond=0)
IMGUI_API ImDrawList * GetWindowDrawList()
IMGUI_API bool Begin(const char *name, bool *p_open=NULL, ImGuiWindowFlags flags=0)
IMGUI_API void PopStyleVar(int count=1)
GLint GLsizei GLsizei height
bool is_gui_aligned(GLFWwindow *win)
GLFWAPI void glfwSwapBuffers(GLFWwindow *window)
Swaps the front and back buffers of the specified window.
The header of the native access functions.
void ImGui_ImplGlfw_NewFrame(float scale_factor)
struct GLFWwindow GLFWwindow
GLFWAPI HWND glfwGetWin32Window(GLFWwindow *handle)