该模块提供了一个通用的帧缓冲区,可以用来创建位图图像,然后可以发送到一个显示。
帧级提供一个像素缓冲区可借鉴的像素,线,矩形,文本和其他帧,用于生成输出显示器。
例如:
Onemustspecifyvalidbuffer,width,height,formatandoptionallystride.Invalidbuffersizeordimensionsmayleadtounexpectederrors.
ThefollowingmethodsdrawshapesontotheFrameBuffer.
FilltheentireFrameBufferwiththespecifiedcolor.
Ifcisnotgiven,getthecolorvalueofthespecifiedpixel.Ifcisgiven,setthespecifiedpixeltothegivencolor.
Drawalinefromasetofcoordinatesusingthegivencolorandathicknessof1pixel.Thelinemethoddrawsthelineuptoasecondsetofcoordinateswhereasthehlineandvlinemethodsdrawhorizontalandverticallinesrespectivelyuptoagivenlength.
Drawarectangleatthegivenlocation,sizeandcolor.Therectmethoddrawsonlya1pixeloutlinewhereasthefill_rectmethoddrawsboththeoutlineandinterior.
WritetexttotheFrameBufferusingthethecoordinatesastheupper-leftcornerofthetext.Thecolorofthetextcanbedefinedbytheoptionalargumentbutisotherwiseadefaultvalueof1.Allcharactershavedimensionsof8x8pixelsandthereiscurrentlynowaytochangethefont.
ShiftthecontentsoftheFrameBufferbythegivenvector.ThismayleaveafootprintofthepreviouscolorsintheFrameBuffer.
DrawanotherFrameBufferontopofthecurrentoneatthegivencoordinates.Ifkeyisspecifiedthenitshouldbeacolorintegerandthecorrespondingcolorwillbeconsideredtransparent:allpixelswiththatcolorvaluewillnotbedrawn.
ThismethodworksbetweenFrameBuffer'sutilisingdifferentformats,buttheresultingcolorsmaybeunexpectedduetothemismatchincolorformats.
Monochrome(1-bit)colorformatThisdefinesamappingwherethebitsinabyteareverticallymappedwithbit0beingnearestthetopofthescreen.Consequentlyeachbyteoccupies8verticalpixels.Subsequentbytesappearatsuccessivehorizontallocationsuntiltherightmostedgeisreached.Furtherbytesarerenderedatlocationsstartingattheleftmostedge,8pixelslower.
Monochrome(1-bit)colorformatThisdefinesamappingwherethebitsinabytearehorizontallymapped.Eachbyteoccupies8horizontalpixelswithbit0beingtheleftmost.Subsequentbytesappearatsuccessivehorizontallocationsuntiltherightmostedgeisreached.Furtherbytesarerenderedonthenextrow,onepixellower.
Monochrome(1-bit)colorformatThisdefinesamappingwherethebitsinabytearehorizontallymapped.Eachbyteoccupies8horizontalpixelswithbit7beingtheleftmost.Subsequentbytesappearatsuccessivehorizontallocationsuntiltherightmostedgeisreached.Furtherbytesarerenderedonthenextrow,onepixellower.