t4dn(      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~       !"#$%&'(Hack to catch pureish asynchronous errors 7This is only used as a workaround to the binary library's shortcoming of H using asynchronous errors instead of pure error handling, and also zlib's  same shortcoming.  This function is similar to the spoon package's teaspoon function, I except that it can return more information when an exception is caught. Return a substring  index length returns length characters from the string  starting at index, which starts at 0.  subStr 1 2 "abcd" == "bc" #Formats for raw image data that don')t include information such as dimensions _Series of unused byte, red, green, and blue; the string is compressed and then base-64 encoded ,Series of unused byte, red, green, and blue @Series of red, green, blue, red, etc. with a row alignment of 4 TSeries of red, green, blue, red, etc. with a row alignment of 4, stored upside-down VSeries of blue, green, red, unused, blue, etc. (already aligned to a 4-byte boundary) iSeries of blue, green, red, unused, blue, etc. stored upside-down (already aligned to a 4-byte boundary) USeries of blue, green, red, blue, etc. with a row alignment of 4, stored upside-down MSeries of red, green, and blue, represented as a series of hexadecimal pairs qSeries of unused byte, red, green, and blue; the string is compressed and then base-64 encoded; identified by an l character Series of red, green, and blue; the string is hex encoded, then compressed, then hex encoded again; the encoded string is prepended with with z Series of blue, green, and red, that is rotated two bytes right; the string is compressed and then base-64 encoded; the encoded string is prepended with a b for simpler identification {Series of red, green, and blue; the string is compressed and then base-64 encoded; the encoded string is prepended with an m for simpler identification /Formats that bitmaps that are instances of the BitmapM class need to support; these formats include the necessary meta-information ESimilar to CBF_BMPIU, but internally the pixel data is stored in the   format instead of   (This format is another common format of bmp files. Same as  except that that final result is base-64 encoded and is thus suitable for human-readable strings defining a small bitmap (CompleteBitmapFormat_BitMaPInfoheaderUncompressed) Like , strings encoded in this format can become large quick quickly, and even about a third more so, due to the more restrictive range of values. ]Uncompressed BITMAPINFOHEADER BMP format (CompleteBitmapFormat_BitMaPInfoheaderUncompressed) #The image format of this format is   XDue to being uncompressed, strings encoded in this format can grow large quite quickly. d This format is standard and widely supported, and can be written directly to a file, the extension  of which is typically .bmp 'This format is one possible format for bmp files. :These are the color depths that the bitmap class supports JThe depth does not necessarily indicate any particular order; instead the J components listed in the name indicate which components are contained in  each pixel. NThe order in which the constructors are defined is significant; it determines  which match mostLikelyMatchCBF will choose. Y32 bit pixel also consisting of one pixel per component but contains the alpha component GFour bytes are needed for pixels of this type to be fully represented. R24 bit pixel consisting of one pixel per component and lacking an alpha component \Each pixel of this type thus requires three bytes to be fully represented. Implementations d are not required to pack the image data, however; they are free, for instance, to store each pixel  in 32-bit (4-byte) integers.       )*   A!"#XGeneric pixel type which has not be efficient enough when used with bitmaps in practice $%&$The most significant byte is unused '$The most significant byte is unused ()*+,-./0123456789:;<=>?@ABCDEFGHIJKL>A less efficient way of converting pixels by their components MN+OPjIf the Genpixel types differ, they can still be determined to be equivalent if their components are equal ,Unlike the default derived instance of Eq, ,-QRSTUVWXYZ[\]^pReturn a color from the first 6-bytes of a string representing the red, green, and blue components of the color { (colorString "FF0000" :: Maybe PixelRGBA) == Just $ (red =: 0xFF) . (green =: 0x00) . (blue =: 0x00) $ greatestIntensity >!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^ACDEFGHIJKLBAMN>?@;<=89:567234/01,-.)*+#'&%$((((OPQRSTUVWX"!YZ[\]^>!"#'&%$(((($%&'()*+*+,-.-./0101234345676789:9:;<=<=>?@?@ABCDEFGHIJKDEFGHIJKLMNOPQRSTUVWXYZ[\]^O_`abcdefghijklmn Bitmap class APixels are indexed by (row, column), where (0, 0) represents the @ upper-left-most corner of the bitmap. Instances of this class , are not required to support empty bitmaps. BThe encoding and decoding lists contain functions that can encode @ and decode or return a string containing information about why B it could not be decoded in that format. The order is important: F When a function tries multiple or any decoder, it will use or return > the one(s) closest to the head of the list. There are lists D of generic functions that are defined by default. Normally, if an A implementation of a bitmap type overrides the default instance, B it will only need to replace one or a few decoders, not touching @ the rest of the default decoders or the order of the decoders;  thus the function { is defined and exported. 5Instances *must* support every serialization format. opq&The color depth of the bitmap in bits r4Return the width and height of the bitmap in pixels s"Get a pixel; indexing starts at 0 ?Implementations can assume that the coordinates are within the D bounds of the bitmap. Thus callers of this function should always B ensure that the coordinates are within the bounds of the bitmap. tfConstruct a bitmap with a function that returns a pixel for each coordinate with the given dimensions GThe function should return the same type of pixel for each coordinate. `Implementations are not required to call the function in any particular order, and are not even ` required to guarantee that the function will be called for each pixel, which might be true for . a bitmap that is evaluated lazily as needed. uConstruct a new bitmap from the bitmap passed as the second argument but storing it in the bitmap of the meta-bitmap passed as the first argument {The purpose of this function is efficiency. Some bitmap types have multiple possible internal representations of bitmaps. } For these bitmap types, it is often more efficient when performing operations on multiple bitmaps for them be stored in the X same format. Instances might even always convert the bitmaps if their formats differ. 9Implementations are not required to define this function C to store the second bitmap in another format, or even in the same E format as the first bitmap; this is only used for efficiency. They E should, however, return a bitmap that represents the same bitmap as B what the main bitmap (passed as the second argument) represents. E The default behaviour of this function is to return the main bitmap  (passed second) verbatim. DAs an example application of this function, consider a program that ? regularly captures the screen and searches for any of several = bitmaps which are read from the filesystem. The programmer = chooses the type that is most efficient for the format that 9 the screen capture is in, and uses it as the main type. > As the screen is expected to change, it would be inefficient A to convert each capture into another internal format each time, I especially since screen dumps can be very large. The bitmaps, however, E are generally static (and much smaller), so they could be converted  once using this function, u, to the format that G screen captures are represented in, and reused. If the formats would J otherwise differ, this is much more efficient than converting the format A of every sub-bitmap every time a search or operation is needed. ?NB: again, the format of the first argument is used along with @ the image of the second argument to return (possibly) a bitmap B with the image of the second argument and with the format of the  first argument. v0Bitmap encoders; default definition is based on | BAs the head of the list might be best suited for writing to files D or generating text strings but not both, it is suggested that this B function is used only when it does not matter whether the result ' is writable to a file or is generally human readable. wdBitmap decodes; extra bytes after the end should be ignored by them; default definition is based on  xNBitmap encoders; the meta-information is lost; default definition is based on  yKDecode the bitmap; the meta-information from the given bitmap is used (see cb"); default definition is based on  z#Convert one bitmap type to another {Update identifiable elements { orig new returns orig with each matching * pair updated; extraneous replacements in new are ignored. |}~Encode a bitmap ?An implementation can choose the most efficient or appropriate > format by placing its encoder first in its list of encoders. Decode a bitmap @The result of first decoder of the implementation that succeeds % will be returned. If none succeed, . is returned. Encode the pixels of a bitmap ?An implementation can choose the most efficient or appropriate > format by placing its encoder first in its list of encoders. Decode the pixels of a bitmap @The result of first decoder of the implementation that succeeds % will be returned. If none succeed, . is returned. /'Encode a bitmap in a particular format 'Decode a bitmap in a particular format 5Encode the pixels of a bitmap in a particular format 5Decode the pixels of a bitmap in a particular format *Decode an image with the given dimensions IThis is only guaranteed to work on implementations and formats that only H need dimensions in addition to the raw pixel data. This is convenient ; because most often the dimensions are all that is needed. RCurrently, this function works by constructing a bitmap with the given dimensions Z and with each pixel set to the least intensity. Thus it is significantly more efficient ) if this is used with a bitmap that doesn'=t strictly evaluate the entire pixel data when the structure N is first constructed (not necessarily when any pixel is accessed) (currently J none of the bitmap types exported in this library are so strict), as the O bitmap will not need to be fully evaluated; only the dimensions will be used. -Decode an image with the given dimensions as # does it, but in a specific format [Determine whether the seconds dimensions passed can fit within the first dimensions passed GIf the width or height of the second dimensions exceeds those of first  dimensions, 0 is returned. Returns the width of a bitmap Returns the height of a bitmap N_`abcdefghijklmnopqrstuvwxyz{|}~Nnopqrstuvwxyzklmhijefgbcd_`a{|}~N_`a`abcdcdefgfghijijklmlmn opqrstuvwxyopqrstuvwxyz{|}~Arrays of 32-bit RGBA pixels 1 Instance for debugging purposes  RClass for bitmaps that can be rectangularly cropped into (possibly) smaller sizes Using the functions of the n class, . default functions are be defined for each of , these; of course, implementations are free # to write more efficient versions. [Crop a bitmap with the given dimensions (third argument) from a position (second argument) Implementations can but are not required to assume that the result will be a (not necessarily proper) subset of the super bitmap only. Implementations should properly handle the case where the result is as large as the passed super bitmap.  Class for reflectable bitmaps Using the functions of the n class, . default functions are be defined for each of , these; of course, implementations are free # to write more efficient versions.  %The foreign bitmap as defined by the bitmap package .For more information see documentation of the bitmap package. ENB: this type is actually a reference to a memory location; thus the O possible issues with concurrency and referential transparency are introduced.  Class for searchable bitmaps Using the functions of the n class, . default functions are be defined for each of , these; of course, implementations are free $ to define more efficient versions. QRecursively call a function with the coordinates, row by row from the left, from M the minimum, upper-left coordinates to the maximum, lower-right coordinates Starting value  Minimum, upper-left coordinates !Maximum, lower-right coordinates (The bitmap in which to scan coordinates >Scan each pixel until a match is found in no particular order DImplementations are free to choose an efficient implementation that 0 searches in a different direction from that of . A This function is often, but not necessarily always, the same as  . `Scan each pixel, row by row from the left, starting at the given offset, until a match is found A more restricted version of ? that is usually more efficient when exact equality is desired 6Search for coordinates where a sub-bitmap would match :Each coordinate, representing the upper-left-most corner, ? for which the sub-bitmap would fit is tried for a match until  the function returns 2# for every pixel that is compared. H The function is passed the pixel of the super bitmap which is searched C as the first parameter, and the pixel of the sub bitmap is passed D as the second parameter. Likewise, the super bitmap is then given D to this function as the second parameter, and then the sub bitmap. F Normally, the order in which the bitmap is checked in the same order  as 0, but implementation are free to implement this F in whatever order is convenient or efficient; implementation should, G however, assume that callers usually expect this order to be the most  efficient one.  Super bitmap  Sub bitmap  Super bitmap  Sub bitmap A more restricted version of ? that is usually more efficient when exact equality is desired  Super bitmap  Sub bitmap  Super bitmap  Sub bitmap  Super bitmap  Sub bitmap 6Find the first bitmap from the list that matches with 8 the area of the same size from the given coordinate in  the super( bitmap (passed as the second argument) 8 down-right (the coordinate is the first pixel which is 5 the top-left most of the area to check). The match 4 sub-bitmap and its index in the list are passed in 5 the opposite order given in this description to the 8 function, and the result is returned; if one is found.  If no match is found, . is returned. The sub. bitmaps are tested in order until a match is 0 found, and if one is, its index in the list is  returned. Each pixel in every sub bitmap is specially 4 colored to represent a particular function. These  colors are recognized:  black /0 greatest intensity: the corresponding pixel in  the super, bitmap based on position can be any color.  - white /1 least intensity: the corresponding pixel in the : super bitmap must be the same color as every other pixel = in the super bitmap that also corresponds to a white pixel.  red  FF0000 $ completely red: if there are white : pixels in the sub bitmap, the corresponding pixel of the 3 red pixel should be different from the color that " corresponds to the white pixels.  green  00FF00 + complete green: if there are white pixels 3 in the sub bitmap, the corresponding pixel of the 2 green pixel should not be similar from the color , that corresponds to the white pixels. See  yellow  FFFF00 - complete yellow: if there are white pixels, : this matches iff the color is similar to the colors that ! correspond to the white pixels.  to see whether two colors are  considered to be similar. 5The behaviour when any other pixel is encountered is  undefined. :When the dimensions of a sub bitmap are too large for the 9 super bitmap offset by the coordinates, where otherwise 2 some pixels of the sub bitmap would not have any 8 corresponding pixels in the super bitmap; then the sub  bitmap simply does not match. 5This function makes OCR with a known and static font  more convenient to implement.  Super bitmap %Coordinates relative to super bitmap 3 equivalent of - for a horizontal string of embedded bitmaps _This is particularly convenient for OCR with a static and known font with multiple characters.  Super bitmap AScan for the given string of horizontally embedded bitmaps as in  As with ), each bitmap must be adjacent to match. + If the integer is passed for a dimension ((width, height)), then  no more than  the value( extra rows or columns will be checked.  For example, if 4 0& is passed for the row value, then no " additional rows will be checked.  Super bitmap Binary similarity comparison )This function considers two colors to be similar if their difference ' according to the CIE94 algorithm (see ) is less than  23. AApproximate difference in color according to the CIE94 algorithm (Default transparent pixel value; FF007E  44A bitmap represented as a string or stored as bytes CBy default, the RGB32 format (where the most significant byte, the $ head-most one, is unused) is used. FThe bitmap must be stored by pixels not separated by component. Each J pixel must contain at least the red, blue, and green component, each one E byte wide (bytes are assumed to be octets), either in that order or J reversed. There may be an alpha component either immediately before the L other three components or immediately after. Thus there are four possible I arrangements of components for each pixel, which must be consistent for N every pixel. Any amount of padding or unused bytes is permitted before each H pixel, but the amount must be fixed. The same is true also after each  pixel. 3This type is most efficient with lazy bytestrings. .Bitmap data; it is assumed to be large enough Width and height of the data; A, etc. need to be taken account for the dimensions of the bitmap YEach row is aligned to this many bytes; when necessary, null bytes are added to each row 'Whether the red component is first; if 2U, the order of the components is red, green, blue; otherwise, it is blue, green, red If .2, then there is no alpha component; otherwise, if 2=, it is before the other three components (towards the head)  most significant : first, otherwise, it is after the other three components  towards the tail  least significant / last of the four components )Number of unused bytes before each pixel (Number of unused bytes after each pixel Is the first row at the top? -Is the first column in each row at the left? VHow many rows of data to skip from the beginning (from *first* row); used in cropping =How many rows of data to skip from the end; used in cropping Default  format This is equivalent to  MReturn (rowSize, paddingSize) based on width, bytes per pixel, and alignment ;Be careful when using the results of this function that you'#re actually using the right value. Return (rowSize, paddingSize) ;Be careful when using the results of this function that you'#re actually using the right value. !Get part of a pixel as a cell of GenStringDefault UThe bitmap passed is only used for its format; its dimensions and data are not used.  This function doesn'Dt return any alpha parts; for those it returns pad bytes, which are  zero. ;Construct a bitmap in the format of the meta bitmap passed VOnly the format fields of the bitmap is used, so the data and dimensions of it can be 5. #The data in the new bitmap is what GenStringDefault is aliased to. Used by the encoders Used by the decoders    4   4   4    !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ !A bitmap represented as a string )This is essentially the format of pixels 3 in the BMP format in which each row is aligned to 7 a four-byte boundry and each row contains a series of  RGB pixels. MThis type is most efficient for programs interacting heavily with BMP files.  Width and height of the bitmap Data stored in a string {Container for a string that represents a sequence of raw pixels lacking the alpha component and that is stored upside down MReturn (rowSize, paddingSize) based on width, bytes per pixel, and alignment           A bitmap represented as a string, which contains a series of aligned rows, which themselves consist of a series of pixels stored in 4 bytes in which the most significant byte is unused (thus the rows are always aligned to a four-byte boundary) Width and height of the bitmap Data stored in a string  "Polymorphic container of a string !"#$%&'  !"#$%&'  !"#$%&'  !"!"#$%&'6 !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKKLMMNOOPQQRSTUVWXYZ[\]^_`abcdefghijklmnopqqrsstuuvwwxyyz{|}~                !"#$%&'()*'(+#,-#$.#/01bitmaps-0.2.5.1Data.Bitmap.UtilData.Bitmap.TypesCodec.String.Base64Codec.String.Base16Data.Bitmap.PixelData.Bitmap.ClassData.Bitmap.Array.InternalData.Bitmap.ArrayData.Bitmap.CroppableData.Bitmap.ReflectableData.Bitmap.ForeignData.Bitmap.SearchableData.Bitmap.Function.InternalData.Bitmap.String.Internal$Data.Bitmap.StringRGB24A4VR.Internal Data.Bitmap.StringRGB32.InternalData.Bitmap.FunctionData.Bitmap.StringData.Bitmap.BMPData.Bitmap.StringRGB24A4VRData.Bitmap.StringRGB32 tablespoonsubStrpadByteImageBitmapFormat IBF_RGB32Z64 IBF_RGB32 IBF_RGB24A4 IBF_RGB24A4VR IBF_BGRU32 IBF_BGRU32VR IBF_BGR24A4VR IBF_BGR24HIBF_IDRGB32Z64IBF_IDBGR24HZHIBF_IDBGR24R2RZ64IBF_IDRGB24Z64CompleteBitmapFormat CBF_BMPIUU CBF_BMPIUZ64 CBF_BMPIU64 CBF_BMPIUDepth Depth32RGBA Depth24RGB Coordinates Dimensionsbytes64ibytes64 fillByte64encode64decode64 encodeHex decodeHexGenPixelComponentGenPixelStorageGenPixel GenPixelBGRA GenPixelRGBA GenPixelBGR GenPixelRGBunwrapPixelStorage ConvPixelBGRA toPixelBGRA fromPixelBGRA ConvPixelRGBA toPixelRGBA fromPixelRGBA ConvPixelBGR toPixelBGR fromPixelBGR ConvPixelRGB toPixelRGB fromPixelRGB PixelBGRAunwrapPixelBGRA PixelRGBAunwrapPixelRGBAPixelBGRunwrapPixelBGRPixelRGBunwrapPixelRGBPixelComponent PixelStoragePixelredgreenbluealphaleastIntensitygreatestIntensitytoPixel fromPixelconvertPixelValueleastIntensityComponentgreatestIntensityComponenteqGenPixelValueneqGenPixelValuegenRedgenGreengenBluegenAlpha toGenPixelRGB toGenPixelBGRtoGenPixelRGBAtoGenPixelBGRAleastIntensityGenComponentgreatestIntensityGenComponentleastIntensityGengreatestIntensityGen bigEndian colorStringGenericBitmapSerializerunwrapGenericBitmapSerializer ImageDecoderunwrapImageDecoder ImageEncoderunwrapImageEncoderCompleteDecoderunwrapCompleteDecoderCompleteEncoderunwrapCompleteEncoderBitmap BIndexType BPixelTypedepth dimensionsgetPixelconstructPixelsconvertInternalFormatcompleteEncoderscompleteDecoders imageEncoders imageDecoders convertBitmapupdateIdentifiableElementsdefaultCompleteEncodersencodeCBF_BMPIUencodeCBF_BMPIUUencodeCBF_BMPIU64encodeCBF_BMPIUZ64defaultCompleteDecoders tryCBF_BMPIU tryCBF_BMPIUUtryCBF_BMPIU64tryCBF_BMPIUZ64defaultImageEncodersencodeIBF_IDRGB24Z64encodeIBF_IDBGR24R2RZ64encodeIBF_IDBGR24HZHencodeIBF_IDRGB32Z64encodeIBF_BGR24HencodeIBF_RGB24A4encodeIBF_BGR24A4VRencodeIBF_BGRU32VRencodeIBF_BGRU32encodeIBF_RGB24A4VRencodeIBF_RGB32encodeIBF_RGB32Z64defaultImageDecoderstryIBF_IDRGB24Z64tryIBF_IDBGR24R2RZ64tryIBF_IDBGR24HZHtryIBF_IDRGB32Z64 tryIBF_BGR24HtryIBF_RGB24A4tryIBF_BGR24A4VRtryIBF_BGRU32VR tryIBF_BGRU32tryIBF_RGB24A4VR tryIBF_RGB32tryIBF_RGB32Z64encodeCompletedecodeComplete encodeImage decodeImageencodeCompleteFmtdecodeCompleteFmtencodeImageFmtdecodeImageFmtdecodeImageDimensionsdecodeImageDimensionsFmt dimensionsFit bitmapWidth bitmapHeight BitmapArrayunwrapBitmapArraybitmapArrayToArraybitmapArrayToBitmapArrayBitmapCroppablecropBitmapReflectablereflectVerticallyreflectHorizontally BitmapForeignunwrapBitmapForeign FBBitmapBaseBitmapSearchable foldrCoords findPixelfindPixelOrderfindPixelEqual findPixelsfindPixelsEqual findSubBitmapfindSubBitmapOrderfindSubBitmapEqualfindSubBitmapsfindSubBitmapsEqualfindEmbeddedBitmapfindEmbeddedBitmapStringfindFixedEmbeddedBitmapStringareColorsSimilarcolorDifferenceCIE94defaultTransparentPixel matchPixelAnymatchPixelSamematchPixelSameThreshold matchPixelDifmatchPixelDifThresholdBitmapFunction_bmpf_dimensions_bmpf_getPixelbmpf_dimensions bmpf_getPixel BitmapString _bmps_data_bmps_dimensions_bmps_rowAlignment _bmps_redHead_bmps_alphaHead_bmps_paddingHead_bmps_paddingTail_bmps_rowFromTop_bmps_columnFromLeft_bmps_rowFromBeg_bmps_rowFromEnd_bmps_columnFromBeg_bmps_columnFromEnd bmps_databmps_dimensionsbmps_rowAlignment bmps_redHeadbmps_alphaHeadbmps_paddingHeadbmps_paddingTailbmps_rowFromTopbmps_columnFromLeftbmps_rowFromBegbmps_rowFromEndbmps_columnFromBegbmps_columnFromEndformatEqdefaultBSFormat rowPadding bytesPerPixel rowPaddingBS rgbOffsets alphaOffset pixelPart imageSizeBSconstructBitmapStringFormattedbitmapFmtBGR24A4VRbitmapFmtRGB24A4VRbitmapFmtRGB24A4bitmapFmtRGB32encodeBSFormatencodeIBF_BGR24A4VR'encodeIBF_RGB24A4VR'encodeIBF_RGB24A4'encodeIBF_RGB32' tryBSFormattryIBF_BGR24A4VR'tryIBF_RGB24A4VR'tryIBF_RGB24A4' tryIBF_RGB32'BitmapStringRGB24A4VRBitmapImageString_polyval_bitmapImageStringbitmapStringBytesPerRow widthPadding bytesPerRow imageSizeBitmapStringRGB32handlers++ maybeReadbyteLenslgetterlsetterbase Data.MaybeNothing serializeFmtghc-primGHC.BoolFalse$fShowBitmapArrayTrueGHC.BasefoldrJustGHC.Err undefined