Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
mahuifa
QMDemo
提交
54424e00
Q
QMDemo
项目概览
mahuifa
/
QMDemo
通知
1
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Q
QMDemo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
54424e00
编写于
8月 16, 2022
作者:
mahuifa
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
新功能:Imagecomposition功能开发
上级
de0a895c
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
167 addition
and
2 deletion
+167
-2
PaintingDemo/Imagecomposition/Image.qrc
PaintingDemo/Imagecomposition/Image.qrc
+6
-0
PaintingDemo/Imagecomposition/Imagecomposition.pro
PaintingDemo/Imagecomposition/Imagecomposition.pro
+3
-0
PaintingDemo/Imagecomposition/images/butterfly.png
PaintingDemo/Imagecomposition/images/butterfly.png
+0
-0
PaintingDemo/Imagecomposition/images/checker.png
PaintingDemo/Imagecomposition/images/checker.png
+0
-0
PaintingDemo/Imagecomposition/widget.cpp
PaintingDemo/Imagecomposition/widget.cpp
+76
-0
PaintingDemo/Imagecomposition/widget.h
PaintingDemo/Imagecomposition/widget.h
+16
-0
PaintingDemo/Imagecomposition/widget.ui
PaintingDemo/Imagecomposition/widget.ui
+66
-2
未找到文件。
PaintingDemo/Imagecomposition/Image.qrc
0 → 100644
浏览文件 @
54424e00
<RCC>
<qresource prefix="/">
<file>images/butterfly.png</file>
<file>images/checker.png</file>
</qresource>
</RCC>
PaintingDemo/Imagecomposition/Imagecomposition.pro
浏览文件 @
54424e00
...
...
@@ -42,3 +42,6 @@ msvc {
QMAKE_CFLAGS
+=
/
utf
-
8
QMAKE_CXXFLAGS
+=
/
utf
-
8
}
RESOURCES
+=
\
Image
.
qrc
PaintingDemo/Imagecomposition/images/butterfly.png
0 → 100644
浏览文件 @
54424e00
36.0 KB
PaintingDemo/Imagecomposition/images/checker.png
0 → 100644
浏览文件 @
54424e00
10.1 KB
PaintingDemo/Imagecomposition/widget.cpp
浏览文件 @
54424e00
#include "widget.h"
#include "ui_widget.h"
#include <QDebug>
Widget
::
Widget
(
QWidget
*
parent
)
:
QWidget
(
parent
)
,
ui
(
new
Ui
::
Widget
)
{
ui
->
setupUi
(
this
);
addOp
(
QPainter
::
CompositionMode_SourceOver
,
"SourceOver"
);
addOp
(
QPainter
::
CompositionMode_DestinationOver
,
"DestinationOver"
);
addOp
(
QPainter
::
CompositionMode_Clear
,
"Clear"
);
addOp
(
QPainter
::
CompositionMode_Source
,
"Source"
);
addOp
(
QPainter
::
CompositionMode_Destination
,
"Destination"
);
addOp
(
QPainter
::
CompositionMode_SourceIn
,
"SourceIn"
);
addOp
(
QPainter
::
CompositionMode_DestinationIn
,
"DestinationIn"
);
addOp
(
QPainter
::
CompositionMode_SourceOut
,
"SourceOut"
);
addOp
(
QPainter
::
CompositionMode_DestinationOut
,
"DestinationOut"
);
addOp
(
QPainter
::
CompositionMode_SourceAtop
,
"SourceAtop"
);
addOp
(
QPainter
::
CompositionMode_DestinationAtop
,
"DestinationAtop"
);
addOp
(
QPainter
::
CompositionMode_Xor
,
"Xor"
);
// svg 1.2混合模式
addOp
(
QPainter
::
CompositionMode_Plus
,
"Plus"
);
addOp
(
QPainter
::
CompositionMode_Multiply
,
"Multiply"
);
addOp
(
QPainter
::
CompositionMode_Screen
,
"Screen"
);
addOp
(
QPainter
::
CompositionMode_Overlay
,
"Overlay"
);
addOp
(
QPainter
::
CompositionMode_Darken
,
"Darken"
);
addOp
(
QPainter
::
CompositionMode_Lighten
,
"Lighten"
);
addOp
(
QPainter
::
CompositionMode_ColorDodge
,
"ColorDodge"
);
addOp
(
QPainter
::
CompositionMode_ColorBurn
,
"ColorBurn"
);
addOp
(
QPainter
::
CompositionMode_HardLight
,
"HardLight"
);
addOp
(
QPainter
::
CompositionMode_SoftLight
,
"SoftLight"
);
addOp
(
QPainter
::
CompositionMode_Difference
,
"Difference"
);
addOp
(
QPainter
::
CompositionMode_Exclusion
,
"Exclusion"
);
// ROPs
addOp
(
QPainter
::
RasterOp_SourceOrDestination
,
"SourceOrDestination"
);
addOp
(
QPainter
::
RasterOp_SourceAndDestination
,
"SourceAndDestination"
);
addOp
(
QPainter
::
RasterOp_SourceXorDestination
,
"SourceXorDestination"
);
addOp
(
QPainter
::
RasterOp_NotSourceAndNotDestination
,
"NotSourceAndNotDestination"
);
addOp
(
QPainter
::
RasterOp_NotSourceOrNotDestination
,
"NotSourceOrNotDestination"
);
addOp
(
QPainter
::
RasterOp_NotSourceXorDestination
,
"NotSourceXorDestination"
);
addOp
(
QPainter
::
RasterOp_NotSource
,
"NotSource"
);
addOp
(
QPainter
::
RasterOp_NotSourceAndDestination
,
"NotSourceAndDestination"
);
addOp
(
QPainter
::
RasterOp_SourceAndNotDestination
,
"SourceAndNotDestination"
);
addOp
(
QPainter
::
RasterOp_NotSourceOrDestination
,
"NotSourceOrDestination"
);
addOp
(
QPainter
::
RasterOp_SourceOrNotDestination
,
"SourceOrNotDestination"
);
addOp
(
QPainter
::
RasterOp_ClearDestination
,
"ClearDestination"
);
addOp
(
QPainter
::
RasterOp_SetDestination
,
"SetDestination"
);
addOp
(
QPainter
::
RasterOp_NotDestination
,
"NotDestination"
);
}
Widget
::~
Widget
()
...
...
@@ -13,3 +58,34 @@ Widget::~Widget()
delete
ui
;
}
void
Widget
::
addOp
(
QPainter
::
CompositionMode
mode
,
const
QString
&
name
)
{
ui
->
operatorComboBox
->
addItem
(
name
,
mode
);
}
void
Widget
::
loadImage
(
const
QString
&
fileName
,
QImage
&
image
,
QToolButton
*
button
)
{
if
(
!
image
.
load
(
fileName
))
// 加载图片
{
return
;
}
image
=
image
.
scaled
(
ui
->
sourceButton
->
size
(),
Qt
::
KeepAspectRatio
);
}
void
Widget
::
on_sourceButton_clicked
()
{
}
void
Widget
::
on_destinationButton_clicked
()
{
}
void
Widget
::
on_operatorComboBox_currentIndexChanged
(
int
index
)
{
}
PaintingDemo/Imagecomposition/widget.h
浏览文件 @
54424e00
...
...
@@ -2,6 +2,8 @@
#define WIDGET_H
#include <QWidget>
#include <QPainter>
#include <QToolButton>
QT_BEGIN_NAMESPACE
namespace
Ui
{
class
Widget
;
}
...
...
@@ -15,7 +17,21 @@ public:
Widget
(
QWidget
*
parent
=
nullptr
);
~
Widget
();
private
slots
:
void
on_sourceButton_clicked
();
void
on_destinationButton_clicked
();
void
on_operatorComboBox_currentIndexChanged
(
int
index
);
private:
void
addOp
(
QPainter
::
CompositionMode
mode
,
const
QString
&
name
);
void
loadImage
(
const
QString
&
fileName
,
QImage
&
image
,
QToolButton
*
button
);
private:
Ui
::
Widget
*
ui
;
QImage
sourceImage
;
QImage
destinationImage
;
QImage
resultImage
;
};
#endif // WIDGET_H
PaintingDemo/Imagecomposition/widget.ui
浏览文件 @
54424e00
...
...
@@ -6,13 +6,77 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
800
</width>
<height>
60
0
</height>
<width>
1051
</width>
<height>
29
0
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Widget
</string>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
>
<item
row=
"0"
column=
"1"
>
<widget
class=
"QComboBox"
name=
"operatorComboBox"
/>
</item>
<item
row=
"0"
column=
"3"
>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Fixed"
vsizetype=
"Preferred"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"font"
>
<font>
<pointsize>
31
</pointsize>
<weight>
75
</weight>
<bold>
true
</bold>
</font>
</property>
<property
name=
"text"
>
<string>
=
</string>
</property>
</widget>
</item>
<item
row=
"0"
column=
"4"
>
<widget
class=
"QLabel"
name=
"resultLabel"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Preferred"
vsizetype=
"Expanding"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"text"
>
<string/>
</property>
</widget>
</item>
<item
row=
"0"
column=
"0"
>
<widget
class=
"QToolButton"
name=
"sourceButton"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Minimum"
vsizetype=
"Preferred"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"text"
>
<string/>
</property>
</widget>
</item>
<item
row=
"0"
column=
"2"
>
<widget
class=
"QToolButton"
name=
"destinationButton"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Minimum"
vsizetype=
"Preferred"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"text"
>
<string/>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录