MCPcopy Create free account
hub / github.com/MultiMC/Launcher / overlayColors

Method overlayColors

libraries/rainbow/src/rainbow.cpp:351–365  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

349}
350
351QColor Rainbow::overlayColors(const QColor &base, const QColor &paint,
352 QPainter::CompositionMode comp)
353{
354 // This isn't the fastest way, but should be "fast enough".
355 // It's also the only safe way to use QPainter::CompositionMode
356 QImage img(1, 1, QImage::Format_ARGB32_Premultiplied);
357 QPainter p(&img);
358 QColor start = base;
359 start.setAlpha(255); // opaque
360 p.fillRect(0, 0, 1, 1, start);
361 p.setCompositionMode(comp);
362 p.fillRect(0, 0, 1, 1, paint);
363 p.end();
364 return img.pixel(0, 0);
365}

Callers

nothing calls this directly

Calls 1

endMethod · 0.45

Tested by

no test coverage detected