Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #8026

    CaptainFlint
    Participant

    In developing a plugin I met a problem with the toolbar icon. I followed the instructions in the help file and for 256-color icons I decided to make RGB(1, 1, 1) a transparent color. So, I designed an icon with 4 pixels in corners with this color (to make it look a bit rounded), and in the code I wrote:

    case EP_GET_MASK:
    if ((wParam & BITMAP_COLOR_MASK) == BITMAP_24BIT_COLOR)
    lResult = CLR_NONE;
    else if ((wParam & BITMAP_COLOR_MASK) == BITMAP_256_COLOR)
    lResult = RGB(1, 1, 1);
    break;

    However, when I try the plugin in 256-color mode, its toolbar icon becomes garbled. Here is the screenshot of how the icon looks as itself and when shown by EmEditor:

    EE 9.07; OS Vista Business SP2 x32 working in true-color mode.


    I performed some more experiments and found the following:
    1. If I return CLR_NONE instead of RGB(…), the color with index 0 from the image’s index table is used for transparency.
    2. The problem seems to lie in fact that my transparent color has index 0. When I move it further in the index table, the problem seems to be gone.

    The questions are: what are the “official” recommendations on creating transparent images, and why is all this not described in the help?

    #8033

    Yutaka Emura
    Keymaster

    I think the issue is the color palette with 256-color mode. Even if your plug-in bitmap looks fine by itself, it becomes ugly with other plug-ins because the color palette must be adjusted with other bitmaps. For this reason, I would recommend you not adding 256-color bitmaps. Just use true-color bitmaps and 16-color bitmaps, and omit 256-color bitmaps. In most of my standard plug-ins, I don’t supply 256-color bitmaps any more for this reason. Most PCs now display true color, and 256-color mode is becoming obsolete. The 256-color mode feature might be taken out in the future.

    #8040

    CaptainFlint
    Participant

    I see, I’ll keep that in mind.

    But even if the problem is in adjusting color palette, why simple repositioning of the transparent color fixes the problem completely? I don’t change the color itself, I don’t change colors of other pixels, I just move one color in the index table, and that’s all.

    PS: Since I found how to eliminate the problem on the plugin’s side, it no longer bothers me as itself, but I’m concerned about possible bug in EmEditor which caused such strange behaviour.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.