Skip to content

Added for Function to use the library with the Neomatrix Library (especially for SD Card Images) #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Adafruit_ImageReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,27 @@ void Adafruit_Image::draw(Adafruit_SPITFT &tft, int16_t x, int16_t y) {
}
}

/*!
@brief Draw image to an Adafruit_Neomatrix display.
@param matrix
Screen to draw to (any Adafruit_NeoMatrix-derived class).
@param x
Horizontal offset in pixels; left edge = 0, positive = right.
Value is signed, image will be clipped if all or part is off
the screen edges. Screen rotation setting is observed.
@param y
Vertical offset in pixels; top edge = 0, positive = down.
@return None (void).
*/
void Adafruit_Image::draw(Adafruit_NeoMatrix &matrix, int16_t x, int16_t y) {
if(format == IMAGE_1 ) {
} else if(format == IMAGE_8 ) {
} else if(format == IMAGE_16) {
matrix.drawRGBBitmap(x, y, canvas.canvas16->getBuffer(),
canvas.canvas16->width(), canvas.canvas16->height());
}
}

// ADAFRUIT_IMAGEREADER CLASS **********************************************
// Loads images from SD card to screen or RAM.

Expand Down
3 changes: 3 additions & 0 deletions Adafruit_ImageReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#include <SD.h>
#include "Adafruit_SPITFT.h"
#include "Adafruit_NeoMatrix.h"

/** Status codes returned by drawBMP() and loadBMP() */
enum ImageReturnCode {
Expand Down Expand Up @@ -43,6 +44,8 @@ class Adafruit_Image {
int16_t width(void); // Return image width in pixels
int16_t height(void); // Return image height in pixels
void draw(Adafruit_SPITFT &tft, int16_t x, int16_t y);
void draw(Adafruit_NeoMatrix &matrix, int16_t x, int16_t y);

protected:
// MOST OF THESE ARE NOT SUPPORTED YET -- WIP
union { // Single pointer, only one variant is used:
Expand Down
Loading