Skip to content

Commit

Permalink
point drawing bugfix, typo fix, added figure source
Browse files Browse the repository at this point in the history
  • Loading branch information
skramm committed Mar 16, 2024
1 parent 7b156db commit 20b1b2a
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/homog2d_manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -1870,7 +1870,7 @@ The available functions are given in the table below:
`setPointSize()` | 1 int (pixels) | |
`setThickness()` | 1 int (pixels) | |
`showPoints()` | bool (default is `true`) | Draws the points for<br>Segment and Polyline types |
`setFontSize()` | int (size in pixels) | Only for `putText()` |
`setFontSize()` | int (size in pixels) | Only used for `drawText()` |

For Svg back-end only, the user my add some specific Svg attributes with `setAttribString()`.
For example:
Expand Down
1 change: 1 addition & 0 deletions homog2d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,7 @@ class DrawParams
}
DrawParams& setPointSize( uint8_t ps )
{
_dpValues._pointSize = ps;
_dpValues._ptDelta = ps;
return *this;
}
Expand Down
48 changes: 48 additions & 0 deletions misc/figures_src/src/drawparams_checking.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// this file is part of homog2d
// used to build a figure that is included in manual
// see makefile target doc_fig

#include "fig_src.header"

/// Used to check the drawing parameters for points
/// \todo issue here, the size is not used for type PtStyle::Dot
int main()
{
img::DrawParams dp;
// dp.setThickness(1).showPoints().showIndex();
dp.setThickness(1).showPoints();
dp.setDefault();

img::Image<SvgImage> im1( 400,300 );
img::Image<cv::Mat> im2( 400,300 );


dp.setColor( 250,0,0);
img::PtStyle newPointStyle = img::PtStyle::Plus;

int x0=30;
int y0=40;
int deltax=25;
int deltay=30;
Point2d pt( x0, 30 );

for( int j=0;j<5; j++ )
{
pt.set( x0, y0 );
int s = 3 + j*2;
im2.drawText( std::to_string(s), pt, DrawParams() ); /// \todo check why default arg not implemented !!
pt.translate(deltax,0 );
for( int i=0;i<=(int)img::PtStyle::Dot; i++ )
{
// std::cout << i << " color=" << dp.color() << " pt=" << pt << '\n';
pt.draw( im1, dp.setPointStyle( newPointStyle ).setPointSize(s) );
pt.draw( im2, dp.setPointStyle( newPointStyle ).setPointSize(s) );
newPointStyle = dp._dpValues.nextPointStyle();
pt.translate(0,deltay);
}
pt.translate( deltax, 0 );

}
im1.write( "drawparams_1.svg" );
im2.write( "drawparams_2.png" );
}

0 comments on commit 20b1b2a

Please sign in to comment.