Module: WinGdi32Ruby
- Includes:
- Win32
- Defined in:
- lib/gdi32/system_const.rb,
lib/win-gdi32-ruby.rb
Overview
- Author
-
Jerry Fernholz
- Date
-
21 May 2009
Constants related to the Win32 API
Defined Under Namespace
Classes: Gdi32
Constant Summary collapse
- SRCCOPY =
:nodoc: dest = source
0x00CC0020
- SRCPAINT =
:nodoc: dest = source OR dest
0x00EE0086
- SRCAND =
:nodoc: dest = source AND dest
0x008800C6
- SRCINVERT =
:nodoc: dest = source XOR dest
0x00660046
- SRCERASE =
:nodoc: dest = source AND (NOT dest )
0x00440328
- NOTSRCCOPY =
:nodoc: dest = (NOT source)
0x00330008
- NOTSRCERASE =
:nodoc: dest = (NOT src) AND (NOT dest)
0x001100A6
- MERGECOPY =
:nodoc: dest = (source AND pattern)
0x00C000CA
- MERGEPAINT =
:nodoc: dest = (NOT source) OR dest
0x00BB0226
- PATCOPY =
:nodoc: dest = pattern
0x00F00021
- PATPAINT =
:nodoc: dest = DPSnoo
0x00FB0A09
- PATINVERT =
:nodoc: dest = pattern XOR dest
0x005A0049
- DSTINVERT =
:nodoc: dest = (NOT dest)
0x00550009
- BLACKNESS =
:nodoc: dest = BLACK
0x00000042
- WHITENESS =
:nodoc: dest = WHITE
0x00FF0062
Instance Method Summary collapse
- #bitmap_helper(name, param_type, return_value) ⇒ Object
- #bytewise_file_compare(fn1, fn2) ⇒ Object
-
#gdi32(name, param_type, return_value) ⇒ Object
- Wrap the API call to functions in ‘gdi32.dll’ so we don’t have to call
API.new 'gdi32' ...
repeatedlyname
- Name of the Win32 function to be called
param_type
- Array of parameter type hints
return_value
-
Type hint for the return value Example:
gdi32 'CreateDC', 'SSSP', 'L'
.
- Array of parameter type hints
- Name of the Win32 function to be called
- Wrap the API call to functions in ‘gdi32.dll’ so we don’t have to call
Instance Method Details
#bitmap_helper(name, param_type, return_value) ⇒ Object
27 28 29 30 |
# File 'lib/win-gdi32-ruby.rb', line 27 def bitmap_helper(name, param_type, return_value) path = File.(File.dirname(__FILE__)) sb = API.new name, param_type, return_value, path + '/BitmapHelper.dll' end |
#bytewise_file_compare(fn1, fn2) ⇒ Object
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
# File 'lib/win-gdi32-ruby.rb', line 162 def bytewise_file_compare(fn1, fn2) # Open both files as binary begin f1, f2 = File.open(fn1, 'rb'), File.open(fn2, 'rb') rescue => e puts e return false end # Assume they don't match same = false i, fs1, fs2 = 0, File.stat(fn1), File.stat(fn2) if fs1.size == fs2.size same = true bytes1 = [] f1.each_byte{|b| bytes1 << b} f2.each_byte do |b| if bytes1[i] != b same = false end i += 1 end end same end |
#gdi32(name, param_type, return_value) ⇒ Object
Wrap the API call to functions in ‘gdi32.dll’ so we don’t have to call API.new 'gdi32' ...
repeatedly
name
-
Name of the Win32 function to be called
param_type
-
Array of parameter type hints
return_value
-
Type hint for the return value
Example: gdi32 'CreateDC', 'SSSP', 'L'
23 24 25 |
# File 'lib/win-gdi32-ruby.rb', line 23 def gdi32(name, param_type, return_value) API.new name, param_type, return_value, 'gdi32' end |