Drawing 8bit bitmap using GUI_DrawBitmap() seems NG

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Drawing 8bit bitmap using GUI_DrawBitmap() seems NG


      These days I try to draw custom 8-bit bitmap with alpha using GUI_DrawBitmap(), but it seems NG.

      The image (with alpha) is some like:


      To save ROM space, i index the pixel data to 8-bit c file from the one converted by BmpCvt.exe, with the settings:

      C Source Code

      1. static GUI_CONST_STORAGE GUI_LOGPALETTE _Paloverlay_image_status_26x26x8 = {
      2. 232, // Number of entries
      3. 1, // Has transparency
      4. &_Colorsoverlay_image_status_26x26x8[0]
      5. };
      6. GUI_CONST_STORAGE GUI_BITMAP bmoverlay_image_status_26x26x8 = {
      7. 26, // xSize
      8. 26, // ySize
      9. 26, // BytesPerLine
      10. 8, // BitsPerPixel
      11. _acoverlay_image_status_26x26x8, // Pointer to picture data
      12. &_Paloverlay_image_status_26x26x8, // Pointer to palette
      13. };
      Display All
      Also, I attached the file as "overlay_image_status_26x26x8.zip".

      Then I draw it using the code:

      Source Code

      1. GUI_SetClipRect(&DrawRect);
      2. GUI_DrawBitmap(pBitmap, LeftRect.x0, LeftRect.y0);
      3. GUI_SetClipRect(NULL);

      The screenshot:


      It seems just a bit "dirty".

      So, what's wrong?
      Am I doing something wrong?
      My emWin version is v5.48j.

    • Hi,

      I guess the original image contains semi transparency at the edges of the drawing. Please, note that the 8bit bitmaps do not support semi transparency. Either transparent or opaque. You should remove any semi transparency before converting the images (e.g. with GIMP).