Monopoly — Portage moderne 0.1.0
Portage moderne C/C++23 du Monopoly de 1999
Loading...
Searching...
No Matches
ModernMenuRaster.hpp
Go to the documentation of this file.
1#pragma once
2#include "LegacyBitmap.hpp"
3
5{
6 // For flat 3x shells only: horizontal predicates and source alpha must be
7 // constant over each aligned triplet. Evaluate every output row separately;
8 // the integer vertical gradient can change inside a three-row block.
9 // Photo sampling and token compositing must use the full-resolution path.
10 template<class PaintPixel>
13 {
14 const unsigned step = horizontalTriplets && image.width % 3 == 0 ? 3 : 1;
15 for (unsigned y = 0; y < image.height; ++y)
16 for (unsigned x = 0; x < image.width; x += step)
17 {
18 const auto offset = (std::size_t(y) * image.width + x) * 4;
20 if (step == 3)
21 {
22 auto* pixel = image.pixels.data() + offset;
23 pixel[4] = pixel[8] = pixel[0];
24 pixel[5] = pixel[9] = pixel[1];
25 pixel[6] = pixel[10] = pixel[2];
26 pixel[7] = pixel[11] = pixel[3];
27 }
28 }
29 }
30}
std::size_t offset
LegacyBitmapRGBA8 image
unsigned index
void paintMenuRaster(data::LegacyBitmapRGBA8 &image, bool horizontalTriplets, PaintPixel &&paintPixel)