Skip to content

Commit 5209703

Browse files
Update README_EN.md
1 parent 94c4255 commit 5209703

File tree

1 file changed

+236
-1
lines changed

1 file changed

+236
-1
lines changed

README_EN.md

Lines changed: 236 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,239 @@ For function `CopyDataFrom`, please refer its description in "Functions Descript
6464

6565
# Functions Description
6666

67-
# Property Description
67+
## `CreateMemDC` function
68+
69+
`CreateMemDC` function sets the memory DC information (width, height, bit count) and creates it.
70+
71+
### Definition
72+
73+
```VBS
74+
Public Function CreateMemDC(ByVal iWidth As Long, ByVal iHeight As Long, _
75+
Optional ByVal iBitCount As Integer = 16, Optional ByVal FromHdc As Long = 0) As Boolean
76+
```
77+
78+
### Parameters
79+
80+
`iWidth`: Long, the width of the memory DC being created.
81+
82+
`iHeight`: Long, the height of the memory DC being created.
83+
84+
`iBitCount`: Optional, Integer, the color bit count of the memory DC being created. Default is 16 bit.
85+
86+
`FromHdc`: Optional, Long, the source DC handle.
87+
88+
### Return value
89+
90+
Type: `Boolean`
91+
92+
If the memory DC is created successfully, the function returns `True`. Otherwise, the function returns `False`.
93+
94+
### Examples
95+
96+
```VBS
97+
memDC.CreateMemDC 1920, 1080 'Creates a 1920 * 1080 memory DC
98+
```
99+
100+
```VBS
101+
memDC.CreateMemDC 1920, 1080, 8 'Creates a 1920 * 1080, 8 bit memory DC
102+
```
103+
104+
```VBS
105+
memDC.CreateMemDC 1920, 1080, , frmMain.hDC 'Creates a 1920 * 1080 memory DC from frmMain's hDC
106+
```
107+
108+
**NOTE: When you use `CreateMemDC` function, this function deletes the previous memory DC automatically.**
109+
110+
## `DeleteMemDC` function
111+
112+
`DeleteMemDC` deletes the create memory DC.
113+
114+
### Definition
115+
116+
```VBS
117+
Public Sub DeleteMemDC()
118+
```
119+
120+
### Examples
121+
122+
```VBS
123+
memDC.DeleteMemDC
124+
```
125+
126+
**NOTE: Call `DeleteMemDC` when you don't need the memory DC anymore. This function is automatically called when the class is being terminated.**
127+
128+
## `BitBltFrom` function
129+
130+
`BitBltFrom` paints image from other DCs to the created memory DC.
131+
132+
### Definition
133+
134+
```VBS
135+
Public Function BitBltFrom(FromHdc As Long, FromX As Long, FromY As Long, _
136+
ToX As Long, ToY As Long, iWidth As Long, iHeight As Long, _
137+
Optional DrawMode As RasterOpConstants = vbSrcCopy Or BITBLT_TRANSPARENT_WINDOWS) As Boolean
138+
```
139+
### Parameters
140+
141+
`FromHdc`: Long, Specifics the DC handle to paint image from.
142+
143+
`FromX`: Long, X position of the original image.
144+
145+
`FromY`: Long, Y position of the original image.
146+
147+
`ToX`: Long, X position of the target image.
148+
149+
`ToY`: Long, Y position of the target image.
150+
151+
`iWidth`: Long, width of the image being painted
152+
153+
`iHeight`: Long, height of the image being painted
154+
155+
`DrawMode`: Optional, RasterOpConstants, specifics painting mode. Default is `vbSrcCopy Or BITBLT_TRANSPARENT_WINDOWS`. Painting mode can be the combination of the following constants:
156+
157+
| RasterOpConstants |
158+
|-------------------|
159+
| vbDstInvert |
160+
| vbMergeCopy |
161+
| vbMergePaint |
162+
| vbNotSrcCopy |
163+
| vbNotSrcErase |
164+
| vbPatCopy |
165+
| vbPatInvert |
166+
| vbPatPaint |
167+
| vbSrcAnd |
168+
| vbSrcCopy |
169+
| vbSrcErase |
170+
| vbSrcInvert |
171+
| vbSrcPaint |
172+
173+
### Return value
174+
175+
Type: `Boolean`
176+
177+
If the image is painted successfully, the function returns `True`. Otherwise, the function returns `False`.
178+
179+
### Examples
180+
181+
```VBS
182+
memDC.BitBltFrom frmMain.hDC, 0, 0, 0, 0, 100, 100 'Paints the image from frmMain.hDC, from (0, 0) of the window to (0, 0) of the memory DC, sized 100 * 100
183+
```
184+
185+
```VBS
186+
memDC.BitBltFrom GetDC(0), 100, 200, 150, 250, 300, 400, vbSrcInvert 'Paints the image from the screen DC, from (100, 200) of the screen to (150, 250) of the memory DC, sized 300 * 400, using vbSrcInvert painting mode
187+
```
188+
189+
## `BitBltTo` function
190+
191+
`BitBltTo` paints image from the created memory DC to other DCs.
192+
193+
### Definition
194+
195+
```VBS
196+
Public Function BitBltTo(ToHdc As Long, ToX As Long, ToY As Long, _
197+
FromX As Long, FromY As Long, iWidth As Long, iHeight As Long, _
198+
Optional DrawMode As RasterOpConstants = vbSrcCopy Or BITBLT_TRANSPARENT_WINDOWS) As Boolean
199+
```
200+
### Parameters
201+
202+
`ToHdc`: Long, Specifics the DC handle to paint image to.
203+
204+
`ToX`: Long, X position of the target image.
205+
206+
`ToY`: Long, Y position of the target image.
207+
208+
`FromX`: Long, X position of the original image.
209+
210+
`FromY`: Long, Y position of the original image.
211+
212+
`iWidth`: Long, width of the image being painted
213+
214+
`iHeight`: Long, height of the image being painted
215+
216+
`DrawMode`: Optional, RasterOpConstants, specifics painting mode. Default is `vbSrcCopy Or BITBLT_TRANSPARENT_WINDOWS`. For constants available for DrawMode, please refer to "`BitBltFrom` function" section.
217+
218+
### Return value
219+
220+
Type: `Boolean`
221+
222+
If the image is painted successfully, the function returns `True`. Otherwise, the function returns `False`.
223+
224+
### Examples
225+
226+
```VBS
227+
memDC.BitBltTo frmMain.hDC, 0, 0, 0, 0, 100, 100 'Paints the image to frmMain.hDC, from (0, 0) of the memory DC to (0, 0) of the window, sized 100 * 100
228+
```
229+
230+
```VBS
231+
memDC.BitBltTo GetDC(0), 100, 200, 150, 250, 300, 400, vbSrcInvert 'Paints the image to the screen DC, from (100, 200) of the memory DC to (150, 250) of the screen DC, sized 300 * 400, using vbSrcInvert painting mode
232+
```
233+
234+
## `CopyDataFrom` function
235+
236+
`CopyDataFrom` function copies data from a Byte array to the memory DC.
237+
238+
### Definition
239+
240+
```VBS
241+
Public Sub CopyDataFrom(FromArray() As Byte)
242+
```
243+
244+
### Parameters
245+
246+
`FromArray`: Byte(), the Byte array to copy data from.
247+
248+
### Examples
249+
250+
```VBS
251+
memDC.CopyDataFrom data 'Copy image data from data, where data is a Byte array
252+
```
253+
254+
**NOTE: `CopyDataFrom` function copies all data from the array to the memory region of the memory DC. So it checks if the array size is larger than the size of memory region of the memory DC or not. If the memory region is smaller than the size of the array, it only copies data in the same size to the size of memory region of the memory DC. For example, if the array is 10 bytes, and the size of the memory region of the memory DC is 5 bytes, this function will only copy 5 bytes from the array.**
255+
256+
## `CopyDataTo` function
257+
258+
`CopyDataFrom` function copies data from the memory DC to a Byte array.
259+
260+
### Definition
261+
262+
```VBS
263+
Public Function CopyDataTo(ToArray() As Byte) As Boolean
264+
```
265+
266+
### Parameters
267+
268+
`ToArray`: Byte(), the Byte array to copy data to.
269+
270+
### Return value
271+
272+
Type: `Boolean`
273+
274+
If the data is copied successfully, the function returns `True`. Otherwise, the function returns `False`.
275+
276+
### Examples
277+
278+
```VBS
279+
memDC.CopyDataTo data 'Copy image data to data, where data is a Byte array
280+
```
281+
282+
**NOTE: `CopyDataTo` function copies all data from the memory region of the memory DC to the array. So it checks if the array size is large enough to receive the memory DC data or not. If the memory region is larger than the size of the array, this function fails. For example, if the array is 5 bytes, and the size of the memory region of the memory DC is 10 bytes, this function will return `False`**
283+
284+
# Properties Description
285+
286+
`iWidth`: Long, the width of the memory DC.
287+
288+
`iHeight`: Long, the height of the memory DC.
289+
290+
`iBitCount`: Long, the color bit count of the memory DC.
291+
292+
`iImageSize`: Long, the size of the memory region of the memory DC.
293+
294+
`hDC`: Long, the handle to the created memory DC.
295+
296+
`hBmp`: Long, the handle to the bitmap created. This bitmap is created together with the memory DC.
297+
298+
`lpBitData`: Long, the address of the memory region of the memory DC.
299+
300+
# License
301+
302+
MIT

0 commit comments

Comments
 (0)