No Description

tools.cpp 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. #include "grid.h"
  2. #include <QtGlobal>
  3. #include <iostream>
  4. using namespace std;
  5. // Receives the x,y coordinates of the grid where the user clicked and paints
  6. // that cell with the color of the tool.
  7. void GridWidget::Dot(int x, int y, QColor toolColor){
  8. // Switch/paints on the cell in position x, y
  9. switchOn(x, y, toolColor);
  10. }
  11. // Receives the x,y grid coordinates and the color of cell where the user
  12. // clicked. Paints the row (from that point left and right) of color toolColor until
  13. // it hits a cell of a different color than the one clicked.
  14. void GridWidget::RowMajorFill(int x, int y, QColor colorClicked, QColor toolColor){
  15. for (int i = x; i<getGridColumns() && (getCellColor(i,y) == colorClicked) ; i++)
  16. switchOn(i, y, toolColor);
  17. for (int i = (x-1); i>=0 && (getCellColor(i,y) == colorClicked) ; i--)
  18. switchOn(i, y, toolColor);
  19. }
  20. // Receives the grid x,y coordinates and the color of cell where the user
  21. // clicked. Paints the column (from that point up and down) of color toolColor until
  22. // it hits a cell of a different color than the one clicked.
  23. void GridWidget::ColMajorFill(int x, int y, QColor colorClicked, QColor toolColor){
  24. }
  25. // Receives the grid x,y coordinates and the color of cell where the user
  26. // clicked. Paints a left-diagonal of color toolColor until it hits a cell
  27. // of a different color than the one clicked.
  28. void GridWidget::DiagonalLeft(int x, int y, QColor colorClicked, QColor toolColor){
  29. }
  30. // Receives the grid x,y coordinates and the color of the cell where the user
  31. // clicked. Paints a right-diagonal of color toolColor until it hits a cell
  32. // of a different color than the one clicked.
  33. void GridWidget::DiagonalRight(int x, int y, QColor colorClicked, QColor toolColor){
  34. }
  35. // Paints at x,y a square of the specified size and toolcolor.
  36. void GridWidget::square(int x, int y, QColor toolColor, int toolSize){
  37. }
  38. // Paints at x,y a triangle of the specified size and toolcolor.
  39. void GridWidget::triangle(int x, int y, QColor toolColor, int toolSize){
  40. }
  41. // Paints at x,y a circle of the specified size and toolcolor.
  42. void GridWidget::circle(int x, int y, QColor toolColor, int toolSize){
  43. }
  44. // Floods the grid with the toolcolor starting at cell x,y (whose color is ColorClicked)
  45. void GridWidget::flood_fill(int x, int y, QColor toolColor, QColor ColorClicked){
  46. }