Skip to content
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

BITMAPFILEHEADER.bfOffBits is ignored #285

Open
hughbe opened this issue Apr 5, 2018 · 3 comments
Open

BITMAPFILEHEADER.bfOffBits is ignored #285

hughbe opened this issue Apr 5, 2018 · 3 comments

Comments

@hughbe
Copy link
Contributor

hughbe commented Apr 5, 2018

Cause of issue in #276 (review)

@filipnavara
Copy link
Contributor

Makes me wonder what you can do with hacks where the bits would intentionally overlap with the bitmap header... or if you can embed custom metadata between the official headers and the bitmap data.

@filipnavara
Copy link
Contributor

Also, biClrUsed is ignored as well.

@hughbe
Copy link
Contributor Author

hughbe commented Jan 14, 2021

Makes me wonder what you can do with hacks where the bits would intentionally overlap with the bitmap header... or if you can embed custom metadata between the official headers and the bitmap data.

If the bits intentionally overlap with the bitmap header, the offset is ignored (in GDI+)

or if you can embed custom metadata between the official headers and the bitmap data.

Yes you can!

E.g.

BYTE validOffset2OS2Indexed[] = {
    // -- BITMAPFILEHEADER -- //
    /* Signature */ 0x42, 0x4D,
    /* File Size */ 0x24, 0x00, 0x00, 0x00,
    /* Reserved */	0x00, 0x00, 0x00, 0x00,
    /* Offset */    0x2E, 0x00, 0x00, 0x00,

    // -- BITMAPCOREHEADER -- //
    /* Size */      0x0C, 0x00, 0x00, 0x00,
    /* Width */     0x01, 0x00,
    /* Height */    0x01, 0x00,
    /* Planes */    0x01, 0x00,
    /* Bit Count */ 0x01, 0x00,

    // -- Color Palette -- //
    0xFF, 0x00, 0x00, 0x00, 0xFF, 0x0,

    // -- Padding -- //
    'H', 'i', 'd', 'd', 'e', 'n', ' ', 'M', 'e', 's', 's', 'a', 'g', 'e',

    // -- Image Data -- //
    0x80, 0x00, 0x00, 0x00
};

createFileSuccessDispose (validOffset2OS2Indexed, PixelFormat1bppIndexed, 1, 1, bmpFlags, FALSE);
ARGB expectedPixels[] = {0xFF00FF00};
verifyPixels (image, expectedPixels);
ARGB expectedPalette[] = {0xFF0000FF, 0xFF00FF00};
verifyPalette (image, 0, expectedPalette);
GdipDisposeImage (image);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants