MCPcopy Create free account
hub / github.com/bluescan/tacentview / DoFillColourInterface

Method DoFillColourInterface

Src/Resize.cpp:238–278  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

236
237
238void Viewer::DoFillColourInterface(const char* toolTipText, bool contactSheetFillColour)
239{
240 Config::ProfileData& profile = Config::GetProfileData();
241 tColour4f floatCol(contactSheetFillColour ? profile.FillColourContact : profile.FillColour);
242 ImGui::ColorEdit4
243 (
244 "Fill##Colour", floatCol.E,
245 ImGuiColorEditFlags_AlphaBar | ImGuiColorEditFlags_Uint8 | ImGuiColorEditFlags_AlphaPreviewHalf | ImGuiColorEditFlags_NoInputs
246 );
247
248 tColour4b* fillColour = contactSheetFillColour ? &profile.FillColourContact : &profile.FillColour;
249 fillColour->Set(floatCol);
250 if (toolTipText)
251 Gutil::ToolTip(toolTipText);
252
253 float buttonWidth = Gutil::GetUIParamScaled(56.0f, 2.5f);
254
255 ImGui::SameLine();
256 tPicture* picture = CurrImage ? CurrImage->GetCurrentPic() : nullptr;
257 if (ImGui::Button("Origin", tVector2(buttonWidth, 0.0f)) && picture)
258 fillColour->Set(picture->GetPixel(0, 0));
259 Gutil::ToolTip("Pick the colour from pixel (0,0) in the current image.");
260
261 ImGui::SameLine();
262 if (ImGui::Button("Cursor", tVector2(buttonWidth, 0.0f)))
263 fillColour->Set(Viewer::PixelColour);
264 Gutil::ToolTip("Pick the colour from the cursor pixel in the current image.");
265
266 ImGui::SameLine();
267 if (ImGui::Button("Reset", tVector2(buttonWidth, 0.0f)))
268 {
269 if (contactSheetFillColour)
270 fillColour->Set(tColour4b::transparent);
271 else
272 fillColour->Set(tColour4b::black);
273 }
274 if (contactSheetFillColour)
275 Gutil::ToolTip("Reset the fill colour to transparent black.");
276 else
277 Gutil::ToolTip("Reset the fill colour to black.");
278}
279
280
281//

Callers

nothing calls this directly

Calls 3

GetCurrentPicMethod · 0.80
GetPixelMethod · 0.80
SetMethod · 0.45

Tested by

no test coverage detected