[libcalamaresui] Remove unused image-transformation function
This commit is contained in:
parent
880c367d64
commit
7096ee760e
@ -128,55 +128,6 @@ defaultPixmap( ImageType type, ImageMode mode, const QSize& size )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QPixmap
|
|
||||||
createRoundedImage( const QPixmap& pixmap, const QSize& size, float frameWidthPct )
|
|
||||||
{
|
|
||||||
int height;
|
|
||||||
int width;
|
|
||||||
|
|
||||||
if ( !size.isEmpty() )
|
|
||||||
{
|
|
||||||
height = size.height();
|
|
||||||
width = size.width();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
height = pixmap.height();
|
|
||||||
width = pixmap.width();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !height || !width )
|
|
||||||
{
|
|
||||||
return QPixmap();
|
|
||||||
}
|
|
||||||
|
|
||||||
QPixmap scaledAvatar = pixmap.scaled( width, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
|
|
||||||
if ( frameWidthPct == 0.00f )
|
|
||||||
{
|
|
||||||
return scaledAvatar;
|
|
||||||
}
|
|
||||||
|
|
||||||
QPixmap frame( width, height );
|
|
||||||
frame.fill( Qt::transparent );
|
|
||||||
|
|
||||||
QPainter painter( &frame );
|
|
||||||
painter.setRenderHint( QPainter::Antialiasing );
|
|
||||||
|
|
||||||
QRect outerRect( 0, 0, width, height );
|
|
||||||
QBrush brush( scaledAvatar );
|
|
||||||
QPen pen;
|
|
||||||
pen.setColor( Qt::transparent );
|
|
||||||
pen.setJoinStyle( Qt::RoundJoin );
|
|
||||||
|
|
||||||
painter.setBrush( brush );
|
|
||||||
painter.setPen( pen );
|
|
||||||
painter.drawRoundedRect(
|
|
||||||
outerRect, qreal( frameWidthPct ) * 100.0, qreal( frameWidthPct ) * 100.0, Qt::RelativeSize );
|
|
||||||
|
|
||||||
return frame;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
unmarginLayout( QLayout* layout )
|
unmarginLayout( QLayout* layout )
|
||||||
{
|
{
|
||||||
|
@ -63,7 +63,6 @@ enum ImageMode
|
|||||||
CoverInCase,
|
CoverInCase,
|
||||||
Grid,
|
Grid,
|
||||||
DropShadow,
|
DropShadow,
|
||||||
RoundedCorners
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -78,17 +77,6 @@ UIDLLEXPORT QPixmap defaultPixmap( ImageType type,
|
|||||||
ImageMode mode = CalamaresUtils::Original,
|
ImageMode mode = CalamaresUtils::Original,
|
||||||
const QSize& size = QSize( 0, 0 ) );
|
const QSize& size = QSize( 0, 0 ) );
|
||||||
|
|
||||||
// TODO:3.3:This has only one consumer, move to ImageRegistry, make static
|
|
||||||
/**
|
|
||||||
* @brief createRoundedImage returns a rounded version of a pixmap.
|
|
||||||
* @param avatar the input pixmap.
|
|
||||||
* @param size the new size.
|
|
||||||
* @param frameWidthPct the frame size, as percentage of width.
|
|
||||||
* @return the transformed pixmap.
|
|
||||||
* This one is currently unused.
|
|
||||||
*/
|
|
||||||
UIDLLEXPORT QPixmap createRoundedImage( const QPixmap& avatar, const QSize& size, float frameWidthPct = 0.20f );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief unmarginLayout recursively walks the QLayout tree and removes all margins.
|
* @brief unmarginLayout recursively walks the QLayout tree and removes all margins.
|
||||||
* @param layout the layout to unmargin.
|
* @param layout the layout to unmargin.
|
||||||
|
@ -90,11 +90,6 @@ ImageRegistry::pixmap( const QString& image, const QSize& size, CalamaresUtils::
|
|||||||
|
|
||||||
if ( !pixmap.isNull() )
|
if ( !pixmap.isNull() )
|
||||||
{
|
{
|
||||||
if ( mode == CalamaresUtils::RoundedCorners )
|
|
||||||
{
|
|
||||||
pixmap = CalamaresUtils::createRoundedImage( pixmap, size );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( !size.isNull() && pixmap.size() != size )
|
if ( !size.isNull() && pixmap.size() != size )
|
||||||
{
|
{
|
||||||
if ( size.width() == 0 )
|
if ( size.width() == 0 )
|
||||||
|
Loading…
Reference in New Issue
Block a user