QImage MinimapImageProvider::requestImage ( const QString & id, QSize * size, const QSize & requestedSize )
{
    int width = requestedSize.width() > 0 ? requestedSize.width() : 1024;
    int height = requestedSize.height() > 0 ? requestedSize.height() : 1024;

    const wxImage h = usync().GetMinimap( TowxString( id ), width, height );
    if (size)
        *size = QSize(width,height);
    const QImage q = wxQtConvertImage( h );
    assert( !q.isNull() );
    return q.scaled( width, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
}
QImage VfsImageProvider::requestImage ( const QString & id, QSize * size, const QSize & requestedSize )
{
    int width = requestedSize.width() > 0 ? requestedSize.width() : 1024;
    int height = requestedSize.height() > 0 ? requestedSize.height() : 1024;

    wxImage h;
    try {
        h = usync().GetImage( SLcustomizations().GetModname(), TowxString( id ), false );
    }
    catch ( std::exception& e ) {
    }

    if (size)
        *size = QSize(width,height);

    const QImage q = wxQtConvertImage( h );
    return q.scaled( width, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
}
예제 #3
0
bool Customizations::GetBitmap( const wxString& key, wxBitmap& bitmap )
{
	if ( Provides( key ) )
	{
		const wxString path = m_customs.getSingleValue( key );
#ifdef SL_QT_MODE
		wxBitmap icon_bmp ( wxQtConvertImage( usync().GetQImage( m_modname, path, false ) ) );
#else
		wxBitmap icon_bmp (usync().GetImage( m_modname, path, false ) );
#endif
		if( icon_bmp.IsOk() )
		{
			bitmap = icon_bmp;
			return true;
		}
	}
	return false;//either loaded bmp was kaput or key not found
}