Skip to content

Commit

Permalink
Merge branch 'master' into scrollCrashFix
Browse files Browse the repository at this point in the history
  • Loading branch information
Geist-of-the-Automaton authored Apr 26, 2021
2 parents d1f1947 + fb18045 commit 7a00077
Show file tree
Hide file tree
Showing 18 changed files with 382 additions and 783 deletions.
Binary file added Menus/Icons/Histogram Equalization.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Menus/Icons/Histograms.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions Menus/mainMenubar.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Edit;Brush Mode,Vector Mode,Raster Mode,Copy,Cut,Paste,Delete,Select All,
Brush;Brush Radius,Brush Color,Take Color,Brush Strength,Spray Density,Brush Filter Strength,Brush Shape>,Brush Filter>,Brush Method>,Brush Profilers>(Radial Profiler,Pattern Profiler,Shape Profiler,),Pattern>(Pattern On,Pattern Off,),
Vector;Vector Width,Vector Filter Strength,Vector Mode>(Color Vector,Filter Vector,),Vector Color>(Vector Color 1,Vector Color 2,Swap Colors,),Vector Taper>(Taper 1,Taper 2,Swap Tapers,Taper Style>(Single Taper,Double Taper,),),Vector Filter>,
Raster;Fill Color,Take Color,Flip Selection Vertical,Flip Selection Horizontal,Transparency Fill,Apply Kernal To Selection,Apply Filter To Selection>,
View;Zoom 100%,Set Zoom,Zoom In,Zoom Out,Foreground>(On,Off,),
Layer;Set Active Layer,Layer Opacity (Alpha),Layer Filter Strength,Layer Filter>,Manage Layers>(Insert Layer,Copy Layer,Paste Layer,Cut Layer,Delete Layer,Move Backward,Move Forward,Move To Back,Move To Front,Compile Layer,),
View;Zoom 100%,Set Zoom,Zoom In,Zoom Out,Histograms,Histogram Equalization,Foreground>(On,Off,),
Layer;Set Active Layer,Layer Opacity (Alpha),Layer Filter Strength,Layer Filter>,Manage Layers>(Insert Layer,Copy Layer,Paste Layer,Cut Layer,Delete Layer,Move Backward,Move Forward,Move To Back,Move To Front,Compile Layer),
Frame;Compile Frame,
About;Help,About,
25 changes: 16 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The focus of Glass Opus, and the team behind it, is to provide a free software t

