test variant

This commit is contained in:
SalnikovDE
2021-03-09 16:16:32 +03:00
parent 3b0a8c12d4
commit e1d7bf74ba
17 changed files with 1926 additions and 0 deletions

View File

@ -0,0 +1,73 @@
# This file is used to ignore files which are generated
# ----------------------------------------------------------------------------
*~
*.autosave
*.a
*.core
*.moc
*.o
*.obj
*.orig
*.rej
*.so
*.so.*
*_pch.h.cpp
*_resource.rc
*.qm
.#*
*.*#
core
!core/
tags
.DS_Store
.directory
*.debug
Makefile*
*.prl
*.app
moc_*.cpp
ui_*.h
qrc_*.cpp
Thumbs.db
*.res
*.rc
/.qmake.cache
/.qmake.stash
# qtcreator generated files
*.pro.user*
# xemacs temporary files
*.flc
# Vim temporary files
.*.swp
# Visual Studio generated files
*.ib_pdb_index
*.idb
*.ilk
*.pdb
*.sln
*.suo
*.vcproj
*vcproj.*.*.user
*.ncb
*.sdf
*.opensdf
*.vcxproj
*vcxproj.*
# MinGW generated files
*.Debug
*.Release
# Python byte code
*.pyc
# Binaries
# --------
*.dll
*.exe

View File

@ -0,0 +1,62 @@
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11
# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
main.cpp \
mainwindow.cpp
HEADERS += \
mainwindow.h
FORMS += \
mainwindow.ui
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../build/lib/linux_64/release/ -lgraphics
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../build/lib/linux_64/debug/ -lgraphics
else:unix: LIBS += -L$$PWD/../../../../build/lib/linux_64/ -lgraphics
INCLUDEPATH += $$PWD/../../../../DesktopEditor/graphics/pro
DEPENDPATH += $$PWD/../../../../DesktopEditor/graphics/pro
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../build/lib/linux_64/release/ -lkernel
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../build/lib/linux_64/debug/ -lkernel
else:unix: LIBS += -L$$PWD/../../../../build/lib/linux_64/ -lkernel
INCLUDEPATH += $$PWD/../../../../build/lib/linux_64
DEPENDPATH += $$PWD/../../../../build/lib/linux_64
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/../../../../build/lib/linux_64/release/ -lUnicodeConverter
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/../../../../build/lib/linux_64/debug/ -lUnicodeConverter
else:unix: LIBS += -L$$PWD/../../../../build/lib/linux_64/ -lUnicodeConverter
INCLUDEPATH += $$PWD/../../../../UnicodeConverter
DEPENDPATH += $$PWD/../../../../UnicodeConverter
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/./release/ -licuuc
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/./debug/ -licuuc
else:unix: LIBS += -L$$PWD/./ -licuuc
INCLUDEPATH += $$PWD/.
DEPENDPATH += $$PWD/.
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/./release/ -licudata
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/./debug/ -licudata
else:unix: LIBS += -L$$PWD/./ -licudata
INCLUDEPATH += $$PWD/.
DEPENDPATH += $$PWD/.

View File

@ -0,0 +1,12 @@
#include "mainwindow.h"
#include <QApplication>
#include "Graphics.h"
int main(int argc, char *argv[])
{
NSGraphics::Create();
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}

View File

@ -0,0 +1,64 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QPixmap>
struct Color {
uint r,g,b;
Color() {
r = b = g = 0;
}
Color(uint rgb) {
b = rgb % 0x100;
g = (rgb / 0x100) % 0x100;
r = rgb / 0x100 / 0x100;
}
uint get_color() {
return b + g * 0x100 + r * 0x10000;
}
};
void setColor2(QImage &img, uint color) {
for (int i = 0; i < img.size().height(); i++) {
for (int j = 0; j < img.size().width(); j++) {
img.setPixelColor(j, i, QColor(color));
}
}
}
void setLinearGrad(QImage &img, uint color1, uint color2) {
Color c1(color1);
Color c2(color2);
for (int i = 0; i < img.size().height(); i++) {
for (int j = 0; j < img.size().width(); j++) {
Color cr;
cr.r = (j * c2.r + (img.size().width() - j - 1) * c1.r) / img.size().width();
cr.b = (j * c2.b + (img.size().width() - j - 1) * c1.b) / img.size().width();
cr.g = (j * c2.g + (img.size().width() - j - 1) * c1.g) / img.size().width();
img.setPixelColor(j, i, QColor(cr.get_color()));
}
}
}
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
, img("test.png")
, lable(new QLabel)
{
ui->setupUi(this);
QImage pm(600, 600,QImage::Format_RGB888);
setLinearGrad(pm, 0xFF0000, 0x00FF00);
//setColor2(pm, 0x0000FF);
//pm.invertPixels();
ui->lable_test->setPixmap(QPixmap::fromImage(pm));
ui->lable_test->setScaledContents(true);
ui->lable_test->resize(pm.size());
this->resize(pm.size());
}
MainWindow::~MainWindow()
{
delete ui;
}

View File

@ -0,0 +1,23 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QLabel>
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
QImage img;
QLabel *lable;
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H

View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>600</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<property name="enabled">
<bool>true</bool>
</property>
<widget class="QLabel" name="lable_test">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>58</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>800</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<widget class="QToolBar" name="toolBar">
<property name="windowTitle">
<string>toolBar</string>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
</widget>
<resources/>
<connections/>
</ui>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB