All graphics methods now use 32-bit ARGB or RGB565 format instead of BGR #2811
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Description
The code has been modified to only use ARGB or RGR565 format.
Code was also modified to the RotateImage to properly rotate images with a transparent background.
This was not in place, although it was already in place for stretch image.
Fixed a bug.
In testing on the STM32F769I_Discovery I ran into an exception.
Native code working on an ESP32WroverKitV4.1 would create an exception in the Bitmap_Decoder.cpp.
I eventually tracked this down to a
ARM: STM32F7: hard fault caused by unaligned Memory Access
Included in this code is the fix for this problem as recommended by keil.
Motivation and Context
Problems with colours. This eliminates some confusion with the formats in memory.
How Has This Been Tested?
The modifed code was tested on
All three tests showed the same resulting colours.
See the following testing notes below
Testing notes
A selection of 9 ARGB colours was selected to test operation
16-bit RGB565 values expected to be in the native bitmap for presentation to the display controller to properly send to the display device. Examination of the memory buffer of the Bitmap showed that it was correctly in the RGB565 format stored as little endian.
RGB565 format is commonly called "native" format in the C++/C code
JPEG test was created using Paint.net to set the 9 pixels to the ARGB colours then saved to disk and re-read. The values re-read from the disk are "compressed" so are slightly different. The expected values were found using the eye-dropper tool of paint.net to get the hex colour values.
Bitmaps saved in the resource file are all converted to RGB565 format before being embedded into the assembly and deployed to flash. ( This is by design)
The graphics code supports reading in bitmaps of 32-bit, 24-bit and 8-bit indexed, usually from file. For this test the bitmaps are setup as a C# byte array to eliminate the need to have a file system.
Restoring RGB565 to ARGB
Restored results are inexact values due to the loss of 3 bits red, 2 bits green and 3 bits blue. The restoration code uses an algorithm originally from .netMF to approximate the original ARGB colour.
Gif values should be the same as SetPixel, GetPixel, unlike jpeg GIF uses lossless compression.
Screenshots
Types of changes
Checklist