mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-12 19:40:28 +02:00
Tool structure implemented
This commit is contained in:
@@ -89,7 +89,7 @@ void IntelliPhotoGui::slotCreateNewLayer()
|
||||
// Create New Layer
|
||||
if (ok1&&ok2)
|
||||
{
|
||||
int layer = paintingArea->addLayer(width,height,100,100);
|
||||
int layer = paintingArea->addLayer(width,height,0,0);
|
||||
paintingArea->slotActivateLayer(layer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,8 +163,8 @@ void PaintingArea::slotActivateLayer(int a){
|
||||
// Set that we are currently drawing
|
||||
void PaintingArea::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
int x = (float)layerBundle[activeLayer].width/(float)width()*event->x()+layerBundle[activeLayer].widthOffset;
|
||||
int y = (float)layerBundle[activeLayer].hight/(float)height()*event->y()+layerBundle[activeLayer].hightOffset;
|
||||
int x = event->x()-layerBundle[activeLayer].widthOffset;
|
||||
int y = event->y()-layerBundle[activeLayer].hightOffset;
|
||||
if(event->button() == Qt::LeftButton){
|
||||
Tool->onMouseLeftPressed(x, y);
|
||||
}else if(event->button() == Qt::RightButton){
|
||||
@@ -178,16 +178,16 @@ void PaintingArea::mousePressEvent(QMouseEvent *event)
|
||||
// from the last position to the current
|
||||
void PaintingArea::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
int x = (float)layerBundle[activeLayer].width/(float)width()*event->x()+layerBundle[activeLayer].widthOffset;
|
||||
int y = (float)layerBundle[activeLayer].hight/(float)height()*event->y()+layerBundle[activeLayer].hightOffset;
|
||||
int x = event->x()-layerBundle[activeLayer].widthOffset;
|
||||
int y = event->y()-layerBundle[activeLayer].hightOffset;
|
||||
Tool->onMouseMoved(x, y);
|
||||
}
|
||||
|
||||
// If the button is released we set variables to stop drawing
|
||||
void PaintingArea::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
int x = (float)layerBundle[activeLayer].width/(float)width()*event->x()+layerBundle[activeLayer].widthOffset;
|
||||
int y = (float)layerBundle[activeLayer].hight/(float)height()*event->y()+layerBundle[activeLayer].hightOffset;
|
||||
int x = event->x()-layerBundle[activeLayer].widthOffset;
|
||||
int y = event->y()-layerBundle[activeLayer].hightOffset;
|
||||
if(event->button() == Qt::LeftButton){
|
||||
Tool->onMouseLeftReleased(x, y);
|
||||
}else if(event->button() == Qt::RightButton){
|
||||
|
||||
@@ -14,8 +14,6 @@ IntelliToolPen::~IntelliToolPen(){
|
||||
void IntelliToolPen::onMouseRightPressed(int x, int y){
|
||||
IntelliTool::onMouseRightPressed(x,y);
|
||||
//implement in here
|
||||
this->point=QPoint(x,y);
|
||||
this->Canvas->image->drawPixel(point, QColor(255,0,0,255));
|
||||
}
|
||||
|
||||
void IntelliToolPen::onMouseRightReleased(int x, int y){
|
||||
@@ -26,6 +24,7 @@ void IntelliToolPen::onMouseRightReleased(int x, int y){
|
||||
void IntelliToolPen::onMouseLeftPressed(int x, int y){
|
||||
//implement in here
|
||||
IntelliTool::onMouseLeftPressed(x,y);
|
||||
this->point=QPoint(x,y);
|
||||
}
|
||||
|
||||
void IntelliToolPen::onMouseLeftReleased(int x, int y){
|
||||
|
||||
Reference in New Issue
Block a user