Skip to content

create swpixel implementation #1

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

Merged
merged 1 commit into from
Dec 31, 2019
Merged
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
17 changes: 17 additions & 0 deletions src/HyperDisplay_ILI9163C.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,23 @@ void ILI9163C::hwpixel(hd_hw_extent_t x0, hd_hw_extent_t y0, color_t data, hd_c
writeToRAM( (uint8_t*)value, len );
}

void ILI9163C::swpixel( hd_extent_t x0, hd_extent_t y0, color_t data, hd_colors_t colorCycleLength, hd_colors_t startColorOffset)
{
if(data == NULL){ return; }
if(colorCycleLength == 0){ return; }

startColorOffset = getNewColorOffset(colorCycleLength, startColorOffset, 0); // This line is needed to condition the user's input start color offset because it could be greater than the cycle length
color_t value = getOffsetColor(data, startColorOffset);

hd_hw_extent_t x0w = (hd_hw_extent_t)x0; // Cast to hw extent type to be sure of integer values
hd_hw_extent_t y0w = (hd_hw_extent_t)y0;

hd_pixels_t pixOffst = wToPix(pCurrentWindow, x0, y0); // It was already ensured that this will be in range
color_t dest = getOffsetColor(pCurrentWindow->data, pixOffst); // Rely on the user's definition of a pixel's width in memory
uint32_t len = (uint32_t)getOffsetColor(0x00, 1); // Getting the offset from zero for one pixel tells us how many bytes to copy

memcpy((void*)dest, (void*)value, (size_t)len); // Copy data into the window's buffer
}


// Basic Control Functions
Expand Down
1 change: 1 addition & 0 deletions src/HyperDisplay_ILI9163C.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ class ILI9163C : virtual public hyperdisplay{
// virtual void hwrectangle(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, bool filled = false, color_t data = NULL, uint16_t colorCycleLength = 1, uint16_t startColorOffset = 0, bool reverseGradient = false, bool gradientVertical = false);
// virtual void hwfillFromArray(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, uint32_t numPixels, color_t data);

void swpixel( hd_extent_t x0, hd_extent_t y0, color_t data = NULL, hd_colors_t colorCycleLength = 1, hd_colors_t startColorOffset = 0);

public:

Expand Down