feat: adds hexcode below the cursor

This commit is contained in:
bun137 2024-11-17 19:24:18 +05:30
parent fca94078a7
commit 20c592ad10

View file

@ -425,26 +425,18 @@ void CHyprpicker::renderSurface(CLayerSurface* pSurface, bool forceInactive) {
cairo_clip(PCAIRO);
cairo_paint(PCAIRO);
const auto THECOLOR = getColorFromPixel(pSurface, CLICKPOS);
printf("thecolor has been gotten and it is %d %d %d\n", THECOLOR.r, THECOLOR.g, THECOLOR.b);
char hexBuffer[8];
sprintf(hexBuffer, "#%02x%02x%02x", THECOLOR.r, THECOLOR.g, THECOLOR.b);
const auto currentColor = getColorFromPixel(pSurface, CLICKPOS);
char hexBuffer[8];
sprintf(hexBuffer, "#%02x%02x%02x", currentColor.r, currentColor.g, currentColor.b);
cairo_set_source_rgba(PCAIRO, 1.0, 1.0, 1.0, 1.0);
printf("hallo\n");
cairo_select_font_face(PCAIRO, "monospace", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size(PCAIRO, 18);
cairo_move_to(PCAIRO, CLICKPOS.x, CLICKPOS.y + 40);
printf("pos is %f %f\n", CLICKPOS.x, CLICKPOS.y);
printf("Rendering hex code at position: (%f, %f)\n", CLICKPOS.x, CLICKPOS.y + 40);
printf("hexbuffer contains %s\n", hexBuffer);
cairo_show_text(PCAIRO, hexBuffer);
cairo_surface_flush(PBUFFER->surface);
cairo_restore(PCAIRO);
cairo_pattern_destroy(PATTERN);
}
} else if (!m_bRenderInactive) {