kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #13262
Bug in Bit Map to component tool
Hello,
I think I have found a small error in the Bit Map to component tool.
It is most noticeable when 'Negate Image' is selected in the options.
It produces graphic artifacts along the top edge from the left and down
the left side from the top.
The errors appear to be the for next loops counting from one rather than
from zero.
I tested it in a local copy from the repository and this removed the
artifacts.
Regards Peter Wintulich
Line 257 and 258 should be :
for( int y = 0; y < h; y++ )
for( int x = 0; x < w; x++ )
Line 279 and 280 should be :
for( int y = 0; y < h; y++ )
for( int x = 0; x < w; x++ )
In File:
~kicad-stable-committers/kicad/stable
<https://code.launchpad.net/%7Ekicad-stable-committers/kicad/stable> :
/bitmap2component
<http://bazaar.launchpad.net/%7Ekicad-stable-committers/kicad/stable/files/4027/bitmap2component>/bitmap2cmp_gui.cpp
(revision 4027)
Existing code is
Lines 249 through 286.
void BM2CMP_FRAME::Binarize( double aThreshold )
{
unsigned int pixin;
unsigned char pixout;
int h = m_Greyscale_Image.GetHeight();
int w = m_Greyscale_Image.GetWidth();
unsigned int threshold = (int)(aThreshold * 256);
for( int y = 1; y < h; y++ )
for( int x = 1; x < w; x++ )
{
pixin = m_Greyscale_Image.GetGreen( x, y );
if( pixin < threshold )
pixout = 0;
else
pixout = 255;
m_NB_Image.SetRGB( x, y, pixout, pixout, pixout );
}
m_BN_Bitmap = wxBitmap( m_NB_Image );
}
void BM2CMP_FRAME::NegateGreyscaleImage( )
{
unsigned char pix;
int h = m_Greyscale_Image.GetHeight();
int w = m_Greyscale_Image.GetWidth();
for( int y = 1; y < h; y++ )
for( int x = 1; x < w; x++ )
{
pix = m_Greyscale_Image.GetGreen( x, y );
pix = ~pix;
m_Greyscale_Image.SetRGB( x, y, pix, pix, pix );
}
}
--
Peter Wintulich
Voicetronix Pty. Ltd.
Level 1, 246 Pulteney Street,
ADELAIDE 5000
South Australia
AUSTRALIA
+61 8 8232 9112
Follow ups