Commit Graph
70 Commits
Author SHA1 Message Date
Mikey SklarandClaude Opus 5.5 019a40791e Give Adafruit_GFX a virtual destructor except on AVR
Deleting a canvas or display through an Adafruit_GFX pointer called
only the base destructor, so the canvas buffer leaked (#369). AVR is
left out because a virtual destructor links malloc and free into
display sketches that never use the heap (+602 bytes on an Uno).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-21 13:09:49 -07:00
Mikey Sklar a06b05f394 Merge pull request #507 from dforsi/patch-1
Update Adafruit_GFX.h
2026-10-15 18:07:36 -07:00
BillMerryman c5f9fb14f1 Add drawRotatedRect and fillRotatedRect methods (#508)
* Add drawRotatedRect and fillRotatedRect methods

* Corrected docs
2026-04-01 10:21:37 -04:00
dforsi 2d6d9c3fa2 Update Adafruit_GFX.h
Fix comments of struct items

Background and text were inverted.
2026-03-24 21:56:03 +01:00
DS-Aditya-928 32da3d2094 Added drawEllipse and fillEllipse functions (#477)
* Added drawEllipse and fillEllipse functions

* Formatting fixes
2025-09-14 08:28:20 -04:00
Jeff Epler f80daa51c9 GFXcanvas: Allow subclass to take charge of buffer allocations (#465)
* GFXcanvas: Allow subclass to take charge of buffer allocations

In Adafruit_dvhstx, the low level driver takes charge of the framebuffer
allocations. Consequently, any allocation by the GFXcanvas class would be
an unused waste of memory.

Introduce a new constructor parameter `bool allocate_buffer=true`. The
default preserves the old behavior of allocating the buffer in the
constructor and freeing it in the destructor, while passing in `false`
skips buffer allocation & freeing.

In this case, the subclass must allocate the buffer before the first
drawing operation (such as in its constructor or begin method), and
free it in its own destructor or end method.

The subclass can also freely change the buffer pointer at runtime, for
instance in a swap method if the underlying framebuffer is double-buffered.

* experimentally run a different clang-format

This runs version 19.1.7: uvx clang-format -i *.cpp *.h

the changes look similar to what was shown during CI

* undo one edit that ci doesn't like
2025-02-19 10:15:01 -05:00
Phillip Burgess e122c3d20f Doxy class members moved from private to protected 2023-01-16 15:18:35 -08:00
Phillip Burgess 740677a733 Make canvas buffers protected instead of private members
A use case came up where it was helpful to be able to alter the buffer pointer in a subclass. This is esoteric and should be used with care.
2023-01-16 15:02:36 -08:00
alba-ado ad4b6b4206 Fixing PlatformIO dependency problem (#389)
Fixing the PlatformIO dependency problem mentioned in; https://community.platformio.org/t/adafruit-gfx-lib-will-not-build-any-more-pio-5/15776/12
2022-06-07 11:38:02 -04:00
Melissa LeBlanc-Williams 605ea88e40 Revert "Speed up internal font drawing for opaque background color" 2022-03-16 11:51:38 -07:00
Laurence Bank 77d05f5ab5 Attempt to fix doxygen errors 2022-03-09 11:52:32 +00:00
Laurence Bank c035859fcc ran clang-format 2022-03-09 11:19:00 +00:00
Laurence Bank 8bab5dba75 revered AVR exclusions 2022-03-08 17:18:26 +00:00
Laurence Bank 99c324d33e second attempt to stop AVR build from messing things up for everyone else 2022-03-08 15:55:52 +00:00
Laurence Bank 9ac47e8616 Sped up internal font drawing for opaque background color 2022-03-08 14:38:41 +00:00
Michael Kamprath 18eec8bb9e fixed fast line drawing in GFXcanvas* classes 2020-08-18 22:25:19 -07:00
Melissa LeBlanc-Williams e4fcdba2b2 Merge pull request #237 from michaelkamprath/master
Added support in GFXcanvas* classes to access pixel values
2020-06-16 16:02:58 -07:00
nuxeh e806c84d3f Change boolean to bool (#303)
* Change boolean to bool

This avoids compiler warnings such as:

    In file included from /home/ed/git/dryer-arduino/ui/src/graphicstest.ino:18:
    .pio/libdeps/nucleo_f446re/Adafruit GFX Library_ID13/Adafruit_GFX.h:48:39: warning: 'boolean' is deprecated [-Wdeprecated-declarations]
       48 |   virtual void invertDisplay(boolean i);
          |                                       ^
    In file included from /home/ed/.platformio/packages/framework-arduinoststm32/cores/arduino/wiring.h:34,
                     from /home/ed/.platformio/packages/framework-arduinoststm32/cores/arduino/Arduino.h:32,
                     from /tmp/tmpvslwxjr7:1:
    /home/ed/.platformio/packages/framework-arduinoststm32/cores/arduino/wiring_constants.h:110:14: note: declared here

* Fix clang format issues unrelated to this PR

Addresses the following from CI:

    $ python3 ci/run-clang-format.py -e "ci/*" -e "bin/*" -r .
    --- ./Adafruit_GFX.h	(original)
    +++ ./Adafruit_GFX.h	(reformatted)
    @@ -240,8 +240,8 @@
       uint8_t textsize_x;   ///< Desired magnification in X-axis of text to print()
       uint8_t textsize_y;   ///< Desired magnification in Y-axis of text to print()
       uint8_t rotation;     ///< Display rotation (0 thru 3)
    -  bool wrap;         ///< If set, 'wrap' text at right edge of display
    -  bool _cp437;       ///< If set, use correct CP437 charset (default is off)
    +  bool wrap;            ///< If set, 'wrap' text at right edge of display
    +  bool _cp437;          ///< If set, use correct CP437 charset (default is off)
       GFXfont *gfxFont;     ///< Pointer to special font
     };

    --- ./Adafruit_GFX.cpp	(original)
    +++ ./Adafruit_GFX.cpp	(reformatted)
    @@ -1713,9 +1713,7 @@
        @returns  True if was pressed before, now is not.
     */
     /**************************************************************************/
    -bool Adafruit_GFX_Button::justReleased() {
    -  return (!currstate && laststate);
    -}
    +bool Adafruit_GFX_Button::justReleased() { return (!currstate && laststate); }

     // -------------------------------------------------------------------------
2020-06-15 11:20:29 -04:00
Michael Kamprath 6791eaca01 Re-running clang-format after the rebase 2020-06-05 11:00:20 -07:00
Michael Kamprath c53e9d24aa added support in GFXcanvas* classes to access pixel values
Alsp added and example for GFXcanvas that demonstrates the impact of rotation
on pixel layout and also demonstrates getting a pixel based on raw
physical coordinates.
2020-06-05 10:52:32 -07:00
lady ada d2b4b25559 manual implementation of https://github.com/adafruit/Adafruit-GFX-Library/pull/282 2020-05-17 12:35:25 -04:00
Billy Donahue 5fef578a6c Break up the compound decls in the BASIC DRAW API section (#287)
* One member per declaration.

* break up a few that were sharing the same line
2020-05-13 19:02:32 -04:00
Paint Your Dragon d38ee86716 Merge pull request #262 from mzero/overloaded-write
allow Print's overloaded write() calls to be used with Adafruit_GFX
2020-01-12 21:12:25 -08:00
Limor "Ladyada" Fried 6abf693056 Actionsci2 (#264)
add library dependancy
remove travis CI
update badge
enable Actions
2019-12-27 17:10:08 -05:00
Mark Lentczner 36ea56905e allow Print's overloaded write() calls to be used with Adafruit_GFX
Adafruit_GFX overrides one of the Print::write() functions.
The rules of overload resolution say that all the overloaded options
need to be visible in the class where the first option is found.
Since Adafruit_GFX only overrides write(uint8_t), the other version,
write(const uint8_t *buffer, size_t size) cannot be called on a
Adafruit_GFX display from sketches.

This change adds the "using" directive, which tells C++ to consider
all of Print's write members to be in scope of Adafruit_GFX, even
though only one is overridden.
2019-12-24 00:12:04 -08:00
ladyada b7e16558de Merge branch 'master' of github.com:adafruit/Adafruit-GFX-Library 2019-06-16 20:29:48 -04:00
ladyada cfd0d4e226 allow changing of WIDTH/HEIGHT (for screens smaller than the chip's max size) 2019-06-16 20:29:44 -04:00
Melissa LeBlanc-Williams 60e0e6335f Revert "Revert "Text magnification factor can be defined separately for X and for Y axis"" 2019-06-12 13:53:17 -07:00
Melissa LeBlanc-Williams 988f73af04 Revert "Text magnification factor can be defined separately for X and for Y axis" 2019-06-12 13:47:08 -07:00
jonnieZG 022e8920cc Text magnification factor can be defined separately for X and for Y axis level. It allows you to print "tall" or "wide" text. 2019-06-12 20:31:45 +02:00
Phillip Burgess 7214a0452d Appease the Travis 2019-05-29 20:42:31 -07:00
Phillip Burgess b0dc94def7 Inline some of the trivial functions, add byteSwap() for GFXcanvas16 2019-05-29 20:33:31 -07:00
Emil Muratov 05df41d963 Added String overload to getTextBounds() #90 2018-08-06 17:25:57 +03:00
ladyada 5614790a99 *falls over* 2018-07-14 15:21:57 -04:00
ladyada ed59d3ea4a more doxy 2018-07-14 13:05:06 -04:00
Phillip Burgess 07f8f65e40 Back off on the PROGMEM declarations; const is sufficient. 2017-05-09 15:35:44 -07:00
Phillip Burgess 7589ecaf0f Extra-persnickety declarations in PROGMEM bitmap functions 2017-05-06 12:06:51 -07:00
Phillip Burgess d0e78f9db1 Fixed text wrap & bounds issues, changed drawRGBBitmap PROGMEM behavior + added masking 2017-05-05 19:57:52 -07:00
Phillip Burgess 868d3ed67e Add 8-bit canvas type, because reasons. Also some 1- and 16-bit canvas cleanup. 2017-05-04 22:06:09 -07:00
Paint Your Dragon 4b1a8a6850 Merge pull request #39 from marcmerlin/drawrgb
Added support for multicolor pixmaps in drawRGBBitmap.
2017-05-04 21:34:13 -07:00
Marc MERLIN aad430de1b Allow for drawing bitmaps in RAM (not in progmem). 2017-04-06 12:08:10 -07:00
ladyada 44568a85f2 Merge branch 'master' of github.com:adafruit/Adafruit-GFX-Library
Conflicts:
	Adafruit_GFX.cpp
2017-03-17 20:44:20 -04:00
Phillip Burgess b8f2200766 Handle larger button dimensions, add initButtonUL() for buttons w/upper-left coord 2017-03-07 10:24:06 -08:00
me-no-dev 4290f0b161 Implement transaction based drawing
With using transactions to draw, we save huge amount of time in pin
changing and SPI setup. This new model, together with the updated
ILI9341 lib give a much better performance.
2017-02-23 03:11:09 +02:00
Phillip Burgess f5ec45e42b adagfxswap() renamed and localized to .cpp file to avoid collisions 2016-01-26 10:37:56 -08:00
Phillip Burgess 9cb1ec4401 Bitmap fixes, initial canvas support 2015-12-28 10:58:40 -08:00
Phillip Burgess fb9e169398 Manual merge of TheNotary's RAM-based bitmap functions. 2015-12-27 21:29:50 -08:00
Phillip Burgess 80b1bc48cb Fonts FONTS fonts! 1.1 release 2015-12-22 12:02:47 -08:00
ladyada 944f3d9d9f ok its a hack to make esp8266 happier but it works! swap() already exists in the tensilica codebase 2015-11-24 00:06:48 -05:00
Phillip Burgess ea4c4c5596 cp437() workaround for Code Page 437 missing symbol bug
‘Wrong’ behavior is default, so old code will continue to work. New
code can call cp437() after initializing the display to use correct
symbol numbers for upper ASCII characters.
2015-06-17 00:37:36 -07:00