CompressionInfo Example VC++

This example interprets the bitwise value returned by the CompressionInfo property.  It is limited to black-and-white compression types only.

void CImgEdit2Dlg::OnCompressioninfo() 
{
    CCompresionInfo CompInfo;
    long lCompInfo;
    lCompInfo = ImgEdit1.GetCompressionInfo();
   
    // file has EOL's
    if(lCompInfo & 1)
      CompInfo.m_EOL = TRUE;
    else
      CompInfo.m_EOL = FALSE;

    // file has packed lines
    if(lCompInfo & 2)
      CompInfo.m_PackedLines = TRUE;
    else
      CompInfo.m_PackedLines = FALSE;

    // file has prefix EOL's
    if(lCompInfo & 4)
      CompInfo.m_PrefixEOL = TRUE;
    else
      CompInfo.m_PrefixEOL = FALSE;

    // Compressed bit order, Left-To-Right
    if(lCompInfo & 8)
      CompInfo.m_RBO = TRUE;
    else
      CompInfo.m_RBO = FALSE;

    // Expanded bit order, Left-To-Right
    if(lCompInfo & 16)
      CompInfo.m_LTR = TRUE;
    else
      CompInfo.m_LTR = FALSE;

    // Black and white are inverted on expansion
    if(lCompInfo & 32)
      CompInfo.m_Negate = TRUE;
    else
      CompInfo.m_Negate = FALSE;
      
    CompInfo.DoModal();
}