Fix small circle drawing and add doxygen \since statement

src/fl_draw.cxx: improve documentation, add \since 1.4.0,
  simplify scaling code, use forgotten 'color' argument to set the
  circle color.

src/fl_draw_arrow.cxx: add doxygen \since statement
This commit is contained in:
Albrecht Schlosser 2023-10-15 11:30:19 +02:00
parent 56ad8f8a78
commit fd6accec24
2 changed files with 13 additions and 6 deletions

View File

@ -595,15 +595,18 @@ void fl_draw_check(Fl_Rect bb, Fl_Color col) {
Draw a potentially small, filled circle as a GUI element.
This method draws a filled circle, using fl_pie() if the given diameter
\p d is larger than 6 pixels (aka FLTK units).
\p d is larger than 6 pixels after scaling with the current screen
scaling factor (i.e. "physical" pixels).
If \p d is 6 or smaller it approximates a filled circle by drawing several
filled rectangles, depending on the size because fl_pie() might not draw
well on many systems for smaller sizes.
If the diameter is 6 or smaller after scaling it approximates a filled circle
by drawing several filled rectangles, depending on the size because fl_pie()
might not draw well on many systems for smaller sizes.
\param[in] x0,y0 coordinates of top left of the bounding box
\param[in] d diameter == width and height of the bounding box
\param[in] color drawing color
\since 1.4.0
*/
void fl_draw_circle(int x0, int y0, int d, Fl_Color color) {
@ -618,10 +621,12 @@ void fl_draw_circle(int x0, int y0, int d, Fl_Color color) {
// make circles nice on scaled display
// note: we should scale the value up even more for hidpi displays like Apple's Retina
float scale = fl_graphics_driver->scale();
int scaled_d = (scale>1.0) ? ((int)(d*fl_graphics_driver->scale())) : d;
int scaled_d = (scale > 1.0) ? int(d * scale) : d;
// draw the circle
fl_color(color);
switch (scaled_d) {
// Larger circles draw fine...
default:

View File

@ -1,7 +1,7 @@
//
// Arrow drawing code for the Fast Light Tool Kit (FLTK).
//
// Copyright 1998-2022 by Bill Spitzak and others.
// Copyright 1998-2023 by Bill Spitzak and others.
//
// This library is free software. Distribution and use rights are outlined in
// the file "COPYING" which should have been included with this file. If this
@ -220,6 +220,8 @@ static int fl_draw_arrow_choice(Fl_Rect r, Fl_Color col) {
\param[in] t arrow type
\param[in] o orientation
\param[in] col arrow color
\since 1.4.0
*/
void fl_draw_arrow(Fl_Rect r, Fl_Arrow_Type t, Fl_Orientation o, Fl_Color col) {