Example #1
0
//---------------------------------------------------------------------------
void File_Bmp::BitmapInfoHeader()
{
    //Parsing
    Element_Begin("Bitmap Info header", 40);
    int32u Width, Height, CompressionMethod;
    int16u BitsPerPixel;
    Skip_L4(                                                    "Size");
    Get_L4 (Width,                                              "Width");
    Get_L4 (Height,                                             "Height");
    Skip_L2(                                                    "Color planes");
    Get_L2 (BitsPerPixel,                                       "Bits per pixel");
    Get_L4 (CompressionMethod,                                  "Compression method"); Param_Info(Bmp_CompressionMethod(CompressionMethod));
    Skip_L4(                                                    "Image size");
    Skip_L4(                                                    "Horizontal resolution");
    Skip_L4(                                                    "Vertical resolution");
    Skip_L4(                                                    "Number of colors in the color palette");
    Skip_L4(                                                    "Number of important colors used");
    Element_End();

    FILLING_BEGIN();
        Fill(Stream_Image, 0, Image_Width, Width);
        Fill(Stream_Image, 0, Image_Height, Height);
        Fill(Stream_Image, 0, Image_BitDepth, BitsPerPixel);
        Fill(Stream_Image, 0, Image_Format, Bmp_CompressionMethod(CompressionMethod));
        Fill(Stream_Image, 0, Image_Codec, Bmp_CompressionMethod(CompressionMethod));
    FILLING_END();
}
Example #2
0
void File_Bmp::BitmapInfoHeader(int8u Version)
{
    #if MEDIAINFO_TRACE
        switch (Version)
        {
            case 1 : Element_Info1("BITMAPINFOHEADER"); break;
            case 2 : Element_Info1("BITMAPV2INFOHEADER"); break;
            case 3 : Element_Info1("BITMAPV3INFOHEADER"); break;
            case 4 : Element_Info1("BITMAPV4HEADER"); break;
            case 5 : Element_Info1("BITMAPV5HEADER"); break;
            default: Element_Info1("BITMAPV?HEADER");
        }
    #endif //MEDIAINFO_TRACE

    //Parsing
    int32u Width, Height, CompressionMethod;
    int16u BitsPerPixel;
    Skip_L4(                                                    "Size");
    Get_L4 (Width,                                              "Width");
    Get_L4 (Height,                                             "Height");
    Skip_L2(                                                    "Color planes");
    Get_L2 (BitsPerPixel,                                       "Bits per pixel");
    Get_L4 (CompressionMethod,                                  "Compression method"); Param_Info1(Bmp_CompressionMethod(CompressionMethod));
    Skip_L4(                                                    "Image size");
    Skip_L4(                                                    "Horizontal resolution");
    Skip_L4(                                                    "Vertical resolution");
    Skip_L4(                                                    "Number of colors in the color palette");
    Skip_L4(                                                    "Number of important colors used");

    FILLING_BEGIN();
        if (BitsPerPixel<8)
            BitsPerPixel=8; //It is a palette

        Fill(Stream_Image, 0, Image_Width, Width);
        Fill(Stream_Image, 0, Image_Height, Height);
        Fill(Stream_Image, 0, Image_BitDepth, BitsPerPixel);
        Fill(Stream_Image, 0, Image_Format, Bmp_CompressionMethod(CompressionMethod));
        Fill(Stream_Image, 0, Image_Codec, Bmp_CompressionMethod(CompressionMethod));
        Fill(Stream_Image, 0, Image_ColorSpace, "RGB");
    FILLING_END();

    if (Version>1)
    {
        Skip_L4(                                                "Red Channel bit mask");
        Skip_L4(                                                "Green Channel bit mask");
        Skip_L4(                                                "Blue Channel bit mask");
        if (Version>2)
        {
            Skip_L4(                                            "Alpha Channel bit mask");
            if (Version>3)
            {
                Skip_L4(                                        "Color Space endpoints");
                Skip_L4(                                        "Color Space endpoints");
                Skip_L4(                                        "Color Space endpoints");
                Skip_L4(                                        "Color Space endpoints");
                Skip_L4(                                        "Color Space endpoints");
                Skip_L4(                                        "Color Space endpoints");
                Skip_L4(                                        "Color Space endpoints");
                Skip_L4(                                        "Red Gamma");
                Skip_L4(                                        "Green Gamma");
                Skip_L4(                                        "Blue Gamma");
                if (Version>4)
                {
                    Skip_L4(                                    "Intent");
                    Skip_L4(                                    "ProfileData");
                    Skip_L4(                                    "ProfileSize");
                    Skip_L4(                                    "Reserved");
                }
            }
        }
    }
}