2011-08-24 15:30:41 +00:00
|
|
|
/*
|
2011-09-30 18:15:37 +00:00
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
2011-08-24 15:30:41 +00:00
|
|
|
*
|
|
|
|
* Copyright (C) 2011 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
2011-09-30 18:15:37 +00:00
|
|
|
* Copyright (C) 2011 KiCad Developers, see change_log.txt for contributors.
|
2011-08-24 15:30:41 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include <wx/image.h>
|
|
|
|
#include <wx/bitmap.h>
|
|
|
|
#include <wx/mstream.h>
|
|
|
|
|
|
|
|
#include "bitmaps.h"
|
|
|
|
|
|
|
|
|
2011-09-08 05:58:45 +00:00
|
|
|
#if defined(USE_PNG_BITMAPS)
|
2011-08-28 20:02:27 +00:00
|
|
|
|
2011-08-29 03:04:59 +00:00
|
|
|
wxBitmap KiBitmap( BITMAP_DEF aBitmap )
|
2011-08-24 15:30:41 +00:00
|
|
|
{
|
2011-08-29 03:04:59 +00:00
|
|
|
wxMemoryInputStream is( aBitmap->png, aBitmap->byteCount );
|
2011-08-24 15:30:41 +00:00
|
|
|
|
|
|
|
return wxBitmap( wxImage( is, wxBITMAP_TYPE_PNG, -1 ), -1 );
|
|
|
|
}
|
|
|
|
|
2011-08-29 03:04:59 +00:00
|
|
|
wxBitmap* KiBitmapNew( BITMAP_DEF aBitmap )
|
2011-08-28 20:02:27 +00:00
|
|
|
{
|
2011-08-29 03:04:59 +00:00
|
|
|
wxMemoryInputStream is( aBitmap->png, aBitmap->byteCount );
|
2011-08-28 20:02:27 +00:00
|
|
|
|
|
|
|
return new wxBitmap( wxImage( is, wxBITMAP_TYPE_PNG, -1 ), -1 );
|
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
// temporary during migration to PNG. Soon the argument to these calls becomes the
|
|
|
|
// opaque BITMAP_DEF&.
|
|
|
|
|
2011-08-29 03:04:59 +00:00
|
|
|
wxBitmap KiBitmap( BITMAP_DEF aBitmap )
|
2011-08-28 20:02:27 +00:00
|
|
|
{
|
|
|
|
return wxBitmap( aBitmap );
|
|
|
|
}
|
|
|
|
|
2011-08-29 03:04:59 +00:00
|
|
|
wxBitmap* KiBitmapNew( BITMAP_DEF aBitmap )
|
2011-08-28 20:02:27 +00:00
|
|
|
{
|
|
|
|
return new wxBitmap( aBitmap );
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|