From df54898306d64ae3ac9089abc08941664d3f9b55 Mon Sep 17 00:00:00 2001 From: ladyada Date: Sat, 14 Jul 2018 14:24:10 -0400 Subject: [PATCH] more doxy, add a travis --- .travis.yml | 27 ++++ Adafruit_GFX.cpp | 383 +++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 348 insertions(+), 62 deletions(-) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..654d387 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,27 @@ +language: c +sudo: false +cache: + directories: + - ~/arduino_ide + - ~/.arduino15/packages/ +git: + depth: false + quiet: true +env: + global: + - ARDUINO_IDE_VERSION="1.8.5" + - PRETTYNAME="Adafruit GFX Library" + +before_install: + - source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/install.sh) + +install: + - arduino --install-library "Adafruit ILI9341","Adafruit GFX Library" + +script: + - build_main_platforms + +# Generate and deploy documentation +after_success: + - source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/library_check.sh) + - source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/doxy_gen_and_deploy.sh) \ No newline at end of file diff --git a/Adafruit_GFX.cpp b/Adafruit_GFX.cpp index 6c8177b..642bf14 100755 --- a/Adafruit_GFX.cpp +++ b/Adafruit_GFX.cpp @@ -84,7 +84,16 @@ WIDTH(w), HEIGHT(h) gfxFont = NULL; } -// Bresenham's algorithm - thx wikpedia +/**************************************************************************/ +/*! + @brief Write a line. Bresenham's algorithm - thx wikpedia + @param x0 Start point x coordinate + @param y0 Start point y coordinate + @param x1 End point x coordinate + @param y1 End point y coordinate + @param color 16-bit 5-6-5 Color to draw with +*/ +/**************************************************************************/ void Adafruit_GFX::writeLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, uint16_t color) { int16_t steep = abs(y1 - y0) > abs(x1 - x0); @@ -125,17 +134,35 @@ void Adafruit_GFX::writeLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1, } } +/**************************************************************************/ +/*! + @brief Start a display-writing routine, overwrite in subclasses. +*/ +/**************************************************************************/ void Adafruit_GFX::startWrite(){ - // Overwrite in subclasses if desired! } +/**************************************************************************/ +/*! + @brief Write a pixel, overwrite in subclasses if startWrite is defined! + @param x x coordinate + @param y y coordinate + @param color 16-bit 5-6-5 Color to fill with +*/ +/**************************************************************************/ void Adafruit_GFX::writePixel(int16_t x, int16_t y, uint16_t color){ - // Overwrite in subclasses if startWrite is defined! drawPixel(x, y, color); } -// (x,y) is topmost point; if unsure, calling function -// should sort endpoints or call writeLine() instead +/**************************************************************************/ +/*! + @brief Write a perfectly vertical line, overwrite in subclasses if startWrite is defined! + @param x Top-most x coordinate + @param y Top-most y coordinate + @param h Height in pixels + @param color 16-bit 5-6-5 Color to fill with +*/ +/**************************************************************************/ void Adafruit_GFX::writeFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color) { // Overwrite in subclasses if startWrite is defined! @@ -144,8 +171,15 @@ void Adafruit_GFX::writeFastVLine(int16_t x, int16_t y, drawFastVLine(x, y, h, color); } -// (x,y) is leftmost point; if unsure, calling function -// should sort endpoints or call writeLine() instead +/**************************************************************************/ +/*! + @brief Write a perfectly horizontal line, overwrite in subclasses if startWrite is defined! + @param x Left-most x coordinate + @param y Left-most y coordinate + @param w Width in pixels + @param color 16-bit 5-6-5 Color to fill with +*/ +/**************************************************************************/ void Adafruit_GFX::writeFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color) { // Overwrite in subclasses if startWrite is defined! @@ -154,39 +188,74 @@ void Adafruit_GFX::writeFastHLine(int16_t x, int16_t y, drawFastHLine(x, y, w, color); } +/**************************************************************************/ +/*! + @brief Write a rectangle completely with one color, overwrite in subclasses if startWrite is defined! + @param x Top left corner x coordinate + @param y Top left corner y coordinate + @param w Width in pixels + @param h Height in pixels + @param color 16-bit 5-6-5 Color to fill with +*/ +/**************************************************************************/ void Adafruit_GFX::writeFillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) { // Overwrite in subclasses if desired! fillRect(x,y,w,h,color); } +/**************************************************************************/ +/*! + @brief End a display-writing routine, overwrite in subclasses if startWrite is defined! +*/ +/**************************************************************************/ void Adafruit_GFX::endWrite(){ - // Overwrite in subclasses if startWrite is defined! } -// (x,y) is topmost point; if unsure, calling function -// should sort endpoints or call drawLine() instead +/**************************************************************************/ +/*! + @brief Draw a perfectly vertical line (this is often optimized in a subclass!) + @param x Top-most x coordinate + @param y Top-most y coordinate + @param h Height in pixels + @param color 16-bit 5-6-5 Color to fill with +*/ +/**************************************************************************/ void Adafruit_GFX::drawFastVLine(int16_t x, int16_t y, int16_t h, uint16_t color) { - // Update in subclasses if desired! startWrite(); writeLine(x, y, x, y+h-1, color); endWrite(); } -// (x,y) is leftmost point; if unsure, calling function -// should sort endpoints or call drawLine() instead +/**************************************************************************/ +/*! + @brief Draw a perfectly horizontal line (this is often optimized in a subclass!) + @param x Left-most x coordinate + @param y Left-most y coordinate + @param w Width in pixels + @param color 16-bit 5-6-5 Color to fill with +*/ +/**************************************************************************/ void Adafruit_GFX::drawFastHLine(int16_t x, int16_t y, int16_t w, uint16_t color) { - // Update in subclasses if desired! startWrite(); writeLine(x, y, x+w-1, y, color); endWrite(); } +/**************************************************************************/ +/*! + @brief Fill a rectangle completely with one color. Update in subclasses if desired! + @param x Top left corner x coordinate + @param y Top left corner y coordinate + @param w Width in pixels + @param h Height in pixels + @param color 16-bit 5-6-5 Color to fill with +*/ +/**************************************************************************/ void Adafruit_GFX::fillRect(int16_t x, int16_t y, int16_t w, int16_t h, uint16_t color) { - // Update in subclasses if desired! startWrite(); for (int16_t i=x; i