| 1 |
|
| 2 |
|
| 3 |
package windriver |
| 4 |
|
| 5 |
import ( |
| 6 |
"syscall" |
| 7 |
"unsafe" |
| 8 |
|
| 9 |
"golang.org/x/sys/windows" |
| 10 |
) |
| 11 |
|
| 12 |
var _ unsafe.Pointer |
| 13 |
|
| 14 |
var ( |
| 15 |
modmsimg32 = windows.NewLazySystemDLL("msimg32.dll") |
| 16 |
modgdi32 = windows.NewLazySystemDLL("gdi32.dll") |
| 17 |
moduser32 = windows.NewLazySystemDLL("user32.dll") |
| 18 |
|
| 19 |
procAlphaBlend = modmsimg32.NewProc("AlphaBlend") |
| 20 |
procBitBlt = modgdi32.NewProc("BitBlt") |
| 21 |
procCreateCompatibleBitmap = modgdi32.NewProc("CreateCompatibleBitmap") |
| 22 |
procCreateCompatibleDC = modgdi32.NewProc("CreateCompatibleDC") |
| 23 |
procCreateDIBSection = modgdi32.NewProc("CreateDIBSection") |
| 24 |
procCreateSolidBrush = modgdi32.NewProc("CreateSolidBrush") |
| 25 |
procDeleteDC = modgdi32.NewProc("DeleteDC") |
| 26 |
procDeleteObject = modgdi32.NewProc("DeleteObject") |
| 27 |
procFillRect = moduser32.NewProc("FillRect") |
| 28 |
procModifyWorldTransform = modgdi32.NewProc("ModifyWorldTransform") |
| 29 |
procSelectObject = modgdi32.NewProc("SelectObject") |
| 30 |
procSetGraphicsMode = modgdi32.NewProc("SetGraphicsMode") |
| 31 |
procSetWorldTransform = modgdi32.NewProc("SetWorldTransform") |
| 32 |
procStretchBlt = modgdi32.NewProc("StretchBlt") |
| 33 |
procGetDeviceCaps = modgdi32.NewProc("GetDeviceCaps") |
| 34 |
) |
| 35 |
|
| 36 |
func _AlphaBlend(dcdest syscall.Handle, xoriginDest int32, yoriginDest int32, wDest int32, hDest int32, dcsrc syscall.Handle, xoriginSrc int32, yoriginSrc int32, wsrc int32, hsrc int32, ftn uintptr) (err error) { |
| 37 |
r1, _, e1 := syscall.Syscall12(procAlphaBlend.Addr(), 11, uintptr(dcdest), uintptr(xoriginDest), uintptr(yoriginDest), uintptr(wDest), uintptr(hDest), uintptr(dcsrc), uintptr(xoriginSrc), uintptr(yoriginSrc), uintptr(wsrc), uintptr(hsrc), uintptr(ftn), 0) |
| 38 |
if r1 == 0 { |
| 39 |
if e1 != 0 { |
| 40 |
err = error(e1) |
| 41 |
} else { |
| 42 |
err = syscall.EINVAL |
| 43 |
} |
| 44 |
} |
| 45 |
return |
| 46 |
} |
| 47 |
|
| 48 |
func _BitBlt(dcdest syscall.Handle, xdest int32, ydest int32, width int32, height int32, dcsrc syscall.Handle, xsrc int32, ysrc int32, rop uint32) (err error) { |
| 49 |
r1, _, e1 := syscall.Syscall9(procBitBlt.Addr(), 9, uintptr(dcdest), uintptr(xdest), uintptr(ydest), uintptr(width), uintptr(height), uintptr(dcsrc), uintptr(xsrc), uintptr(ysrc), uintptr(rop)) |
| 50 |
if r1 == 0 { |
| 51 |
if e1 != 0 { |
| 52 |
err = error(e1) |
| 53 |
} else { |
| 54 |
err = syscall.EINVAL |
| 55 |
} |
| 56 |
} |
| 57 |
return |
| 58 |
} |
| 59 |
|
| 60 |
func _CreateCompatibleBitmap(dc syscall.Handle, width int32, height int32) (bitmap syscall.Handle, err error) { |
| 61 |
r0, _, e1 := syscall.Syscall(procCreateCompatibleBitmap.Addr(), 3, uintptr(dc), uintptr(width), uintptr(height)) |
| 62 |
bitmap = syscall.Handle(r0) |
| 63 |
if bitmap == 0 { |
| 64 |
if e1 != 0 { |
| 65 |
err = error(e1) |
| 66 |
} else { |
| 67 |
err = syscall.EINVAL |
| 68 |
} |
| 69 |
} |
| 70 |
return |
| 71 |
} |
| 72 |
|
| 73 |
func _CreateCompatibleDC(dc syscall.Handle) (newdc syscall.Handle, err error) { |
| 74 |
r0, _, e1 := syscall.Syscall(procCreateCompatibleDC.Addr(), 1, uintptr(dc), 0, 0) |
| 75 |
newdc = syscall.Handle(r0) |
| 76 |
if newdc == 0 { |
| 77 |
if e1 != 0 { |
| 78 |
err = error(e1) |
| 79 |
} else { |
| 80 |
err = syscall.EINVAL |
| 81 |
} |
| 82 |
} |
| 83 |
return |
| 84 |
} |
| 85 |
|
| 86 |
func _CreateDIBSection(dc syscall.Handle, bmi *_BITMAPINFO, usage uint32, bits **byte, section syscall.Handle, offset uint32) (bitmap syscall.Handle, err error) { |
| 87 |
r0, _, e1 := syscall.Syscall6(procCreateDIBSection.Addr(), 6, uintptr(dc), uintptr(unsafe.Pointer(bmi)), uintptr(usage), uintptr(unsafe.Pointer(bits)), uintptr(section), uintptr(offset)) |
| 88 |
bitmap = syscall.Handle(r0) |
| 89 |
if bitmap == 0 { |
| 90 |
if e1 != 0 { |
| 91 |
err = error(e1) |
| 92 |
} else { |
| 93 |
err = syscall.EINVAL |
| 94 |
} |
| 95 |
} |
| 96 |
return |
| 97 |
} |
| 98 |
|
| 99 |
func _CreateSolidBrush(color _COLORREF) (brush syscall.Handle, err error) { |
| 100 |
r0, _, e1 := syscall.Syscall(procCreateSolidBrush.Addr(), 1, uintptr(color), 0, 0) |
| 101 |
brush = syscall.Handle(r0) |
| 102 |
if brush == 0 { |
| 103 |
if e1 != 0 { |
| 104 |
err = error(e1) |
| 105 |
} else { |
| 106 |
err = syscall.EINVAL |
| 107 |
} |
| 108 |
} |
| 109 |
return |
| 110 |
} |
| 111 |
|
| 112 |
func _DeleteDC(dc syscall.Handle) (err error) { |
| 113 |
r1, _, e1 := syscall.Syscall(procDeleteDC.Addr(), 1, uintptr(dc), 0, 0) |
| 114 |
if r1 == 0 { |
| 115 |
if e1 != 0 { |
| 116 |
err = error(e1) |
| 117 |
} else { |
| 118 |
err = syscall.EINVAL |
| 119 |
} |
| 120 |
} |
| 121 |
return |
| 122 |
} |
| 123 |
|
| 124 |
func _DeleteObject(object syscall.Handle) (err error) { |
| 125 |
r1, _, e1 := syscall.Syscall(procDeleteObject.Addr(), 1, uintptr(object), 0, 0) |
| 126 |
if r1 == 0 { |
| 127 |
if e1 != 0 { |
| 128 |
err = error(e1) |
| 129 |
} else { |
| 130 |
err = syscall.EINVAL |
| 131 |
} |
| 132 |
} |
| 133 |
return |
| 134 |
} |
| 135 |
|
| 136 |
func _FillRect(dc syscall.Handle, rc *_RECT, brush syscall.Handle) (err error) { |
| 137 |
r1, _, e1 := syscall.Syscall(procFillRect.Addr(), 3, uintptr(dc), uintptr(unsafe.Pointer(rc)), uintptr(brush)) |
| 138 |
if r1 == 0 { |
| 139 |
if e1 != 0 { |
| 140 |
err = error(e1) |
| 141 |
} else { |
| 142 |
err = syscall.EINVAL |
| 143 |
} |
| 144 |
} |
| 145 |
return |
| 146 |
} |
| 147 |
|
| 148 |
func _ModifyWorldTransform(dc syscall.Handle, x *_XFORM, mode uint32) (err error) { |
| 149 |
r1, _, e1 := syscall.Syscall(procModifyWorldTransform.Addr(), 3, uintptr(dc), uintptr(unsafe.Pointer(x)), uintptr(mode)) |
| 150 |
if r1 == 0 { |
| 151 |
if e1 != 0 { |
| 152 |
err = error(e1) |
| 153 |
} else { |
| 154 |
err = syscall.EINVAL |
| 155 |
} |
| 156 |
} |
| 157 |
return |
| 158 |
} |
| 159 |
|
| 160 |
func _SelectObject(dc syscall.Handle, gdiobj syscall.Handle) (newobj syscall.Handle, err error) { |
| 161 |
r0, _, e1 := syscall.Syscall(procSelectObject.Addr(), 2, uintptr(dc), uintptr(gdiobj), 0) |
| 162 |
newobj = syscall.Handle(r0) |
| 163 |
if newobj == 0 { |
| 164 |
if e1 != 0 { |
| 165 |
err = error(e1) |
| 166 |
} else { |
| 167 |
err = syscall.EINVAL |
| 168 |
} |
| 169 |
} |
| 170 |
return |
| 171 |
} |
| 172 |
|
| 173 |
func _SetGraphicsMode(dc syscall.Handle, mode int32) (oldmode int32, err error) { |
| 174 |
r0, _, e1 := syscall.Syscall(procSetGraphicsMode.Addr(), 2, uintptr(dc), uintptr(mode), 0) |
| 175 |
oldmode = int32(r0) |
| 176 |
if oldmode == 0 { |
| 177 |
if e1 != 0 { |
| 178 |
err = error(e1) |
| 179 |
} else { |
| 180 |
err = syscall.EINVAL |
| 181 |
} |
| 182 |
} |
| 183 |
return |
| 184 |
} |
| 185 |
|
| 186 |
func _SetWorldTransform(dc syscall.Handle, x *_XFORM) (err error) { |
| 187 |
r1, _, e1 := syscall.Syscall(procSetWorldTransform.Addr(), 2, uintptr(dc), uintptr(unsafe.Pointer(x)), 0) |
| 188 |
if r1 == 0 { |
| 189 |
if e1 != 0 { |
| 190 |
err = error(e1) |
| 191 |
} else { |
| 192 |
err = syscall.EINVAL |
| 193 |
} |
| 194 |
} |
| 195 |
return |
| 196 |
} |
| 197 |
|
| 198 |
func _StretchBlt(dcdest syscall.Handle, xdest int32, ydest int32, wdest int32, hdest int32, dcsrc syscall.Handle, xsrc int32, ysrc int32, wsrc int32, hsrc int32, rop uint32) (err error) { |
| 199 |
r1, _, e1 := syscall.Syscall12(procStretchBlt.Addr(), 11, uintptr(dcdest), uintptr(xdest), uintptr(ydest), uintptr(wdest), uintptr(hdest), uintptr(dcsrc), uintptr(xsrc), uintptr(ysrc), uintptr(wsrc), uintptr(hsrc), uintptr(rop), 0) |
| 200 |
if r1 == 0 { |
| 201 |
if e1 != 0 { |
| 202 |
err = error(e1) |
| 203 |
} else { |
| 204 |
err = syscall.EINVAL |
| 205 |
} |
| 206 |
} |
| 207 |
return |
| 208 |
} |
| 209 |
|
| 210 |
func _GetDeviceCaps(dc syscall.Handle, index int32) (ret int32) { |
| 211 |
r0, _, _ := syscall.Syscall(procGetDeviceCaps.Addr(), 2, uintptr(dc), uintptr(index), 0) |
| 212 |
ret = int32(r0) |
| 213 |
return |
| 214 |
} |