Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » Single Pixel Wide Straight Lines
Re: Single Pixel Wide Straight Lines [message #59020 is a reply to message #59012] |
Fri, 14 October 2022 23:58 |
devilsclaw
Messages: 72 Registered: August 2022
|
Member |
|
|
To fix the below I ended up doing this.
void DrawLine(BufferPainter* bp, int x1, int y1, int x2, int y2, double stroke, Color color) {
double center_of_line_x = 0;
double center_of_line_y = 0;
if(x1 == x2) {
center_of_line_x = stroke / 2.0;
}
if(y1 == y2) {
center_of_line_y = stroke / 2.0;
}
bp->Move(x1 + center_of_line_x, y1 + center_of_line_y).Line(x2 + center_of_line_x, y2 + center_of_line_y).Stroke(stroke, color);
}
|
|
|
Goto Forum:
Current Time: Tue May 07 14:49:25 CEST 2024
Total time taken to generate the page: 0.01471 seconds
|