File: Bitmap.html

package info (click to toggle)
polyml 5.7.1-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid
  • size: 40,616 kB
  • sloc: cpp: 44,142; ansic: 26,963; sh: 22,002; asm: 13,486; makefile: 602; exp: 525; python: 253; awk: 91
file content (123 lines) | stat: -rw-r--r-- 5,241 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>

<head>
<title>Windows Interface Reference: Bitmap structure</title>
</head>

<body>

<h1>Bitmap</h1>

<p>The Bitmap structure contains functions and structures to create and operate on
bitmaps.&nbsp; Bitmaps are rectangular pictures in which the colour values for each pixel
are given individually.&nbsp; They are often used as the basis for icons.&nbsp; There are
two forms of bitmap: device-dependent bitmaps represented by the bitmap handle, HBITMAP,
and device-independent bitmaps.</p>

<pre>structure Bitmap:
  sig
    type HBITMAP and HDC
    type COLORREF = Color.COLORREF
    type RECT = { top: int, left: int, bottom: int, right: int }
    type SIZE = { cx: int, cy: int }
    datatype BitmapCompression = BI_BITFIELDS | BI_RGB | BI_RLE4 | BI_RLE8
    datatype FloodFillMode = FLOODFILLBORDER | FLOODFILLSURFACE

    type BITMAP =
	{ width: int, height: int, widthBytes: int, planes: int, bitsPerPixel: int,
	  bits: Word8Vector.vector option }

    type StretchMode
    val BLACKONWHITE : StretchMode
    val COLORONCOLOR : StretchMode
    val HALFTONE : StretchMode
    val MAXSTRETCHBLTMODE : StretchMode
    val WHITEONBLACK : StretchMode

    type RasterOpCode
    val BLACKNESS : RasterOpCode
    val DSTINVERT : RasterOpCode
    val MERGECOPY : RasterOpCode
    val MERGEPAINT : RasterOpCode
    val NOTSRCCOPY : RasterOpCode
    val NOTSRCERASE : RasterOpCode
    val PATCOPY : RasterOpCode
    val PATINVERT : RasterOpCode
    val PATPAINT : RasterOpCode
    val SRCAND : RasterOpCode
    val SRCCOPY : RasterOpCode
    val SRCERASE : RasterOpCode
    val SRCINVERT : RasterOpCode
    val SRCPAINT : RasterOpCode
    val WHITENESS : RasterOpCode

    val BitBlt : HDC * int * int * int * int * HDC * int * int * RasterOpCode -&gt; unit
    val CreateBitmap :
       {bits: Word8Vector.vector option, width: int, height: int,
         planes: int, bitsPerPixel: int} -&gt; HBITMAP
    val CreateBitmapIndirect : BITMAP -&gt; HBITMAP
    val CreateCompatibleBitmap : HDC * int * int -&gt; HBITMAP
    val ExtFloodFill : HDC * int * int * COLORREF * FloodFillMode -&gt; unit
    val GetBitmapBits : HBITMAP * int -&gt; Word8Vector.vector
    val GetBitmapDimensionEx : HBITMAP -&gt; SIZE
    val GetPixel : HDC * int * int -&gt; COLORREF
    val GetStretchBltMode : HDC -&gt; StretchMode

    type QuaternaryRop
    val MAKEROP4 : {back: RasterOpCode, fore: RasterOpCode} -&gt; QuaternaryRop
    val MaskBlt :
       HDC * int * int * int * int * HDC * int * int *
       HBITMAP * int * int * QuaternaryRop -&gt; unit

    val PlgBlt : HDC * RECT * HDC * RECT * HBITMAP * int * int -&gt; unit
    val SetBitmapBits : HBITMAP * Word8Vector.vector -&gt; unit
    val SetBitmapDimensionEx : HBITMAP * int * int * SIZE -&gt; SIZE
    val SetPixel : HDC * int * int * COLORREF -&gt; COLORREF
    val SetStretchBltMode : HDC * StretchMode -&gt; unit
    val StretchBlt :
       HDC * int * int * int * int * HDC * int * int * int * int * RasterOpCode -&gt; unit

    type BITMAPINFOHEADER =
	{
		width: int, height: int, planes: int, bitsPerPixel: int,
		compression: BitmapCompression, sizeImage: int, xPelsPerM: int, 
		yPelsPerM: int, clrUsed: int, clrImportant: int
	}
    val <a
href="#getBitmapInfoHdr">getBitmapInfoHdr</a>: Word8Vector.vector -&gt; BITMAPINFOHEADER
    val <a
href="#GetDIBits">GetDIBits</a>: HDC * HBITMAP * int * int * BITMAPINFOHEADER option -&gt; Word8Vector.vector
    val <a
href="#SetDIBits">SetDIBits</a>: HDC * HBITMAP * int * int * Word8Vector.vector -&gt; unit
  end</pre>

<h4>Device-independent bitmaps.</h4>

<p>A device-independent bitmap contains information which allows it to be written to a
file and read in on a different machine with different numbers of bits per pixel.&nbsp; It
can also be passed on the clipboard using the <a href="Clipboard.html#CH_DIB">CH_DIB</a>
clipboard format. A device-independent bitmap is simply a vector of bytes and is
represented in ML by the Word8Vector.vector type.</p>

<p><tt><a name="getBitmapInfoHdr">getBitmapInfoHdr</a>(vec: Word8Vector.vector):
BITMAPINFOHEADER</tt><br>
<strong>ML Extension:</strong> Extracts the header from a vector containing a
device-independent bitmap.&nbsp; It is often necessary to extract the header from a
device-independent bitmap in order to find the size of the bitmap needed as the argument
to SetDIBits.</p>

<p><tt><a name="GetDIBits">GetDIBits</a>(hdc, hb, startScan, scanLines, binfo:
BITMAPINFOHEADER option): Word8Vector.vector</tt><br>
Extracts a bitmap as a device-independent bitmap.&nbsp; This function operates in two
modes according to whether the binfo argument is NONE or SOME.&nbsp; If NONE is passed it
returns only the header.&nbsp; This can be extracted with getBitmapInfoHdr and if
necessary a modified copy of it can be made.&nbsp; For example, the bitsPerPixel can be
changed from the default for the device.&nbsp; It can then be passed with SOME again to
GetDIBits to extract the full device-independent bitmap.</p>

<p><tt><a name="SetDIBits">SetDIBits</a>(hdc, hb, startScan, scanLines, vec:
Word8Vector.vector): unit</tt><br>
Sets a bitmap to the device-independent bitmap in the argument vector.</p>
</body>
</html>