您好,欢迎访问三七文档
课程名称专业英语题目名称图像格式——BMP学生学院机电工程学院专业班级09数媒一班学号3109000746学生姓名李林钢指导教师黄宪明2013年1月12日TheGraphicsFileFormat--BMPTheBMPfileformat,alsoknownasbitmapimagefileordeviceindependentbitmap(DIB)fileformatorsimplyabitmap,isarastergraphicsimagefileformatusedtostorebitmapdigitalimages,independentlyofthedisplaydevice(suchasagraphicsadapter),especiallyonMicrosoftWindowsandOS/2operatingsystems.TheBMPfileformatiscapableofstoring2Ddigitalimagesofarbitrarywidth,height,andresolution,bothmonochromeandcolor,invariouscolordepths,andoptionallywithdatacompression,alphachannels,andcolorprofiles.Device-independentbitmapsandtheBMPfileformatMicrosofthasdefinedaparticularrepresentationofcolorbitmapsofdifferentcolordepths,asanaidtoexchangingbitmapsbetweendevicesandapplicationswithavarietyofinternalrepresentations.Theycalledthesedevice-independentbitmapsorDIBs,andthefileformatforthemiscalledDIBfileformatorBMPimagefileformat.AccordingtoMicrosoftsupport:[1]Adevice-independentbitmap(DIB)isaformatusedtodefinedevice-independentbitmapsinvariouscolorresolutions.ThemainpurposeofDIBsistoallowbitmapstobemovedfromonedevicetoanother(hence,thedevice-independentpartofthename).ADIBisanexternalformat,incontrasttoadevice-dependentbitmap,whichappearsinthesystemasabitmapobject(createdbyanapplication...).ADIBisnormallytransportedinmetafiles(usuallyusingtheStretchDIBits()function),BMPfiles,andtheClipboard(CF_DIBdataformat).ThefollowingsectionsdiscussthedatastoredintheBMPfileorDIBindetail.ThisisthestandardBMPfileformat.[1]SomeapplicationscreatebitmapimagefileswhicharenotcompliantwiththecurrentMicrosoftdocumentation.Also,notallfieldsareused;avalueof0willbefoundintheseunusedfields.FilestructureThebitmapimagefileconsistsoffixed-sizestructures(headers)aswellasvariable-sizestructuresappearinginapredeterminedsequence.Manydifferentversionsofsomeofthesestructurescanappearinthefile,duetothelongevolutionofthisfileformat.Diag.1–ThestructureofthebitmapimagefileReferringtothediagram1,thebitmapfileiscomposedofstructuresinthefollowingorder:StructureNameOptionalSizePurposeCommentsBitmapFileHeaderNo14BytesTostoregeneralinformationabouttheBitmapImageFileNotneededafterthefileisloadedinmemoryDIBHeaderNoFixed-size(however7differentversionsexist)TostoredetailedinformationaboutthebitmapimageanddefinethepixelformatImmediatelyfollowstheBitmapFileHeaderExtrabitmasksYes3or4DWORDs[2](12or16Bytes)TodefinethepixelformatPresentonlyincasetheDIBHeaderistheBITMAPINFOHEADERColorTableSemi-optionalVariable-sizeTodefinecolorsusedbythebitmapimagedata(PixelArray)Mandatoryforcolordepths=8Gap1YesVariable-sizeStructurealignmentAnartifactoftheFileOffsettoPixelArrayintheBitmapFileHeaderPixelArrayNoVariable-sizeTodefinetheactualvaluesofthepixelsThepixelformatisdefinedbytheDIBHeaderorExtrabitmasks.EachrowinthePixelArrayispaddedtoamultipleof4bytesinsizeGap2YesVariable-sizeStructurealignmentAnartifactoftheICCProfileDataoffsetfieldintheDIBHeaderICCColorYesVariable-sTodefinethecolorprofileforcolorCanalsocontainapathtoanexternalfilecontainingtheProfileizemanagementcolorprofile.Whenloadedinmemoryasnon-packedDIB,itislocatedbetweenthecolortableandgap1.[3]DIBsinmemoryAbitmapimagefileloadedintomemorybecomesaDIBdatastructure–animportantcomponentoftheWindowsGDIAPI.Thein-memoryDIBdatastructureisalmostthesameastheBMPfileformat,butitdoesnotcontainthe14-bytebitmapfileheaderandbeginswiththeDIBheader.ForDIBsloadedinmemory,thecolortablecanalsoconsistof16bitentries,thatconstituteindexestothecurrentlyrealizedpalette[4](anadditionallevelofindirection),insteadofexplicitRGBcolordefinitions.Inallcases,thepixelarraymustbeginatamemoryaddressthatisamultipleof4bytes.Innon-packedDIBsloadedinmemory,theoptionalcolorprofiledatashouldbelocatedimmediatelyafterthecolortableandbeforethegap1andpixelarray[3](unlikeindiag.1).Whenthesizeofgap1andgap2iszero,thein-memoryDIBdatastructureiscustomarilyreferredtoaspackedDIBandcanbereferredtobyasinglepointerpointingtothebeginningoftheDIBheader.Inallcases,thepixelarraymustbeginatamemoryaddressthatisamultipleof4bytes.Insomecasesitmaybenecessarytoadjustthenumberofentriesinthecolortableinordertoforcethememoryaddressofthepixelarraytoamultipleof4bytes.[4]ForpackedDIBsloadedinmemory,theoptionalcolorprofiledatashouldimmediatelyfollowthepixelarray,asdepictedindiag.1(withgap1=0andgap2=0).[3]PackedDIBsarerequiredbyWindowsclipboardAPIfunctionsaswellasbysomeWindowspatternedbrushandresourcefunctions.[5]BitmapfileheaderThisblockofbytesisatthestartofthefileandisusedtoidentifythefile.AtypicalapplicationreadsthisblockfirsttoensurethatthefileisactuallyaBMPfileandthatitisnotdamaged.ThefirsttwobytesoftheBMPfileformatarethecharacter'B'thenthecharacter'M'in1-byteASCIIencoding.Alloftheintegervaluesarestoredinlittle-endianformat(i.e.least-significantbytefirst).Offset#SizePurpose0000h2bytestheheaderfieldusedtoidentifytheBMP&DIBfileis0x420x4Dinhexadecimal,sameasBMinASCII.Thefollowingentriesarepossible:BM–Windows3.1x,95,NT,...etc.BA–OS/2structBitmapArrayCI–OS/2structColorIconCP–OS/2constColorPointerIC–OS/2structIconPT–OS/2Pointer0002h4by
本文标题:图像文件格式BMP
链接地址:https://www.777doc.com/doc-2558531 .html