Jump to content

Mercury13

Members
  • Posts

    14
  • Joined

  • Last visited

Posts posted by Mercury13

  1. Windows is the ultimate argument when we are writing for Windows, right? Two standard features of Windows, PrintScreen and Clipboard Viewer, DO ADD or DO REQUIRE these 12 bytes.

    I found another argument. Maybe I’ll try, but not today, I’m a bit sick and keeping energy for my main job.

    Windows automatically synthesizes other formats, so I’ll try to copy as DIBv5 and paste as DIB. If this DIBv5 gives incorrect DIB, or Windows refuses to convert at all — what’s else?

  2. Here’s more of Skia logic. I don’t see Skia’s WRITING code for now, but this is Skia’s READING code.

     

      switch (bitmap->bmiHeader.biBitCount) {
        case 1:
        case 4:
        case 8:
          color_table_length = bitmap->bmiHeader.biClrUsed
                                   ? bitmap->bmiHeader.biClrUsed
                                   : 1 << bitmap->bmiHeader.biBitCount;
          break;
        case 16:
        case 32:
          if (bitmap->bmiHeader.biCompression == BI_BITFIELDS)
            color_table_length = 3;
          break;
        case 24:
          break;
        default:
          NOTREACHED();
      }

     

  3. Windows’ screenshot function DOES INSERT these 12 bytes.

    I’ll copy a bit of pure white using W10’s Win+Sh+S…

    If Windows does, why shouldn’t you?

     

    Total data length = 0x130

    Size = 0x7C

    Width = 6

    Height = 7

    Planes = 1

    Bitcount = 32

    Compression = BITFIELDS

    SizeImage = 0xA8

    XPelsPerMeter = 0

    YPelsPerMeter = 0

    ClrUsed = 0

    ClrImportant = 0

    RedMask = 0xFF0000

    GreenMask = 0xFF00

    BlueMask = 0xFF

    AlphaMask = 0

    CsType = 'sRGB' (bytes reversed, write as C multi-char constant)

    Endpoints = all zeros

    Gamma = all zeros

    Intent = IMAGES

    ProfileData = 0

    ProfileSize = 0

    Reserved = 0

    [dword 0x7C] = 0xFF0000

    [dword 0x80] = 0xFF00

    [dword 0x84] = 0xFF

    And then 0xA8 FF’s

    0x7C + 0xA8 + 0x0C = 130

  4. So, the problem is those twelve bytes at offset 7C…87 of DIBv5. Should we insert them?

    Who inserts…

    • Windows’ “Print Screen” function
    • Skia, by code
      if (bitmap->bmiHeader.biCompression == BI_BITFIELDS)
         color_table_length = 3;
    •  

    Documentation states:

    BI_BITFIELDS: The bitmap is not compressed, and the color table consists of three DWORD (defined in [MS-DTYP] section 2.2.9) color masks that specify the red, green, and blue components, respectively, of each pixel. This is valid when used with 16 and 32-bits per pixel bitmaps.

     

    Maybe you forgot those bytes rather than they inserted erroneously?

×
×
  • Create New...