The team is using Microsoft coding guidelines. Found [here](https://www.cise.ufl.edu/~mschneid/Research/C++%20Programming%20Style%20Guidelines.htm) and implemented via [this](https://docs.microsoft.com/en-us/cpp/code-quality/using-the-cpp-core-guidelines-checkers?view=vs-2019https://docs.microsoft.com/en-us/cpp/code-quality/using-the-cpp-core-guidelines-checkers?view=vs-2019).

Visit our [website](https://sccapstone.github.io/SnakyBusiness/) to learn more about Glass Opus and view the demo video.

## External Requirements

The app be run via the executable in the zip folder under the most recent release.
Expand All @@ -23,24 +25,29 @@ The app be run via the executable in the zip folder under the most recent releas

There are two options to running the software:
1. Once Qt <!--and the OpenCV libs have-->has been correctly installed, one must open the project in Qt and press the run button in the bottom left of the Qt gui. (This option requires the Qt libraries to be on your path.)
2. Open the bin folder and run the Roto.exe file.
2. Launch Glass Opus via the Windows start menu, desktop shortcut, or by opening the executable in the installation (or zip folder if used).

# Testing

Coming Soon
Tests are run automatically, verified by the user. Test are used to verify that basic functionality has not been altered or damaged.

## Testing Technology

Coming Soon
Testing can only be done in the Debug Release of Glass Opus.

## Running Tests

Coming Soon
After launching the Debug Release, add a new Layer, then press the F7 Key. A prompt appears warning the user that running tests will wipe their project and ask them if
they wish to continue. Upon selecting Yes, a list will be brought up with all tests that can be run. Clicking on the name of a test will run that test, then re-prompt
for further testing. Selecting Run All Tests will go through each test one by one. When using Run All Tests, or certain other tests, there will be pop up windows at
certain intervals, clicking OK on these windows will allow the test to progress.

When finished testing, simply close the prompt box or click Cancel.

# Authors

- Auden Childress, [email protected], [email protected]
- Ben Kronemeyer, [email protected], [email protected]
- Matthew Pollard, [email protected], [email protected]
- Malik Melvin, [email protected], [email protected]
- Thomas Wilks, [email protected], [email protected]
- Auden Childress, [email protected], [email protected]
- Ben Kronemeyer, [email protected], [email protected]
- Matthew Pollard, [email protected], [email protected]
- Malik Melvin, [email protected], [email protected]
- Thomas Wilks, [email protected], [email protected]
4 changes: 0 additions & 4 deletions Roto/Roto.pro
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ QT = core gui widgets
RC_ICONS = execIco.ico

HEADERS = \
$$PWD/base85.h \
$$PWD/brush.h \
$$PWD/brushhandler.h \
$$PWD/brushshape.h \
Expand All @@ -23,15 +22,13 @@ HEADERS = \
$$PWD/ui_mainwindow.h \
$$PWD/ui_radialprofiler.h \
$$PWD/ui_resizewindow.h \
$$PWD/undoredo.h \
$$PWD/viewscroller.h\
$$PWD/ui_brushShape.h\
$$PWD/ui_patternprofiler.h\
$$PWD/brushShape.h\
$$PWD/patternprofiler.h

SOURCES = \
$$PWD/base85.cpp \
$$PWD/brush.cpp \
$$PWD/brushhandler.cpp \
$$PWD/brushshape.cpp \
Expand All @@ -47,7 +44,6 @@ SOURCES = \
$$PWD/screenrender.cpp \
$$PWD/splinevector.cpp \
$$PWD/triangle.cpp \
$$PWD/undoredo.cpp \
$$PWD/viewscroller.cpp\
$$PWD/brushShape.cpp\
$$PWD/patternprofiler.cpp
Expand Down
37 changes: 17 additions & 20 deletions Roto/brush.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#include "brush.h"

Brush::Brush(string brushName, int Radius)
{
Brush::Brush(string brushName, int Radius) {
size = 0;
radius = static_cast<unsigned char>(Radius);
size = 2 * radius + 1;
init = true;
setShape(brushName);
tempMap = vector <vector <unsigned char> >(219, vector<unsigned char>(219));
}

Brush::~Brush() {
Expand Down Expand Up @@ -37,13 +36,17 @@ void Brush::setRadius(int r) {
delete [] brushMap;
radius = stdFuncs::clamp(static_cast<unsigned char>(r), minRadius, maxRadius);
size = 2 * radius + 1;
init = true;
update();
}

void Brush::update() {
brushMap = new unsigned char*[static_cast<size_t>(size)];
for (int i = 0; i < size; ++i)
brushMap[i] = new unsigned char[static_cast<size_t>(size)];
if (init) {
init = false;
brushMap = new unsigned char*[static_cast<size_t>(size)];
for (int i = 0; i < size; ++i)
brushMap[i] = new unsigned char[static_cast<size_t>(size)];
}
switch (shape) {
case square:
createSquare();
Expand All @@ -69,9 +72,6 @@ void Brush::update() {
case octagon:
createOctagon();
break;
case custom:
createCustom();
break;
}
}

Expand Down Expand Up @@ -140,16 +140,13 @@ void Brush::createOctagon() {
brushMap[i][j] = (x + y < (3 * radius) / 2);
}
}
void Brush::createCustom(){
for(int i = 0; i< size; i++){
for(int j = 0; j< size; j++)
brushMap[i][j] = tempMap[i][j];
}
void Brush::setCustom(vector <vector < unsigned char > > custom) {
shape = Shape::custom;
for(int i = 0; i < size; ++i)
for(int j = 0; j < size; ++j)
brushMap[i][j] = custom[i][j];
}
void Brush::sendTo(std::vector<std::vector<unsigned char>> pattern){
for (int i = 0; i < pattern.size(); ++i){
for (int j = 0; j < pattern[i].size(); ++j) {
tempMap[i][j] = pattern[i][j];
}
}

Shape Brush::getBrushShape() {
return shape;
}
9 changes: 4 additions & 5 deletions Roto/brush.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ enum Shape {square, circle, vertical, horizontal, lDiagonal, rDiagonal, diamond,
const string brushShapes[] = {"Square", "Circle", "Vertical", "Horizontal", "Left Diagonal", "Right Diagonal", "Diamond", "Octagon", "Custom"};

const int numBrushes = 9;
const unsigned char maxRadius = 64;
const unsigned char maxRadius = 61;
const unsigned char minRadius = 0;

class Brush {
Expand All @@ -23,13 +23,12 @@ class Brush {
Brush(string brushName = brushShapes[0], int Radius = 10);
~Brush();
void setShape(string brushName);
void setCustom(vector <vector <unsigned char> > custom);
void setRadius(int r);
int getRadius();
int getFullSize();
const unsigned char *const *const getBrushMap();
void sendTo(vector <vector < unsigned char > > pattern);
vector <vector <unsigned char> > tempMap;

Shape getBrushShape();

private:

Expand All @@ -43,10 +42,10 @@ class Brush {
void createDiamond();
void createOctagon();
void createCustom();

unsigned char radius, **brushMap;
Shape shape;
unsigned short size;
bool init;
};

#endif // BRUSH_H
65 changes: 26 additions & 39 deletions Roto/brushhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,26 +16,25 @@ brushHandler::brushHandler(unsigned char str, int size, int density, string type
for (int j = 0; j < fullSize; ++j)
radialMap[i][j] = 1;
patternInUse = false;
patternXDim = patternYDim = 1;
patternMap = new unsigned char*[patternXDim];
patternMap[0] = new unsigned char[patternYDim];
patternMap[0][0] = 0;
int xpsize = 20, ypsize = 20;
vector<vector<unsigned char>> arr(xpsize, vector<unsigned char>(ypsize));
for (int i = 0; i < xpsize; ++i) {
for (int j = 0; j < ypsize; ++j)
arr[i][j] = (j > i) ? 1 : 0;
}
setPattern(xpsize, ypsize, arr);
patternMap.push_back(vector <unsigned char> ());
patternMap.push_back(vector <unsigned char> ());
patternMap[0].push_back(1);
patternMap[0].push_back(0);
patternMap[1].push_back(0);
patternMap[1].push_back(1);
ipolActive = false;
relativityPoint = QPoint(-1000,-1000);
resetPoint();
}

brushHandler::~brushHandler() {
for (int i = 0; i < patternYDim; ++i)
delete [] patternMap[i];
delete [] patternMap;

}

void brushHandler::setAppMethod(string type) {
Expand All @@ -54,8 +53,11 @@ void brushHandler::setFilter(string filterName) {
brushFilter.setFilter(filterName);
}

void brushHandler::setShape(string shape) {
brush.setShape(shape);
void brushHandler::setShape(string shape, vector <vector <unsigned char> > custom) {
if (shape == "Custom")
brush.setCustom(custom);
else
brush.setShape(shape);
}

int brushHandler::getMethodIndex() {
Expand Down Expand Up @@ -159,37 +161,18 @@ const unsigned char *const *const brushHandler::getBrushMap() {
return brush.getBrushMap();
}

void brushHandler::setPattern(int xDim, int yDim, vector<vector<unsigned char>>pattern) {
for (int j = 0; j < patternYDim; ++j)
delete [] patternMap[j];
delete [] patternMap;
patternXDim = static_cast<unsigned char>(xDim);
patternYDim = static_cast<unsigned char>(yDim);
patternMap = new unsigned char *[patternXDim];
for (int i = 0; i < patternXDim; ++i) {
patternMap[i] = new unsigned char [patternYDim];
for (int j = 0; j < patternYDim; ++j)
patternMap[i][j] = pattern[i][j];
}
void brushHandler::setPattern(vector <vector <unsigned char> > pattern) {
patternMap = pattern;
}

void brushHandler::setPatternInUse(int used) {
patternInUse = static_cast<unsigned char>(used);
}

const unsigned char *const *const brushHandler::getPatternMap() {
const unsigned char *const *const retMap = patternMap;
vector <vector <unsigned char> > brushHandler::getPatternMap() {
return patternMap;
}

int brushHandler::getPatternXDim() {
return patternXDim;
}

int brushHandler::getPatternYDim() {
return patternYDim;
}

bool brushHandler::getPatternInUse() {
return patternInUse;
}
Expand Down Expand Up @@ -329,7 +312,7 @@ void brushHandler::overwrite(QImage *qi) {
for (int i = currPnt.x() - radius; i <= currPnt.x() + radius; ++i) {
int y = 0;
for (int j = currPnt.y() - radius; j <= currPnt.y() + radius; ++j) {
if (onScreen(i, j, xMax, yMax) && brushMap[x][y] && (!sprayDensity || !(rand() % sprayDensity)) && (!patternInUse || patternMap[i % patternXDim][j % patternYDim]))
if (onScreen(i, j, xMax, yMax) && brushMap[x][y] && (!sprayDensity || !(rand() % sprayDensity)) && (!patternInUse || patternMap[i % patternMap.size()][j % patternMap[0].size()]))
qi->setPixel(i, j, qc);
++y;
}
Expand Down Expand Up @@ -366,7 +349,7 @@ void brushHandler::additive(QImage *qi) {
for (int i = p.x() - radius; i <= p.x() + radius; ++i) {
int y = 0;
for (int j = p.y() - radius; j <= p.y() + radius; ++j) {
if (onScreen(i, j, xMax, yMax) && brushMap[x][y] && (!sprayDensity || !(rand() % sprayDensity)) && (!patternInUse || patternMap[i % patternXDim][j % patternYDim])) {
if (onScreen(i, j, xMax, yMax) && brushMap[x][y] && (!sprayDensity || !(rand() % sprayDensity)) && (!patternInUse || patternMap[i % patternMap.size()][j % patternMap[0].size()])) {
if (!checkMap[x + checkEdgeSize][y + checkEdgeSize]) {
QColor qc = qi->pixelColor(i, j);
setColor.setRed((qc.red() + r) & 255);
Expand Down Expand Up @@ -400,7 +383,7 @@ void brushHandler::subractive(QImage *qi) {
for (int i = currPnt.x() - radius; i <= currPnt.x() + radius; ++i) {
int y = 0;
for (int j = currPnt.y() - radius; j <= currPnt.y() + radius; ++j) {
if (onScreen(i, j, xMax, yMax) && brushMap[x][y] && (!sprayDensity || !(rand() % sprayDensity)) && (!patternInUse || patternMap[i % patternXDim][j % patternYDim])) {
if (onScreen(i, j, xMax, yMax) && brushMap[x][y] && (!sprayDensity || !(rand() % sprayDensity)) && (!patternInUse || patternMap[i % patternMap.size()][j % patternMap[0].size()])) {
if (!checkMap[x + checkEdgeSize][y + checkEdgeSize]) {
QColor qc = qi->pixelColor(i, j);
setColor.setRed(max(0, qc.red() - r));
Expand Down Expand Up @@ -431,7 +414,7 @@ void brushHandler::filter(QImage *qi) {
for (int i = currPnt.x() - radius; i <= currPnt.x() + radius; ++i) {
int y = 0;
for (int j = currPnt.y() - radius; j <= currPnt.y() + radius; ++j) {
if (onScreen(i, j, xMax, yMax) && brushMap[x][y] && (!sprayDensity || !(rand() % sprayDensity)) && (!patternInUse || patternMap[i % patternXDim][j % patternYDim])) {
if (onScreen(i, j, xMax, yMax) && brushMap[x][y] && (!sprayDensity || !(rand() % sprayDensity)) && (!patternInUse || patternMap[i % patternMap.size()][j % patternMap[0].size()])) {
if (!checkMap[x + checkEdgeSize][y + checkEdgeSize]) {
qi->setPixel(i, j, brushFilter.applyTo(qi->pixelColor(i, j)));
checkMap[x + checkEdgeSize][y + checkEdgeSize] = 255;
Expand Down Expand Up @@ -475,7 +458,7 @@ void brushHandler::radial(QImage *qi) {
int y = 0;
int trueX = x - radius;
for (int j = currPnt.y() - radius; j <= currPnt.y() + radius; ++j) {
if (onScreen(i, j, xMax, yMax) && brushMap[x][y] && (!sprayDensity || !(rand() % sprayDensity)) && (!patternInUse || patternMap[i % patternXDim][j % patternYDim])) {
if (onScreen(i, j, xMax, yMax) && brushMap[x][y] && (!sprayDensity || !(rand() % sprayDensity)) && (!patternInUse || patternMap[i % patternMap.size()][j % patternMap[0].size()])) {
int trueY = y - radius;
int checkStr = sqrt(trueX * trueX + trueY * trueY) + 1;
if (checkMap[x + checkEdgeSize][y + checkEdgeSize] > checkStr || checkMap[x + checkEdgeSize][y + checkEdgeSize] == 0) {
Expand Down Expand Up @@ -509,7 +492,7 @@ void brushHandler::sample(QImage *qi) {
for (int i = -radius; i <= radius; ++i) {
int y = 0;
for (int j = -radius; j <= radius; ++j) {
if (onScreen(samplePoint.x() + i + rx, samplePoint.y() + j + ry, xMax, yMax) && onScreen(currPnt.x() + i, currPnt.y() + j, xMax, yMax) && brushMap[x][y] && (!sprayDensity || !(rand() % sprayDensity)) && (!patternInUse || patternMap[i % patternXDim][j % patternYDim]))
if (onScreen(samplePoint.x() + i + rx, samplePoint.y() + j + ry, xMax, yMax) && onScreen(currPnt.x() + i, currPnt.y() + j, xMax, yMax) && brushMap[x][y] && (!sprayDensity || !(rand() % sprayDensity)) && (!patternInUse || patternMap[i % patternMap.size()][j % patternMap[0].size()]))
qi->setPixel(currPnt.x() + i, currPnt.y() + j, qi->pixel(samplePoint.x() + i+ rx, samplePoint.y() + j + ry));
++y;
}
Expand All @@ -519,7 +502,6 @@ void brushHandler::sample(QImage *qi) {
}
}


void brushHandler::erase(QImage *qi, QPoint qp) {
QColor color = brushColor;
appMethod am = method;
Expand All @@ -529,3 +511,8 @@ void brushHandler::erase(QImage *qi, QPoint qp) {
method = am;
brushColor = color;
}

Shape brushHandler::getBrushShape() {
return brush.getBrushShape();
}

Loading

0 comments on commit 7a00077

Please sign in to comment.