Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » Single Pixel Wide Straight Lines
Re: Single Pixel Wide Straight Lines [message #59021 is a reply to message #59012] |
Sat, 15 October 2022 09:23   |
Oblivion
Messages: 1226 Registered: August 2007
|
Senior Contributor |
|
|
Quote:is there a way to paint pixels in an array or buffer or something so I can do that my self.
Yes. ImageBuffer allows direct access to its RGBA buffer.
e.g:
void Paint(Draw& w) override
{
Size sz = GetSize();
w.DrawRect(sz, Black());
ImageBuffer canvas(sz);
for(int y = 0; y < sz.cy; y++) {
for(int x = 0; x < sz.cx; x++) {
if((y % 16 == 0) || (x % 16 == 0))
canvas[y][x] = White();
}
}
w.DrawImage(0, 0, canvas);
}
is possible.
Best regards,
Oblivion
Github page: https://github.com/ismail-yilmaz
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
|
|
|
Goto Forum:
Current Time: Sun Aug 24 15:18:38 CEST 2025
Total time taken to generate the page: 0.04600 seconds
|