using a rgbswap for the moment

This commit is contained in:
Uwe Rathmann 2023-12-15 19:16:28 +01:00
parent 7837ff6c8c
commit 3e32a14264
6 changed files with 50 additions and 16 deletions

View File

@ -63,7 +63,11 @@ namespace
to the quickeffects module.
*/
setShaderFileName( VertexStage, ":/shaders/blur.vert.qsb" );
#if 0
setShaderFileName( FragmentStage, ":/shaders/blur.frag.qsb" );
#else
setShaderFileName( FragmentStage, ":/shaders/rgbswap.frag.qsb" );
#endif
}
bool updateUniformData( RenderState& state,

View File

@ -13,6 +13,7 @@
#include <QskGraphicLabel.h>
#include <QskGraphic.h>
#include <QskEvent.h>
#include <QskRgbValue.h>
#include <QGuiApplication>
#include <QDebug>
@ -22,6 +23,17 @@
#include "Overlay.h"
class Image : public QskGraphicLabel
{
public:
Image( QQuickItem* parent = nullptr )
: QskGraphicLabel( parent )
{
const QImage image( ":/images/parrots.jpg" );
setGraphic( QskGraphic::fromImage( image ) );
}
};
class ForegroundItem : public QskLinearBox
{
public:
@ -31,10 +43,7 @@ class ForegroundItem : public QskLinearBox
setMargins( 20 );
#if 1
auto label = new QskGraphicLabel( this );
const QImage image( ":/images/parrots.jpg" );
label->setGraphic( QskGraphic::fromImage( image ) );
auto label = new Image( this );
label->setSizePolicy( QskSizePolicy::Fixed, QskSizePolicy::Fixed );
label->setLayoutAlignmentHint( Qt::AlignCenter );
label->setObjectName( "miniParrots" );
@ -86,16 +95,15 @@ class BackgroundItem : public QskControl
BackgroundItem( QQuickItem* parent = nullptr )
: QskControl( parent )
{
m_label = new QskGraphicLabel( this );
m_label->setFillMode( QskGraphicLabel::Stretch );
setObjectName( "background" );
const QImage image( ":/images/parrots.jpg" );
m_label->setGraphic( QskGraphic::fromImage( image ) );
#if 1
m_label = new Image( this );
m_label->setFillMode( QskGraphicLabel::Stretch );
m_label->setObjectName( "parrots" );
#endif
startTimer( 20 );
setObjectName( "background" );
m_label->setObjectName( "parrots" );
}
protected:
@ -127,11 +135,12 @@ class BackgroundItem : public QskControl
labelRect.adjust( margin, margin, -margin, -margin );
labelRect.translate( margin * x, margin * y );
if ( m_label )
m_label->setGeometry( labelRect );
}
private:
QskGraphicLabel* m_label;
QskGraphicLabel* m_label = nullptr;
};
class MainView : public QskControl
@ -146,8 +155,8 @@ class MainView : public QskControl
#if 0
{
auto box = new QskBox( m_background );
box->setGeometry( 0, 0, 600, 400 );
box->setFillGradient( Qt::darkRed );
box->setGeometry( 20, 20, 600, 400 );
box->setFillGradient( QskRgb::SaddleBrown );
box->setObjectName( "redBox" );
}
#endif
@ -158,7 +167,7 @@ class MainView : public QskControl
{
auto box = new QskBox( m_background );
box->setGeometry( 50, 50, 400, 200 );
box->setFillGradient( Qt::darkBlue );
box->setFillGradient( QskRgb::PaleGreen );
box->setObjectName( "blueBox" );
}
#endif

View File

@ -6,5 +6,7 @@
<file>shaders/blur.vert.qsb</file>
<file>shaders/blur.frag.qsb</file>
<file>shaders/rgbswap.frag.qsb</file>
</qresource>
</RCC>

View File

@ -0,0 +1,18 @@
#version 440
layout( location = 0 ) in vec2 coord;
layout( location = 0 ) out vec4 fragColor;
layout( binding = 1 ) uniform sampler2D source;
layout( std140, binding = 0 ) uniform buf
{
mat4 matrix;
float opacity;
} ubuf;
void main()
{
vec4 c = texture( source, coord );
fragColor = c.yzxw * ubuf.opacity;;
}

Binary file not shown.

View File

@ -7,3 +7,4 @@ function qsbcompile {
qsbcompile blur-vulkan.vert
qsbcompile blur-vulkan.frag
qsbcompile rgbswap-vulkan.frag