Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous messageGo to previous message
devilsclaw is currently offline  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);
}


index.php?t=getfile&id=6682&private=0
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Text painting issue with 'const char*'
Next Topic: Crash when loading some jpeg files
Goto Forum:
  


Current Time: Tue May 07 14:49:25 CEST 2024

Total time taken to generate the page: 0.01471 seconds