-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Added support in GFXcanvas* classes to access pixel values #237
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to be good
Moved getting of raw pixel color values from something this library handles to something the underlying AdaFruit GFX library handles. Depends on this pull request in the AdaFruit GFX repository: adafruit/Adafruit-GFX-Library#237
Moved getting of raw pixel color values from something this library handles to something the underlying AdaFruit GFX library handles. Depends on this pull request in the AdaFruit GFX repository: adafruit/Adafruit-GFX-Library#237
Just curious, is there anything more I'd need to do to move this pull request forward to a |
hiya we've got ~1200 repos so not all PRs get added especially if they are features rather than bugfixes. we'll keep open and take a look in the next few weeks :) |
@ladyada sounds good. I just wanted to understand what happens next since this is the first time I've attempted a contribution to AdaFruit repo. |
@ladyada have you had a chance to review this PR yet? |
@michaelkamprath I've taken a look and it looks good but some example code that uses these new features would help us test before merging. |
@siddacious sample code can be found in my graphics library here. An example line where the new functionality I added can be seen here, which demonstrates the use case for getting the "raw pixel" unrotated so that the image data can be sent to the hardware. Is this what you are looking for? |
@siddacious & @ladyada Just checking in whether the sample code provided above was what you needed. Please keep in mind that this change in now way should break any existing code. It keeps the same interface and functionality. All it does is expose the pixel data in each object so that the raw pixel data can be fetched by coordinates with out it going through the rotation mapping. With this change, pixel data can be completely encapsulated (thought he data buffer pointer is still available). I submit this is a safer thing for clients to do than grabbing the data buffer pointer and trying to decode the pixel data directly. The benefits of this is that it removes the needs for a client to use the data buffer pointer directly if all they want is to get the pixel value at a specific, unrotated location. This sort of value fetching is frequently needed when trying to build the data stream to be sent to hardware. The sample code I point to shows this new feature being leveraged to build the bit-stream to be uploaded to the hardware controller for a LED device I designed. Right now my hardware driver library does grab the data buffer pointer from the |
Apologies @michaelkamprath for some reason I didn't see your previous mention. Adding an example to your PR is what I had in mind, both for testing and for helping other users understand and make use of the feature you're adding. Thanks for your patience. |
@siddacious Got it. Thanks. By "example", I am assuming you mean a |
@siddacious I've added the demo as requested, but the check keeps failing on this |
@siddacious @ladyada From the best I can determine, the Also, is the example code I added what you are looking for to make this pull request complete? |
yes please run clang-format (from clang8 + ) on your files :) |
@ladyada @siddacious OK, I ran Also, is the example that I added what you are looking for as an example for the change I made? |
@michaelkamprath if you look here, you can see that clang-format still thinks it needs to make a change: Not sure why your run didn't catch that, but if you mimic the change it's making it should pass. I'll take a look at the example now. |
@siddacious Thanks. I missed it because I wasn't expecting OK, now it's passing all the tests. I will risk my question: is the example that I added what you are looking for as an example for the change I made? |
@michaelkamprath awesome, thanks for the fix. Still reviewing and testing but so far yes, this looks like a really nice example :) |
@siddacious Something odd is going on here. If you look at this line in the diff, that does not exist in my code on my machine. That line should not be missing. Something like this happened earlier in this PR too. I am not sure what is happening, but I will try to fix it. |
@siddacious @ladyada OK, this PR is once again ready to be reviewed. I fixed the bug mentioned above. It got introduced during my formatting debacle. |
thanks - we'll take a look at testing it! no ETA as we have 1300 repos :) |
@makermelissa @ladyada Just checking in to see what the status is here on determining whether this pull request is a go or no-go. Thanks! |
Sorry @michaelkamprath, I haven't had a chance to test yet. In general, PRs to GFX tend to be slower because they need additional testing since there are so many libraries that depend on this one. |
@makermelissa @ladyada Just checking in to see what the status is here on determining whether this pull request is a go or no-go. Thanks! |
@makermelissa @ladyada Just checking in to see what the status is here on determining whether this pull request is a go or no-go. I see you did integrate a number of pull requests recently. I would love to learn the disposition of this one. Thanks! |
hi, we have hundreds of repos and PRs that are currently pending so we cannot promise an ETA on this PR. we will do a sweep of this library to check on all PRs and issues. as tens thousands of people use this library, we have to be very cautious :) |
@ladyada Understood. Since it's been 10 months since I originally opened this, I just want to ensure this doesn't fall through the cracks, so please forgive the occasional bumps. Given that you have been incorporating PRs into this project, it looks like Ihave to once again rebase from master to make this PR mergeable. I'll get that done today. |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on an SSD1351. I tried out graphicstest to make sure nothing broke and that appeared to be fine and then ran the included demo and that worked fine, so I'm good with approving this. Thanks.
Thanks! |
Moved getting of raw pixel color values from something this library handles to something the underlying AdaFruit GFX library handles. Depends on this pull request in the AdaFruit GFX repository: adafruit/Adafruit-GFX-Library#237
* transitioned pixel management to GFX lib Moved getting of raw pixel color values from something this library handles to something the underlying AdaFruit GFX library handles. Depends on this pull request in the AdaFruit GFX repository: adafruit/Adafruit-GFX-Library#237 * transitioned pixel management to GFX lib Moved getting of raw pixel color values from something this library handles to something the underlying AdaFruit GFX library handles. Depends on this pull request in the AdaFruit GFX repository: adafruit/Adafruit-GFX-Library#237 * improved monochrome exmaple * fixed CHANGELOG
When using the
GFXcanvas*
classes as the image buffer for a hardware driver, there is a need to get individual pixel color values at given coordinates. Rather than sub- or client classes callgetBuffer()
and reinterpret the byte layout of the buffer, two methods are added to each of theGFXcanvas*
classes that allow fetching of specific pixel values.getPixel(x, y)
gets the pixel color value at the rotated coordinates in the image.getRawPixel(x,y)
gets the pixel color value at the unrotated coordinates in the image. This is useful for getting the pixel value to map to a hardware pixel location. This method was madeprotected
as only the hardware driver should be accessing it.Also corrected some documentation on the
GFXcanvas*
classes so that they correctly describe how color values are being used in each of the 1-, 8-, and 16-bit modes.