mirror of
https://github.com/creyD/intelliphoto.git
synced 2026-04-12 19:40:28 +02:00
circle docs
This commit is contained in:
111
src/Tool/IntelliTool.h.autosave
Normal file
111
src/Tool/IntelliTool.h.autosave
Normal file
@@ -0,0 +1,111 @@
|
||||
#ifndef Intelli_Tool_H
|
||||
#define Intelli_Tool_H
|
||||
|
||||
#include "IntelliHelper/IntelliColorPicker.h"
|
||||
#include <vector>
|
||||
|
||||
class LayerObject;
|
||||
class PaintingArea;
|
||||
|
||||
/*!
|
||||
* \brief An abstract class that manages the basic events, like mouse clicks or scrolls events.
|
||||
*/
|
||||
class IntelliTool{
|
||||
private:
|
||||
/*!
|
||||
* \brief A function that creates a layer to draw on.
|
||||
*/
|
||||
void createToolLayer();
|
||||
|
||||
/*!
|
||||
* \brief A function that merges the drawing- and the active- layer.
|
||||
*/
|
||||
void mergeToolLayer();
|
||||
|
||||
/*!
|
||||
* \brief A function that deletes the drawinglayer.
|
||||
*/
|
||||
void deleteToolLayer();
|
||||
protected:
|
||||
/*!
|
||||
* \brief A pointer to the general PaintingArea to interact with.
|
||||
*/
|
||||
PaintingArea* Area;
|
||||
|
||||
/*!
|
||||
* \brief A pointer to the IntelliColorPicker of the PaintingArea to interact with, and get the colors.
|
||||
*/
|
||||
IntelliColorPicker* colorPicker;
|
||||
|
||||
/*!
|
||||
* \brief A pointer to the underlying active Layer, do not work on this. This is used for data grabbing or previews.
|
||||
*/
|
||||
LayerObject* Active;
|
||||
|
||||
/*!
|
||||
* \brief A pointer to the drawing canvas of the tool, work on this.
|
||||
*/
|
||||
LayerObject* Canvas;
|
||||
|
||||
/*!
|
||||
* \brief A flag checking if the user is currently drawing or not.
|
||||
*/
|
||||
bool drawing = false;
|
||||
|
||||
public:
|
||||
/*!
|
||||
* \brief A constructor setting the general Painting Area and colorPicker.
|
||||
* \param Area - The general PaintingArea used by the project.
|
||||
* \param colorPicker - The general colorPicker used by the project.
|
||||
*/
|
||||
IntelliTool(PaintingArea* Area, IntelliColorPicker* colorPicker);
|
||||
|
||||
/*!
|
||||
* \brief An abstract Destructor.
|
||||
*/
|
||||
virtual ~IntelliTool() = 0;
|
||||
|
||||
/*!
|
||||
* \brief A function managing the right click Pressed of a Mouse. Constructing the Canvas to draw on. Call this in child classes!
|
||||
* \param x - The x coordinate relative to the Active/Canvas Layer.
|
||||
* \param y - The y coordinate relative to the Active/Canvas Layer.
|
||||
*/
|
||||
virtual void onMouseRightPressed(int x, int y);
|
||||
|
||||
/*!
|
||||
* \brief A function managing the right click Released of a Mouse. Merging the Canvas to Active. Call this in child classes!
|
||||
* \param x - The x coordinate relative to the Active/Canvas Layer.
|
||||
* \param y - The y coordinate relative to the Active/Canvas Layer.
|
||||
*/
|
||||
virtual void onMouseRightReleased(int x, int y);
|
||||
|
||||
/*!
|
||||
* \brief A function managing the left click Pressed of a Mouse. Resetting the current draw. Call this in child classes!
|
||||
* \param x - The x coordinate relative to the Active/Canvas Layer.
|
||||
* \param y - The y coordinate relative to the Active/Canvas Layer.
|
||||
*/
|
||||
virtual void onMouseLeftPressed(int x, int y);
|
||||
|
||||
/*!
|
||||
* \brief A function managing the left click Released of a Mouse. Call this in child classes!
|
||||
* \param x - The x coordinate relative to the Active/Canvas Layer.
|
||||
* \param y - The y coordinate relative to the Active/Canvas Layer.
|
||||
*/
|
||||
virtual void onMouseLeftReleased(int x, int y);
|
||||
|
||||
/*!
|
||||
* \brief A function managing the scroll event. A Positive Value means scrolling outwards. Call this in child classes!
|
||||
* \param value - The absolute the scroll has changed.
|
||||
*/
|
||||
virtual void onWheelScrolled(int value);
|
||||
|
||||
/*!
|
||||
* \brief A function managing the mouse moved event. Call this in child classes!
|
||||
* \param x - The x coordinate of the new Mouse Position.
|
||||
* \param y - The y coordinate of the new Mouse Position.
|
||||
*/
|
||||
virtual void onMouseMoved(int x, int y);
|
||||
|
||||
|
||||
};
|
||||
#endif
|
||||
@@ -4,24 +4,82 @@
|
||||
|
||||
#include "QColor"
|
||||
#include "QPoint"
|
||||
|
||||
/*!
|
||||
* \brief The IntelliToolCircle class representing a tool to draw a circle.
|
||||
*/
|
||||
class IntelliToolCircle : public IntelliTool{
|
||||
/*!
|
||||
* \brief A function that implements a circle drawing algorithm.
|
||||
* \param radius - The radius of the circle.
|
||||
*/
|
||||
void drawCyrcle(int radius);
|
||||
|
||||
/*!
|
||||
* \brief The center of the circle.
|
||||
*/
|
||||
QPoint Middle;
|
||||
|
||||
/*!
|
||||
* \brief The alpha value of the inner circle.
|
||||
*/
|
||||
int alphaInner;
|
||||
|
||||
/*!
|
||||
* \brief The width of the outer circle edge.
|
||||
*/
|
||||
int edgeWidth;
|
||||
public:
|
||||
/*!
|
||||
* \brief A constructor setting the general Painting Area and colorPicker. And reading in the The inner alpha and edgeWIdth.
|
||||
* \param Area - The general PaintingArea used by the project.
|
||||
* \param colorPicker - The general colorPicker used by the project.
|
||||
*/
|
||||
IntelliToolCircle(PaintingArea* Area, IntelliColorPicker* colorPicker);
|
||||
|
||||
/*!
|
||||
* \brief An Destructor.
|
||||
*/
|
||||
virtual ~IntelliToolCircle() override;
|
||||
|
||||
/*!
|
||||
* \brief A function managing the right click Pressed of a Mouse. Sets the middle point of the cricle.
|
||||
* \param x - The x coordinate relative to the Active/Canvas Layer.
|
||||
* \param y - The y coordinate relative to the Active/Canvas Layer.
|
||||
*/
|
||||
virtual void onMouseRightPressed(int x, int y) override;
|
||||
|
||||
/*!
|
||||
* \brief A function managing the right click Released of a Mouse.
|
||||
* \param x - The x coordinate relative to the Active/Canvas Layer.
|
||||
* \param y - The y coordinate relative to the Active/Canvas Layer.
|
||||
*/
|
||||
virtual void onMouseRightReleased(int x, int y) override;
|
||||
|
||||
/*!
|
||||
* \brief A function managing the left click Pressed of a Mouse. Clearing the canvas layer.
|
||||
* \param x - The x coordinate relative to the Active/Canvas Layer.
|
||||
* \param y - The y coordinate relative to the Active/Canvas Layer.
|
||||
*/
|
||||
virtual void onMouseLeftPressed(int x, int y) override;
|
||||
|
||||
/*!
|
||||
* \brief A function managing the left click Released of a Mouse.
|
||||
* \param x - The x coordinate relative to the Active/Canvas Layer.
|
||||
* \param y - The y coordinate relative to the Active/Canvas Layer.
|
||||
*/
|
||||
virtual void onMouseLeftReleased(int x, int y) override;
|
||||
|
||||
/*!
|
||||
* \brief A function managing the scroll event. Changing the edge Width relative to value.
|
||||
* \param value - The absolute the scroll has changed.
|
||||
*/
|
||||
virtual void onWheelScrolled(int value) override;
|
||||
|
||||
/*!
|
||||
* \brief A function managing the mouse moved event. Draws a circle with radius of eulerian norm of mouse position and the middle point.
|
||||
* \param x - The x coordinate of the new Mouse Position.
|
||||
* \param y - The y coordinate of the new Mouse Position.
|
||||
*/
|
||||
virtual void onMouseMoved(int x, int y) override;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user