acidportal

- 😈 Worlds smallest Evil Portal on a LilyGo T-QT
git clone git://git.acid.vegas/acidportal.git
Log | Files | Refs | Archive | README | LICENSE

Viewport_commands.ino (2440B)

      1 /*  
      2 
      3   // Create a viewport at TFT screen coordinated X,Y of width W and height H
      4   tft.setViewport(X, Y, W, H); // By default the 0,0 coordinate datum is moved to top left
      5                                // corner of viewport
      6                                // Note: tft.width() and tft.height() now return viewport size!
      7   // The above command is identical to:
      8   tft.setViewport(VP_X, VP_Y, VP_W, VP_H, true); // true parameter is optional
      9 
     10   // To create a viewport that keeps the coordinate datum at top left of TFT, use false parameter
     11   tft.setViewport(VP_X, VP_Y, VP_W, VP_H, false); // Note: tft.width() and tft.height() return TFT size!
     12 
     13   // To get viewport x, y coordinates, width, height and datum position flag
     14   int32_t x = tft.getViewportX();      // Always returns viewport x coordinate relative to screen left edge
     15   int32_t y = tft.getViewportY(void);  // Always returns viewport y coordinate relative to screen top edge
     16   int32_t w = tft.getViewportWidth();  // Always returns width of viewport
     17   int32_t h = tft.getViewportHeight(); // Always returns height of viewport
     18   bool    f = tft.getViewportDatum();  // Datum of the viewport (false = TFT corner, true = viewport corner)
     19   // To check if all or part of an area is in the viewport
     20   checkViewport(x, y, w, h); // Returns "true" if all or part of area is in viewport
     21 
     22   // To draw a rectangular frame outside viewport of width W (when W is negative)
     23   tft.frameViewport(TFT_RED, -W); // Note setting the width to a large negative value will clear the screen
     24                                   // outside the viewport
     25 
     26   // To draw a rectangular frame inside viewport of width W (when W is positive)
     27   tft.frameViewport(TFT_RED,  W); // Note setting the width to a large positive value will clear the screen
     28                                   // inside the viewport
     29 
     30   // To reset the viewport to the normal TFT full screen
     31   tft.resetViewport();  // Note: Graphics will NOT be drawn to the TFT outside a viewport until
     32                         // this command is used! ( The exception is using the frameViewport command
     33                         // detailed above with a negative width.)
     34 
     35   // Note:
     36   // Using setRotation rotates the whole TFT screen it does not just
     37   // rotate the viewport (this is a possible future enhancement).
     38   // Redraw all graphics after a rotation since some TFT's do not
     39   // re-map the TFT graphics RAM to the screen pixels as expected.
     40 */