[33] | 1 | ' Classes/System/Drawing/Graphics.ab
|
---|
| 2 |
|
---|
[635] | 3 | Namespace System
|
---|
| 4 | Namespace Drawing
|
---|
| 5 |
|
---|
[698] | 6 | Class ImageAttributes
|
---|
| 7 | Public
|
---|
| 8 | nativeImage As *GpImageAttributes
|
---|
| 9 | End Class
|
---|
| 10 | Class Region
|
---|
| 11 | Public
|
---|
| 12 | nativeRegion As *GpRegion
|
---|
| 13 | End Class
|
---|
| 14 | Class GraphicsPath
|
---|
| 15 | Public
|
---|
[701] | 16 | Sub GraphicsPath(native As *GpPath)
|
---|
| 17 | nativePath = native
|
---|
| 18 | End Sub
|
---|
| 19 | Function NativePath() As *GpPath
|
---|
| 20 | End Function
|
---|
[698] | 21 | nativePath As *GpPath
|
---|
| 22 | End Class
|
---|
| 23 | Class CachedBitmap
|
---|
| 24 | Public
|
---|
| 25 | nativeCachedBitmap As *GpCachedBitmap
|
---|
| 26 | End Class
|
---|
[104] | 27 |
|
---|
[700] | 28 | Delegate Function EnumerateMetafileProc(recordType As Imaging.EmfPlusRecordType, flags As DWord, dataSize As DWord, data As *Byte, callbackData As VoidPtr) As Boolean
|
---|
[698] | 29 |
|
---|
| 30 | Namespace Detail
|
---|
| 31 |
|
---|
[700] | 32 | TypeDef NativeEnumerateMetafileProc = *Function(recordType As Imaging.EmfPlusRecordType, flags As DWord, dataSize As DWord, data As *Byte, callbackData As VoidPtr) As Boolean
|
---|
[698] | 33 |
|
---|
| 34 | Type EnumerateMetafileProcData
|
---|
| 35 | Proc As EnumerateMetafileProc
|
---|
| 36 | Data As VoidPtr
|
---|
| 37 | End Type
|
---|
| 38 |
|
---|
[700] | 39 | Function NativeEnumerateMetafileProcEntry(recordType As Imaging.EmfPlusRecordType, flags As DWord, dataSize As DWord, data As *Byte, callbackData As VoidPtr) As Boolean
|
---|
[698] | 40 | Dim procData = callbackData As *EnumerateMetafileProcData
|
---|
| 41 | Dim proc = procData->Proc
|
---|
| 42 | NativeEnumerateMetafileProcEntry = proc(recordType, flags, dataSize, data, procData->Data)
|
---|
| 43 | End Function
|
---|
| 44 |
|
---|
| 45 | End Namespace
|
---|
| 46 |
|
---|
[33] | 47 | Class Graphics
|
---|
| 48 | Public
|
---|
| 49 | '=========================================================================
|
---|
| 50 | ' Properties
|
---|
| 51 | '=========================================================================
|
---|
| 52 | Const Function Clip() As Region
|
---|
[698] | 53 | Clip = New Region
|
---|
| 54 | SetStatus(GdipGetClip(nativeGraphics, Clip.nativeRegion))
|
---|
[33] | 55 | End Function
|
---|
| 56 |
|
---|
[698] | 57 | Sub Clip(region As Region)
|
---|
| 58 | Imports System.Drawing.Drawing2D
|
---|
| 59 | SetStatus(GdipSetClipRegion(nativeGraphics, region.nativeRegion, CombineMode.Replace))
|
---|
[33] | 60 | End Sub
|
---|
| 61 |
|
---|
| 62 | Const Function ClipBounds() As RectangleF
|
---|
[698] | 63 | SetStatus(GdipGetClipBounds(nativeGraphics, ClipBounds))
|
---|
[33] | 64 | End Function
|
---|
| 65 |
|
---|
[698] | 66 | Const Function ClipBoundsI() As Rectangle
|
---|
| 67 | SetStatus(GdipGetClipBoundsI(nativeGraphics, ClipBoundsI))
|
---|
[33] | 68 | End Function
|
---|
[698] | 69 | /*
|
---|
| 70 | Const Function CompositingMode() As Drawing2D.CompositingMode
|
---|
| 71 | SetStatus(GdipGetCompositingMode(nativeGraphics, CompositingMode))
|
---|
| 72 | End Function
|
---|
[33] | 73 |
|
---|
[698] | 74 | Sub CompositingMode(mode As Drawing2D.CompositingMode)
|
---|
| 75 | SetStatus(GdipSetCompositingMode(nativeGraphics, mode))
|
---|
[33] | 76 | End Sub
|
---|
| 77 |
|
---|
[698] | 78 | Function CompositingQuality() As Drawing2D.CompositingQuality
|
---|
| 79 | SetStatus(GdipGetCompositingQuality(nativeGraphics, CompositingQuality))
|
---|
[33] | 80 | End Function
|
---|
| 81 |
|
---|
[698] | 82 | Sub CompositingQuality(cq As Drawing2D.CompositingQuality)
|
---|
| 83 | Return SetStatus(GdipSetCompositingQuality(nativeGraphics, cq))
|
---|
[33] | 84 | End Sub
|
---|
[698] | 85 | */
|
---|
[33] | 86 | Const Function DpiX() As Single
|
---|
[698] | 87 | SetStatus(GdipGetDpiX(nativeGraphics, DpiX))
|
---|
[33] | 88 | End Function
|
---|
| 89 |
|
---|
| 90 | Const Function DpiY() As Single
|
---|
[698] | 91 | SetStatus(GdipGetDpiY(nativeGraphics, DpiY))
|
---|
[33] | 92 | End Function
|
---|
[698] | 93 | /*
|
---|
| 94 | Const Function InterpolationMode() As Drawing2D.InterpolationMode
|
---|
| 95 | SetStatus(GdipGetInterpolationMode(nativeGraphics, InterpolationMode))
|
---|
[33] | 96 | End Function
|
---|
| 97 |
|
---|
[698] | 98 | Sub InterpolationMode(im As Drawing2D.InterpolationMode)
|
---|
| 99 | InterpolationMode = SetStatus(GdipSetInterpolationMode(nativeGraphics, im))
|
---|
[33] | 100 | End Sub
|
---|
[698] | 101 | */
|
---|
| 102 | Const Function IsClipEmpty() As Boolean
|
---|
[33] | 103 | Dim b = FALSE As BOOL
|
---|
| 104 | SetStatus(GdipIsClipEmpty(nativeGraphics, b))
|
---|
[698] | 105 | IsClipEmpty = b As Boolean
|
---|
[33] | 106 | End Function
|
---|
| 107 |
|
---|
[698] | 108 | Const Function IsVisibleClipEmpty() As Boolean
|
---|
[33] | 109 | Dim b = FALSE As BOOL
|
---|
| 110 | SetStatus(GdipIsVisibleClipEmpty(nativeGraphics, b))
|
---|
[698] | 111 | IsVisibleClipEmpty = b As Boolean
|
---|
[33] | 112 | End Function
|
---|
| 113 |
|
---|
[698] | 114 | Sub PageScale(scale As Single)
|
---|
| 115 | SetStatus(GdipSetPageScale(nativeGraphics, scale))
|
---|
| 116 | End Sub
|
---|
[33] | 117 |
|
---|
| 118 | Const Function PageScale() As Single
|
---|
[698] | 119 | SetStatus(GdipGetPageScale(nativeGraphics, PageScale))
|
---|
[33] | 120 | End Function
|
---|
[698] | 121 | /*
|
---|
[33] | 122 | Const Function PageUnit() As GraphicsUnit
|
---|
[698] | 123 | SetStatus(GdipGetPageUnit(nativeGraphics, PageUnit))
|
---|
[33] | 124 | End Function
|
---|
[698] | 125 | */
|
---|
| 126 | Sub PageUnit(unit As GraphicsUnit)
|
---|
| 127 | SetStatus(GdipSetPageUnit(nativeGraphics, unit))
|
---|
| 128 | End Sub
|
---|
| 129 | /*
|
---|
| 130 | Function PixelOffsetMode() As Drawing2D.PixelOffsetMode
|
---|
| 131 | PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.Invalid
|
---|
| 132 | SetStatus(GdipGetPixelOffsetMode(nativeGraphics, PixelOffsetMode))
|
---|
[33] | 133 | End Function
|
---|
[698] | 134 | */
|
---|
| 135 | Sub PixelOffsetMode(mode As Drawing2D.PixelOffsetMode)
|
---|
| 136 | SetStatus(GdipSetPixelOffsetMode(nativeGraphics, mode))
|
---|
[33] | 137 | End Sub
|
---|
| 138 |
|
---|
| 139 | Function RenderingOrigin() As Point
|
---|
[698] | 140 | With RenderingOrigin
|
---|
| 141 | .X = 0
|
---|
| 142 | .Y = 0
|
---|
| 143 | SetStatus(GdipGetRenderingOrigin(nativeGraphics, .X, .Y))
|
---|
| 144 | End With
|
---|
[33] | 145 | End Function
|
---|
| 146 |
|
---|
| 147 | Sub RenderingOrigin(pt As Point)
|
---|
[698] | 148 | SetStatus(GdipSetRenderingOrigin(nativeGraphics, pt.X, pt.Y))
|
---|
[33] | 149 | End Sub
|
---|
[698] | 150 | /*
|
---|
| 151 | Function SmoothingMode() As Drawing2D.SmoothingMode
|
---|
| 152 | SetStatus(GdipGetSmoothingMode(nativeGraphics, SmoothingMode))
|
---|
[33] | 153 | End Function
|
---|
[698] | 154 | */
|
---|
| 155 | Sub SmoothingMode(mode As Drawing2D.SmoothingMode)
|
---|
| 156 | SetStatus(GdipSetSmoothingMode(nativeGraphics, mode))
|
---|
[33] | 157 | End Sub
|
---|
| 158 |
|
---|
| 159 | Function TextContrast() As DWord
|
---|
[698] | 160 | SetStatus(GdipGetTextContrast(nativeGraphics, TextContrast))
|
---|
[33] | 161 | End Function
|
---|
| 162 |
|
---|
| 163 | Sub TextContrast(contrast As DWord)
|
---|
[698] | 164 | SetStatus(GdipSetTextContrast(nativeGraphics, contrast))
|
---|
[33] | 165 | End Sub
|
---|
[698] | 166 | /*
|
---|
| 167 | Function TextRenderingHint() As Text.TextRenderingHint
|
---|
| 168 | SetStatus(GdipGetTextRenderingHint(nativeGraphics, ByVal VarPtr(TextRenderingHint)))
|
---|
[33] | 169 | End Function
|
---|
[698] | 170 | */
|
---|
[33] | 171 | Sub TextRenderingHint(mode As TextRenderingHint)
|
---|
[698] | 172 | SetStatus(GdipSetTextRenderingHint(nativeGraphics, mode))
|
---|
[33] | 173 | End Sub
|
---|
| 174 |
|
---|
[698] | 175 | Function Transform() As Drawing2D.Matrix
|
---|
| 176 | Dim native As *GpMatrix
|
---|
| 177 | SetStatus(GdipGetWorldTransform(nativeGraphics, native))
|
---|
| 178 | Transform = New Drawing2D.Matrix(native)
|
---|
[33] | 179 | End Function
|
---|
| 180 |
|
---|
[698] | 181 | Sub Transform(matrix As Drawing2D.Matrix)
|
---|
| 182 | SetStatus(GdipSetWorldTransform(nativeGraphics, matrix.nativeMatrix))
|
---|
[33] | 183 | End Sub
|
---|
| 184 |
|
---|
| 185 | Function VisibleClipBounds() As RectangleF
|
---|
[698] | 186 | SetStatus(GdipGetVisibleClipBounds(nativeGraphics, VisibleClipBounds))
|
---|
[33] | 187 | End Function
|
---|
| 188 |
|
---|
[698] | 189 | Function VisibleClipBoundsI() As Rectangle
|
---|
| 190 | SetStatus(GdipGetVisibleClipBoundsI(nativeGraphics, VisibleClipBoundsI))
|
---|
| 191 | End Function
|
---|
| 192 |
|
---|
[33] | 193 | '=========================================================================
|
---|
| 194 | ' Methods
|
---|
| 195 | '=========================================================================
|
---|
[212] | 196 | Static Function FromHDC(hdc As HDC) As Graphics
|
---|
[698] | 197 | Dim graphics = 0 As *GpGraphics
|
---|
| 198 | SetStatus(GdipCreateFromHDC(hdc, graphics))
|
---|
| 199 | Return New Graphics(graphics)
|
---|
[33] | 200 | End Function
|
---|
| 201 |
|
---|
[212] | 202 | Static Function FromHDC(hdc As HDC, hdevice As HANDLE) As Graphics
|
---|
[698] | 203 | Dim graphics = 0 As *GpGraphics
|
---|
| 204 | SetStatus(GdipCreateFromHDC2(hdc, hdevice, graphics))
|
---|
| 205 | Return New Graphics(graphics)
|
---|
[33] | 206 | End Function
|
---|
| 207 |
|
---|
[698] | 208 | Static Function FromHwnd(hwnd As HWND) As Graphics
|
---|
| 209 | Dim graphics = 0 As *GpGraphics
|
---|
| 210 | SetStatus(GdipCreateFromHWND(hwnd, graphics))
|
---|
| 211 | Return New Graphics(graphics)
|
---|
[33] | 212 | End Function
|
---|
| 213 |
|
---|
[698] | 214 | Static Function FromHwnd(hwnd As HWND, icm As Boolean) As Graphics
|
---|
| 215 | Dim graphics = 0 As *GpGraphics
|
---|
| 216 | If icm Then
|
---|
| 217 | SetStatus(GdipCreateFromHWNDICM(hwnd, graphics))
|
---|
| 218 | Else
|
---|
| 219 | SetStatus(GdipCreateFromHWND(hwnd, graphics))
|
---|
| 220 | End If
|
---|
| 221 | Return New Graphics(graphics)
|
---|
[33] | 222 | End Function
|
---|
| 223 |
|
---|
[212] | 224 | Static Function FromImage(image As Image) As Graphics
|
---|
[698] | 225 | If ActiveBasic.IsNothing(image) Then
|
---|
| 226 | Throw New ArgumentNullException("image")
|
---|
| 227 | End If
|
---|
| 228 | Dim graphics = 0 As *GpGraphics
|
---|
[703] | 229 | SetStatus(GdipGetImageGraphicsContext(image.NativeImage, graphics))
|
---|
[698] | 230 | Return New Graphics(graphics)
|
---|
[33] | 231 | End Function
|
---|
| 232 |
|
---|
[698] | 233 | Sub Dispose()
|
---|
| 234 | GdipDeleteGraphics(nativeGraphics)
|
---|
| 235 | nativeGraphics = 0
|
---|
[33] | 236 | End Sub
|
---|
| 237 |
|
---|
| 238 | Sub ~Graphics()
|
---|
[698] | 239 | Dispose()
|
---|
[33] | 240 | End Sub
|
---|
| 241 |
|
---|
| 242 | Sub Flush()
|
---|
[698] | 243 | GdipFlush(nativeGraphics, System.Drawing.Drawing2D.FlushIntention.Flush)
|
---|
[33] | 244 | End Sub
|
---|
| 245 |
|
---|
[698] | 246 | Sub Flush(intention As Drawing2D.FlushIntention)
|
---|
[33] | 247 | GdipFlush(nativeGraphics, intention)
|
---|
| 248 | End Sub
|
---|
| 249 |
|
---|
| 250 | Function GetHDC() As HDC
|
---|
[698] | 251 | GetHDC = 0
|
---|
| 252 | SetStatus(GdipGetDC(nativeGraphics, GetHDC))
|
---|
[33] | 253 | End Function
|
---|
| 254 |
|
---|
| 255 | Sub ReleaseHDC(hdc As HDC)
|
---|
| 256 | SetStatus(GdipReleaseDC(nativeGraphics, hdc))
|
---|
| 257 | End Sub
|
---|
| 258 |
|
---|
[698] | 259 | Sub ResetTransform()
|
---|
| 260 | SetStatus(GdipResetWorldTransform(nativeGraphics))
|
---|
| 261 | End Sub
|
---|
[33] | 262 |
|
---|
[698] | 263 | Sub MultiplyTransform(matrix As Drawing2D.Matrix)
|
---|
| 264 | SetStatus(GdipMultiplyWorldTransform(nativeGraphics, matrix.nativeMatrix, System.Drawing.Drawing2D.MatrixOrder.Prepend))
|
---|
| 265 | End Sub
|
---|
[33] | 266 |
|
---|
[698] | 267 | Sub MultiplyTransform(matrix As Drawing2D.Matrix, order As Drawing2D.MatrixOrder)
|
---|
| 268 | SetStatus(GdipMultiplyWorldTransform(nativeGraphics, matrix.nativeMatrix, order))
|
---|
| 269 | End Sub
|
---|
[33] | 270 |
|
---|
[698] | 271 | Sub TranslateTransform(dx As Single, dy As Single)
|
---|
| 272 | SetStatus(GdipTranslateWorldTransform(nativeGraphics, dx, dy, System.Drawing.Drawing2D.MatrixOrder.Prepend))
|
---|
| 273 | End Sub
|
---|
[33] | 274 |
|
---|
[698] | 275 | Sub TranslateTransform(dx As Single, dy As Single, order As Drawing2D.MatrixOrder)
|
---|
| 276 | SetStatus(GdipTranslateWorldTransform(nativeGraphics, dx, dy, order))
|
---|
| 277 | End Sub
|
---|
[33] | 278 |
|
---|
[698] | 279 | Sub ScaleTransform(sx As Single, sy As Single)
|
---|
| 280 | SetStatus(GdipScaleWorldTransform(nativeGraphics, sx, sy, System.Drawing.Drawing2D.MatrixOrder.Prepend))
|
---|
| 281 | End Sub
|
---|
[33] | 282 |
|
---|
[698] | 283 | Sub ScaleTransform(sx As Single, sy As Single, order As Drawing2D.MatrixOrder)
|
---|
| 284 | SetStatus(GdipScaleWorldTransform(nativeGraphics, sx, sy, order))
|
---|
| 285 | End Sub
|
---|
[33] | 286 |
|
---|
[698] | 287 | Sub RotateTransform(angle As Single)
|
---|
| 288 | SetStatus(GdipRotateWorldTransform(nativeGraphics, angle, System.Drawing.Drawing2D.MatrixOrder.Prepend))
|
---|
| 289 | End Sub
|
---|
[33] | 290 |
|
---|
[698] | 291 | Sub RotateTransform(angle As Single, order As Drawing2D.MatrixOrder)
|
---|
| 292 | SetStatus(GdipRotateWorldTransform(nativeGraphics, angle, order))
|
---|
| 293 | End Sub
|
---|
[33] | 294 |
|
---|
[698] | 295 | Sub TransformPoints(destSpace As Drawing2D.CoordinateSpace, srcSpace As Drawing2D.CoordinateSpace, pts As *PointF, count As Long)
|
---|
| 296 | SetStatus(GdipTransformPoints(nativeGraphics, destSpace, srcSpace, pts, count))
|
---|
| 297 | End Sub
|
---|
[33] | 298 |
|
---|
[698] | 299 | Sub TransformPoints(destSpace As Drawing2D.CoordinateSpace, srcSpace As Drawing2D.CoordinateSpace, pts As *Point, count As Long)
|
---|
| 300 | SetStatus(GdipTransformPointsI(nativeGraphics, destSpace, srcSpace, pts, count))
|
---|
| 301 | End Sub
|
---|
[33] | 302 |
|
---|
[698] | 303 | Const Function GetNearestColor(color As Color) As Color
|
---|
| 304 | GetNearestColor = color
|
---|
| 305 | SetStatus(GdipGetNearestColor(nativeGraphics, GetNearestColor))
|
---|
[33] | 306 | End Function
|
---|
| 307 |
|
---|
[698] | 308 | Sub DrawLine(pen As Pen, x1 As Single, y1 As Single, x2 As Single, y2 As Single)
|
---|
| 309 | SetStatus(GdipDrawLine(nativeGraphics, pen.NativePen, x1, y1, x2, y2))
|
---|
| 310 | End Sub
|
---|
[33] | 311 |
|
---|
[698] | 312 | Sub DrawLine(pen As Pen, ByRef pt1 As PointF, ByRef pt2 As PointF)
|
---|
| 313 | DrawLine(pen, pt1.X, pt1.Y, pt2.X, pt2.Y)
|
---|
| 314 | End Sub
|
---|
[33] | 315 |
|
---|
[698] | 316 | Sub DrawLines(pen As Pen, points As *PointF, count As Long)
|
---|
| 317 | SetStatus(GdipDrawLines(nativeGraphics, pen.NativePen, points, count))
|
---|
| 318 | End Sub
|
---|
[33] | 319 |
|
---|
[698] | 320 | Sub DrawLine(pen As Pen, x1 As Long, y1 As Long, x2 As Long, y2 As Long)
|
---|
| 321 | SetStatus(GdipDrawLineI(nativeGraphics, pen.NativePen, x1, y1, x2, y2))
|
---|
| 322 | End Sub
|
---|
[33] | 323 |
|
---|
[698] | 324 | Sub DrawLine(pen As Pen, ByRef pt1 As Point, ByRef pt2 As Point)
|
---|
| 325 | DrawLine(pen, pt1.X, pt1.Y, pt2.X, pt2.Y)
|
---|
| 326 | End Sub
|
---|
[33] | 327 |
|
---|
[698] | 328 | Sub DrawLines(pen As Pen, points As *Point, count As Long)
|
---|
| 329 | SetStatus(GdipDrawLinesI(nativeGraphics, pen.NativePen, points, count))
|
---|
| 330 | End Sub
|
---|
[33] | 331 |
|
---|
[698] | 332 | Sub DrawArc(pen As Pen, x As Single, y As Single, width As Single, height As Single, startAngle As Single, sweepAngle As Single)
|
---|
| 333 | SetStatus(GdipDrawArc(nativeGraphics, pen.NativePen, x, y, width, height, startAngle, sweepAngle))
|
---|
| 334 | End Sub
|
---|
[33] | 335 |
|
---|
[698] | 336 | Sub DrawArc(pen As Pen, ByRef rect As RectangleF, startAngle As Single, sweepAngle As Single)
|
---|
| 337 | DrawArc(pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle)
|
---|
| 338 | End Sub
|
---|
[33] | 339 |
|
---|
[698] | 340 | Sub DrawArc(pen As Pen, x As Long, y As Long, width As Long, height As Long, startAngle As Single, sweepAngle As Single)
|
---|
| 341 | SetStatus(GdipDrawArcI(nativeGraphics, pen.NativePen, x, y, width, height, startAngle, sweepAngle))
|
---|
| 342 | End Sub
|
---|
[33] | 343 |
|
---|
[698] | 344 | Sub DrawArc(pen As Pen, ByRef rect As Rectangle, startAngle As Single, sweepAngle As Single)
|
---|
| 345 | DrawArc(pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle)
|
---|
| 346 | End Sub
|
---|
[33] | 347 |
|
---|
[698] | 348 | Sub DrawBezier(pen As Pen, x1 As Single, y1 As Single, x2 As Single, y2 As Single, x3 As Single, y3 As Single, x4 As Single, y4 As Single)
|
---|
| 349 | SetStatus(GdipDrawBezier(nativeGraphics, pen.NativePen, x1, y1,x2, y2, x3, y3, x4, y4))
|
---|
| 350 | End Sub
|
---|
[33] | 351 |
|
---|
[698] | 352 | Sub DrawBezier(pen As Pen, ByRef pt1 As PointF, ByRef pt2 As PointF, ByRef pt3 As PointF, ByRef pt4 As PointF)
|
---|
| 353 | DrawBezier(pen, pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y)
|
---|
| 354 | End Sub
|
---|
[33] | 355 |
|
---|
[698] | 356 | Sub DrawBeziers(pen As Pen, points As *PointF, count As Long)
|
---|
| 357 | SetStatus(GdipDrawBeziers(nativeGraphics, pen.NativePen, points, count))
|
---|
| 358 | End Sub
|
---|
[33] | 359 |
|
---|
[698] | 360 | Sub DrawBezier(pen As Pen, x1 As Long, y1 As Long, x2 As Long, y2 As Long, x3 As Long, y3 As Long, x4 As Long, y4 As Long)
|
---|
| 361 | SetStatus(GdipDrawBezierI(nativeGraphics, pen.NativePen, x1, y1, x2, y2, x3, y3, x4, y4))
|
---|
| 362 | End Sub
|
---|
[33] | 363 |
|
---|
[698] | 364 | Sub DrawBezier(pen As Pen, ByRef pt1 As Point, ByRef pt2 As Point, ByRef pt3 As Point, ByRef pt4 As Point)
|
---|
| 365 | DrawBezier(pen, pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y)
|
---|
| 366 | End Sub
|
---|
[33] | 367 |
|
---|
[698] | 368 | Sub DrawBeziers(pen As Pen, points As *Point, count As Long)
|
---|
| 369 | SetStatus(GdipDrawBeziersI(nativeGraphics, pen.NativePen, points, count))
|
---|
| 370 | End Sub
|
---|
[33] | 371 |
|
---|
[698] | 372 | Sub DrawRectangle(pen As Pen, ByRef rect As RectangleF)
|
---|
| 373 | DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height)
|
---|
| 374 | End Sub
|
---|
[33] | 375 |
|
---|
[698] | 376 | Sub DrawRectangle(pen As Pen, x As Single, y As Single, width As Single, height As Single)
|
---|
| 377 | SetStatus(GdipDrawRectangle(nativeGraphics, pen.NativePen, x, y, width, height))
|
---|
| 378 | End Sub
|
---|
[33] | 379 |
|
---|
[698] | 380 | Sub DrawRectangles(pen As Pen, rects As *RectangleF, count As Long)
|
---|
| 381 | SetStatus(GdipDrawRectangles(nativeGraphics, pen.NativePen, rects, count))
|
---|
| 382 | End Sub
|
---|
[33] | 383 |
|
---|
[698] | 384 | Sub DrawRectangle(pen As Pen, ByRef rect As Rectangle)
|
---|
| 385 | DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height)
|
---|
| 386 | End Sub
|
---|
[33] | 387 |
|
---|
[698] | 388 | Sub DrawRectangle(pen As Pen, x As Long, y As Long, width As Long, height As Long)
|
---|
| 389 | SetStatus(GdipDrawRectangleI(nativeGraphics, pen.NativePen, x, y, width, height))
|
---|
| 390 | End Sub
|
---|
[33] | 391 |
|
---|
[698] | 392 | Sub DrawRectangles(pen As Pen, rects As *Rectangle, count As Long)
|
---|
| 393 | SetStatus(GdipDrawRectanglesI(nativeGraphics, pen.NativePen, rects, count))
|
---|
| 394 | End Sub
|
---|
[33] | 395 |
|
---|
[698] | 396 | Sub DrawEllipse(pen As Pen, ByRef rect As RectangleF)
|
---|
| 397 | DrawEllipse(pen, rect.X, rect.Y, rect.Width, rect.Height)
|
---|
| 398 | End Sub
|
---|
[33] | 399 |
|
---|
[698] | 400 | Sub DrawEllipse(pen As Pen, x As Single, y As Single, width As Single, height As Single)
|
---|
| 401 | SetStatus(GdipDrawEllipse(nativeGraphics, pen.NativePen, x, y, width, height))
|
---|
| 402 | End Sub
|
---|
[33] | 403 |
|
---|
[698] | 404 | Sub DrawEllipse(pen As Pen, ByRef rect As Rectangle)
|
---|
| 405 | DrawEllipse(pen, rect.X, rect.Y, rect.Width, rect.Height)
|
---|
| 406 | End Sub
|
---|
[33] | 407 |
|
---|
[698] | 408 | Sub DrawEllipse(pen As Pen, x As Long, y As Long, width As Long, height As Long)
|
---|
| 409 | SetStatus(GdipDrawEllipseI(nativeGraphics, pen.NativePen, x, y, width, height))
|
---|
| 410 | End Sub
|
---|
[33] | 411 |
|
---|
[698] | 412 | Sub DrawPie(pen As Pen, ByRef rect As RectangleF, startAngle As Single, sweepAngle As Single)
|
---|
| 413 | DrawPie(pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle)
|
---|
| 414 | End Sub
|
---|
[33] | 415 |
|
---|
[698] | 416 | Sub DrawPie(pen As Pen, x As Single, y As Single, width As Single, height As Single, startAngle As Single, sweepAngle As Single)
|
---|
| 417 | SetStatus(GdipDrawPie(nativeGraphics, pen.NativePen, x, y, width, height, startAngle, sweepAngle))
|
---|
| 418 | End Sub
|
---|
[33] | 419 |
|
---|
[698] | 420 | Sub DrawPie(pen As Pen, ByRef rect As Rectangle, startAngle As Single, sweepAngle As Single)
|
---|
| 421 | DrawPie(pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle)
|
---|
| 422 | End Sub
|
---|
[33] | 423 |
|
---|
[698] | 424 | Sub DrawPie(pen As Pen, x As Long, y As Long, width As Long, height As Long, startAngle As Single, sweepAngle As Single)
|
---|
| 425 | SetStatus(GdipDrawPieI(nativeGraphics, pen.NativePen, x, y, width, height, startAngle, sweepAngle))
|
---|
| 426 | End Sub
|
---|
[33] | 427 |
|
---|
[698] | 428 | Sub DrawPolygon(pen As Pen, points As *PointF, count As Long)
|
---|
| 429 | SetStatus(GdipDrawPolygon(nativeGraphics, pen.NativePen, points, count))
|
---|
| 430 | End Sub
|
---|
[33] | 431 |
|
---|
[698] | 432 | Sub DrawPolygon(pen As Pen, points As *Point, count As Long)
|
---|
| 433 | SetStatus(GdipDrawPolygonI(nativeGraphics, pen.NativePen, points, count))
|
---|
| 434 | End Sub
|
---|
[33] | 435 |
|
---|
[698] | 436 | Sub DrawPath(pen As Pen, path As GraphicsPath)
|
---|
| 437 | If ActiveBasic.IsNothing(pen) Or ActiveBasic.IsNothing(path) Then
|
---|
| 438 | Throw New ArgumentNullException("pen or path or both")
|
---|
| 439 | End If
|
---|
| 440 | SetStatus(GdipDrawPath(nativeGraphics, pen.NativePen, path.nativePath))
|
---|
| 441 | End Sub
|
---|
[33] | 442 |
|
---|
[698] | 443 | Sub DrawCurve(pen As Pen, points As *PointF, count As Long)
|
---|
| 444 | SetStatus(GdipDrawCurve(nativeGraphics, pen.NativePen, points, count))
|
---|
| 445 | End Sub
|
---|
[33] | 446 |
|
---|
[698] | 447 | Sub DrawCurve(pen As Pen, points As *PointF, count As Long, tension As Single)
|
---|
| 448 | SetStatus(GdipDrawCurve2(nativeGraphics, pen.NativePen, points,count, tension))
|
---|
| 449 | End Sub
|
---|
[33] | 450 |
|
---|
[698] | 451 | Sub DrawCurve(pen As Pen, points As *PointF, count As Long, offset As Long, numberOfSegments As Long)
|
---|
| 452 | SetStatus(GdipDrawCurve3(nativeGraphics, pen.NativePen, points, count, offset,numberOfSegments, 0.5))
|
---|
| 453 | End Sub
|
---|
[33] | 454 |
|
---|
[698] | 455 | Sub DrawCurve(pen As Pen, points As *PointF, count As Long, offset As Long, numberOfSegments As Long, tension As Single)
|
---|
| 456 | SetStatus(GdipDrawCurve3(nativeGraphics, pen.NativePen, points, count, offset,numberOfSegments, tension))
|
---|
| 457 | End Sub
|
---|
[33] | 458 |
|
---|
[698] | 459 | Sub DrawCurve(pen As Pen, points As *Point, count As Long)
|
---|
| 460 | SetStatus(GdipDrawCurveI(nativeGraphics, pen.NativePen, points, count))
|
---|
| 461 | End Sub
|
---|
[33] | 462 |
|
---|
[698] | 463 | Sub DrawCurve(pen As Pen, points As *Point, count As Long, tension As Single)
|
---|
| 464 | SetStatus(GdipDrawCurve2I(nativeGraphics, pen.NativePen, points, count, tension))
|
---|
| 465 | End Sub
|
---|
[33] | 466 |
|
---|
[698] | 467 | Sub DrawCurve(pen As Pen, points As *Point, count As Long, offset As Long, numberOfSegments As Long)
|
---|
| 468 | SetStatus(GdipDrawCurve3I(nativeGraphics, pen.NativePen, points, count, offset, numberOfSegments, 0.5))
|
---|
| 469 | End Sub
|
---|
[33] | 470 |
|
---|
[698] | 471 | Sub DrawCurve(pen As Pen, points As *Point, count As Long, offset As Long, numberOfSegments As Long, tension As Single)
|
---|
| 472 | SetStatus(GdipDrawCurve3I(nativeGraphics, pen.NativePen, points, count, offset, numberOfSegments, tension))
|
---|
| 473 | End Sub
|
---|
[33] | 474 |
|
---|
[698] | 475 | Sub DrawClosedCurve(pen As Pen, points As *PointF, count As Long)
|
---|
| 476 | SetStatus(GdipDrawClosedCurve(nativeGraphics, pen.NativePen, points, count))
|
---|
| 477 | End Sub
|
---|
[33] | 478 |
|
---|
[698] | 479 | Sub DrawClosedCurve(pen As Pen, points As *PointF, count As Long, tension As Single)
|
---|
| 480 | SetStatus(GdipDrawClosedCurve2(nativeGraphics, pen.NativePen, points, count, tension))
|
---|
| 481 | End Sub
|
---|
[33] | 482 |
|
---|
[698] | 483 | Sub DrawClosedCurve(pen As Pen, points As *Point, count As Long)
|
---|
| 484 | SetStatus(GdipDrawClosedCurveI(nativeGraphics, pen.NativePen, points, count))
|
---|
| 485 | End Sub
|
---|
[33] | 486 |
|
---|
[698] | 487 | Sub DrawClosedCurve(pen As Pen, points As *Point, count As Long, tension As Single)
|
---|
| 488 | SetStatus(GdipDrawClosedCurve2I(nativeGraphics, pen.NativePen, points, count, tension))
|
---|
| 489 | End Sub
|
---|
[33] | 490 |
|
---|
[698] | 491 | Sub Clear(color As Color)
|
---|
| 492 | SetStatus(GdipGraphicsClear(nativeGraphics, color))
|
---|
| 493 | End Sub
|
---|
[33] | 494 |
|
---|
[698] | 495 | Sub FillRectangle(brush As Brush, ByRef rect As RectangleF)
|
---|
| 496 | FillRectangle(brush, rect.X, rect.Y, rect.Width, rect.Height)
|
---|
| 497 | End Sub
|
---|
[33] | 498 |
|
---|
[698] | 499 | Sub FillRectangle(brush As Brush, x As Single, y As Single, width As Single, height As Single)
|
---|
[701] | 500 | SetStatus(GdipFillRectangle(nativeGraphics, brush.NativeBrush, x, y, width, height))
|
---|
[698] | 501 | End Sub
|
---|
[33] | 502 |
|
---|
[698] | 503 | Sub FillRectangles(brush As Brush, rects As *RectangleF, count As Long)
|
---|
[701] | 504 | SetStatus(GdipFillRectangles(nativeGraphics,brush.NativeBrush,rects, count))
|
---|
[698] | 505 | End Sub
|
---|
[33] | 506 |
|
---|
[698] | 507 | Sub FillRectangle(brush As Brush, ByRef rect As Rectangle)
|
---|
| 508 | FillRectangle(brush, rect.X, rect.Y, rect.Width, rect.Height)
|
---|
| 509 | End Sub
|
---|
[33] | 510 |
|
---|
[698] | 511 | Sub FillRectangle(brush As Brush, x As Long, y As Long, width As Long, height As Long)
|
---|
[701] | 512 | SetStatus(GdipFillRectangleI(nativeGraphics, brush.NativeBrush, x, y, width, height))
|
---|
[698] | 513 | End Sub
|
---|
[33] | 514 |
|
---|
[698] | 515 | Sub FillRectangles(brush As Brush, rects As *Rectangle, count As Long)
|
---|
[701] | 516 | SetStatus(GdipFillRectanglesI(nativeGraphics, brush.NativeBrush, rects, count))
|
---|
[698] | 517 | End Sub
|
---|
[33] | 518 |
|
---|
[698] | 519 | ' Sub FillPolygon(brush As Brush, points As *PointF, count As Long)
|
---|
| 520 | ' FillPolygon(brush, points, count, System.Drawing.Drawing2D.FillMode.Alternate)
|
---|
| 521 | ' End Sub
|
---|
[33] | 522 |
|
---|
[698] | 523 | Sub FillPolygon(brush As Brush, points As *PointF, count As Long, fillMode As Drawing2D.FillMode)
|
---|
[701] | 524 | SetStatus(GdipFillPolygon(nativeGraphics, brush.NativeBrush, points, count, fillMode))
|
---|
[698] | 525 | End Sub
|
---|
[33] | 526 |
|
---|
[698] | 527 | ' Sub FillPolygon(brush As Brush, points As *Point, count As Long)
|
---|
| 528 | ' FillPolygon(brush, points, count, System.Drawing.Drawing2D.FillMode.Alternate)
|
---|
| 529 | ' End Sub
|
---|
[33] | 530 |
|
---|
[698] | 531 | Sub FillPolygon(brush As Brush, points As *Point, count As Long, fillMode As Drawing2D.FillMode)
|
---|
[701] | 532 | SetStatus(GdipFillPolygonI(nativeGraphics, brush.NativeBrush, points, count, fillMode))
|
---|
[698] | 533 | End Sub
|
---|
[33] | 534 |
|
---|
[698] | 535 | Sub FillEllipse(brush As Brush, ByRef rect As RectangleF)
|
---|
| 536 | FillEllipse(brush, rect.X, rect.Y, rect.Width, rect.Height)
|
---|
| 537 | End Sub
|
---|
[33] | 538 |
|
---|
[698] | 539 | Sub FillEllipse(brush As Brush, x As Single, y As Single, width As Single, height As Single)
|
---|
[701] | 540 | SetStatus(GdipFillEllipse(nativeGraphics, brush.NativeBrush, x, y, width, height))
|
---|
[698] | 541 | End Sub
|
---|
[33] | 542 |
|
---|
[698] | 543 | Sub FillEllipse(brush As Brush, ByRef rect As Rectangle)
|
---|
| 544 | FillEllipse(brush, rect.X, rect.Y, rect.Width, rect.Height)
|
---|
| 545 | End Sub
|
---|
[33] | 546 |
|
---|
[698] | 547 | Sub FillEllipse(brush As Brush, x As Long, y As Long, width As Long, height As Long)
|
---|
[701] | 548 | SetStatus(GdipFillEllipseI(nativeGraphics, brush.NativeBrush, x, y, width, height))
|
---|
[698] | 549 | End Sub
|
---|
[33] | 550 |
|
---|
[698] | 551 | Sub FillPie(brush As Brush, ByRef rect As RectangleF, startAngle As Single, sweepAngle As Single)
|
---|
| 552 | FillPie(brush, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle)
|
---|
| 553 | End Sub
|
---|
[33] | 554 |
|
---|
[698] | 555 | Sub FillPie(brush As Brush, x As Single, y As Single, width As Single, height As Single, startAngle As Single, sweepAngle As Single)
|
---|
[701] | 556 | SetStatus(GdipFillPie(nativeGraphics, brush.NativeBrush, x, y, width, height, startAngle, sweepAngle))
|
---|
[698] | 557 | End Sub
|
---|
[33] | 558 |
|
---|
[698] | 559 | Sub FillPie(brush As Brush, ByRef rect As Rectangle, startAngle As Single, sweepAngle As Single)
|
---|
| 560 | FillPie(brush, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle)
|
---|
| 561 | End Sub
|
---|
[33] | 562 |
|
---|
[698] | 563 | Sub FillPie(brush As Brush, x As Long, y As Long, width As Long, height As Long, startAngle As Single, sweepAngle As Single)
|
---|
[701] | 564 | SetStatus(GdipFillPieI(nativeGraphics, brush.NativeBrush, x, y, width, height, startAngle, sweepAngle))
|
---|
[698] | 565 | End Sub
|
---|
[33] | 566 |
|
---|
[698] | 567 | Sub FillPath(brush As Brush, path As GraphicsPath)
|
---|
| 568 | If ActiveBasic.IsNothing(brush) Or ActiveBasic.IsNothing(path) Then
|
---|
| 569 | Throw New ArgumentNullException("brush or path or both")
|
---|
| 570 | End If
|
---|
[701] | 571 | SetStatus(GdipFillPath(nativeGraphics, brush.NativeBrush, path.nativePath))
|
---|
[698] | 572 | End Sub
|
---|
[33] | 573 |
|
---|
[698] | 574 | Sub FillClosedCurve(brush As Brush, points As *PointF, count As Long)
|
---|
[701] | 575 | SetStatus(GdipFillClosedCurve(nativeGraphics, brush.NativeBrush, points, count))
|
---|
[698] | 576 | End Sub
|
---|
[33] | 577 |
|
---|
[698] | 578 | Sub FillClosedCurve(brush As Brush, points As *PointF, count As Long, fillMode As Drawing2D.FillMode)
|
---|
[701] | 579 | SetStatus(GdipFillClosedCurve2(nativeGraphics, brush.NativeBrush, points, count, 0.5, fillMode))
|
---|
[698] | 580 | End Sub
|
---|
[33] | 581 |
|
---|
[698] | 582 | Sub FillClosedCurve(brush As Brush, points As *PointF, count As Long, fillMode As Drawing2D.FillMode, tension As Single)
|
---|
[701] | 583 | SetStatus(GdipFillClosedCurve2(nativeGraphics, brush.NativeBrush, points, count, tension, fillMode))
|
---|
[698] | 584 | End Sub
|
---|
[33] | 585 |
|
---|
[698] | 586 | Sub FillClosedCurve(brush As Brush, points As *Point, count As Long)
|
---|
[701] | 587 | SetStatus(GdipFillClosedCurveI(nativeGraphics, brush.NativeBrush, points, count))
|
---|
[698] | 588 | End Sub
|
---|
[33] | 589 |
|
---|
[698] | 590 | Sub FillClosedCurve(brush As Brush, points As *Point, count As Long, fillMode As Drawing2D.FillMode)
|
---|
[701] | 591 | SetStatus(GdipFillClosedCurve2I(nativeGraphics, brush.NativeBrush, points, count, 0.5, fillMode))
|
---|
[698] | 592 | End Sub
|
---|
[33] | 593 |
|
---|
[698] | 594 | Sub FillClosedCurve(brush As Brush, points As *Point, count As Long, fillMode As Drawing2D.FillMode, tension As Single)
|
---|
[701] | 595 | SetStatus(GdipFillClosedCurve2I(nativeGraphics, brush.NativeBrush, points, count, tension, fillMode))
|
---|
[698] | 596 | End Sub
|
---|
[33] | 597 |
|
---|
[698] | 598 | Sub FillRegion(brush As Brush, region As Region)
|
---|
[701] | 599 | SetStatus(GdipFillRegion(nativeGraphics, brush.NativeBrush, region.nativeRegion))
|
---|
[698] | 600 | End Sub
|
---|
[33] | 601 |
|
---|
[698] | 602 | 'DrawStringは次の組み合わせからなる。
|
---|
| 603 | '(PCWSTR, Long) or String
|
---|
| 604 | 'PointF or (Single, Single) or Rectangle
|
---|
| 605 | 'StringFormatの有無
|
---|
| 606 | Sub DrawString(str As PCWSTR, length As Long, font As Font, brush As Brush, ByRef origin As PointF, stringFormat = Nothing As StringFormat)
|
---|
| 607 | DrawString(str, length, font, brush, origin.X, origin.Y, stringFormat)
|
---|
| 608 | End Sub
|
---|
[33] | 609 |
|
---|
[698] | 610 | Sub DrawString(str As PCWSTR, length As Long, font As Font, brush As Brush, x As Single, y As Single, stringFormat = Nothing As StringFormat)
|
---|
| 611 | Dim rc As RectangleF
|
---|
| 612 | rc.X = x
|
---|
| 613 | rc.Y = y
|
---|
| 614 | rc.Width = 0
|
---|
| 615 | rc.Height = 0
|
---|
| 616 | DrawString(str, length, font, brush, rc, stringFormat)
|
---|
| 617 | End Sub
|
---|
[33] | 618 |
|
---|
[698] | 619 | Sub DrawString(str As PCWSTR, length As Long, font As Font, brush As Brush, ByRef layoutRect As RectangleF, stringFormat = Nothing As StringFormat)
|
---|
| 620 | Dim nativeFont = getNativeFont(font)
|
---|
[701] | 621 | Dim nativeFormat = GetNativeStringFormat(stringFormat)
|
---|
[698] | 622 | Dim nativeBrush = getNativeBrush(brush)
|
---|
| 623 | SetStatus(GdipDrawString(nativeGraphics, str, length, nativeFont, layoutRect, nativeFormat, nativeBrush))
|
---|
| 624 | End Sub
|
---|
[33] | 625 |
|
---|
[698] | 626 | Sub DrawString(s As String, font As Font, brush As Brush, ByRef origin As PointF, stringFormat = Nothing As StringFormat)
|
---|
| 627 | DrawString(s, font, brush, origin.X, origin.Y, stringFormat)
|
---|
| 628 | End Sub
|
---|
[33] | 629 |
|
---|
[698] | 630 | Sub DrawString(s As String, font As Font, brush As Brush, x As Single, y As Single, stringFormat = Nothing As StringFormat)
|
---|
| 631 | Dim rc As RectangleF
|
---|
| 632 | rc.X = x
|
---|
| 633 | rc.Y = y
|
---|
| 634 | rc.Width = 0
|
---|
| 635 | rc.Height = 0
|
---|
| 636 | DrawString(s, font, brush, rc, stringFormat)
|
---|
| 637 | End Sub
|
---|
[33] | 638 |
|
---|
[698] | 639 | Sub DrawString(s As String, font As Font, brush As Brush, ByRef layoutRect As RectangleF, stringFormat = Nothing As StringFormat)
|
---|
| 640 | Dim wcs As PCWSTR
|
---|
| 641 | Dim len = GetStr(s, wcs) As Long
|
---|
| 642 | DrawString(wcs, len As Long, font, brush, layoutRect, stringFormat)
|
---|
| 643 | End Sub
|
---|
[33] | 644 |
|
---|
[698] | 645 | Function MeasureString(s As String, font As Font) As SizeF
|
---|
| 646 | Dim pt As PointF
|
---|
| 647 | MeasureString = MeasureString(s, font, pt, Nothing)
|
---|
[33] | 648 | End Function
|
---|
| 649 |
|
---|
[698] | 650 | Function MeasureString(s As String, font As Font, ByRef layoutRectSize As SizeF) As SizeF
|
---|
| 651 | MeasureString = MeasureString(s, font, layoutRectSize, Nothing)
|
---|
[33] | 652 | End Function
|
---|
| 653 |
|
---|
[698] | 654 | Function MeasureString(s As String, font As Font, ByRef layoutRectSize As SizeF, stringFormat As StringFormat) As SizeF
|
---|
| 655 | Dim wcs As PCWSTR
|
---|
| 656 | Dim len = GetStr(s, wcs) As Long
|
---|
| 657 | MeasureString = MeasureString(wcs, len, font, layoutRectSize, stringFormat)
|
---|
[33] | 658 | End Function
|
---|
| 659 |
|
---|
[698] | 660 | Function MeasureString(s As String, font As Font, ByRef origin As PointF, stringFormat As StringFormat) As SizeF
|
---|
| 661 | Dim wcs As PCWSTR
|
---|
| 662 | Dim len = GetStr(s, wcs) As Long
|
---|
| 663 | MeasureString = MeasureString(wcs, len, font, origin, stringFormat)
|
---|
[33] | 664 | End Function
|
---|
| 665 |
|
---|
[698] | 666 | Function MeasureString(s As String, font As Font, width As Long, stringFormat As StringFormat) As SizeF
|
---|
| 667 | Dim wcs As PCWSTR
|
---|
| 668 | Dim len = GetStr(s, wcs) As Long
|
---|
| 669 | MeasureString = MeasureString(wcs, len, font, width, stringFormat)
|
---|
[33] | 670 | End Function
|
---|
| 671 |
|
---|
[698] | 672 | Function MeasureString(s As String, font As Font, ByRef layoutRectSize As SizeF, stringFormat As StringFormat, ByRef codepointsFitted As Long, ByRef linesFilled As Long) As SizeF
|
---|
| 673 | Dim wcs As PCWSTR
|
---|
| 674 | Dim len = GetStr(s, wcs) As Long
|
---|
| 675 | MeasureString = MeasureString(wcs, len, font, layoutRectSize, stringFormat, codepointsFitted, linesFilled)
|
---|
[33] | 676 | End Function
|
---|
| 677 |
|
---|
[698] | 678 | Function MeasureString(str As PCWSTR, length As Long, font As Font) As SizeF
|
---|
| 679 | Dim pt As PointF
|
---|
| 680 | MeasureString = MeasureString(str, length, font, pt, Nothing)
|
---|
[33] | 681 | End Function
|
---|
| 682 |
|
---|
[698] | 683 | Function MeasureString(str As PCWSTR, length As Long, font As Font, ByRef layoutRectSize As SizeF) As SizeF
|
---|
| 684 | MeasureString = MeasureString(str, length, font, layoutRectSize, Nothing)
|
---|
[33] | 685 | End Function
|
---|
| 686 |
|
---|
[698] | 687 | Function MeasureString(str As PCWSTR, length As Long, font As Font, ByRef layoutRectSize As SizeF, stringFormat As StringFormat) As SizeF
|
---|
| 688 | MeasureString = measureStringPt(str, length, font, layoutRectSize, stringFormat, 0, 0)
|
---|
[33] | 689 | End Function
|
---|
| 690 |
|
---|
[698] | 691 | Function MeasureString(str As PCWSTR, length As Long, font As Font, ByRef origin As PointF, stringFormat As StringFormat) As SizeF
|
---|
| 692 | Dim layoutRect As RectangleF
|
---|
| 693 | With layoutRect
|
---|
| 694 | .X = origin.X
|
---|
| 695 | .Y = origin.Y
|
---|
| 696 | .Width = 0
|
---|
| 697 | .Height = 0
|
---|
| 698 | End With
|
---|
| 699 | MeasureString = measureString(str, length, font, layoutRect, stringFormat, 0, 0)
|
---|
[33] | 700 | End Function
|
---|
| 701 |
|
---|
[698] | 702 | Function MeasureString(str As PCWSTR, length As Long, font As Font, width As Long, stringFormat As StringFormat) As SizeF
|
---|
| 703 | Dim layoutRect As RectangleF
|
---|
| 704 | With layoutRect
|
---|
| 705 | .X = 0
|
---|
| 706 | .Y = 0
|
---|
| 707 | .Width = width
|
---|
| 708 | .Height = 0
|
---|
| 709 | End With
|
---|
| 710 | MeasureString = measureString(str, length, font, layoutRect, stringFormat, 0, 0)
|
---|
[33] | 711 | End Function
|
---|
| 712 |
|
---|
[698] | 713 | Function MeasureString(str As PCWSTR, length As Long, font As Font, ByRef layoutRectSize As SizeF, stringFormat As StringFormat, ByRef codepointsFitted As Long, ByRef linesFilled As Long) As SizeF
|
---|
| 714 | MeasureString = measureStringPt(str, length, font, layoutRectSize, stringFormat, VarPtr(codepointsFitted), VarPtr(linesFilled))
|
---|
[33] | 715 | End Function
|
---|
| 716 |
|
---|
[698] | 717 | Private
|
---|
| 718 | Function measureStringPt(str As PCWSTR, length As Long, font As Font, ByRef layoutRectSize As SizeF, stringFormat As StringFormat, codepointsFitted As *Long, linesFilled As *Long) As SizeF
|
---|
| 719 | Dim layoutRect As RectangleF
|
---|
| 720 | With layoutRect
|
---|
| 721 | .X = 0
|
---|
| 722 | .Y = 0
|
---|
| 723 | .Width = layoutRectSize.Width
|
---|
| 724 | .Height = layoutRectSize.Height
|
---|
| 725 | End With
|
---|
| 726 | measureStringPt = measureString(str, length, font, layoutRect, stringFormat, codepointsFitted, linesFilled)
|
---|
[33] | 727 | End Function
|
---|
| 728 |
|
---|
[698] | 729 | Function measureString(str As PCWSTR, length As Long, font As Font, ByRef layoutRect As RectangleF, stringFormat As StringFormat, codepointsFitted As *Long, linesFilled As *Long) As SizeF
|
---|
| 730 | Dim nativeFont = getNativeFont(font)
|
---|
[701] | 731 | Dim nativeFormat = GetNativeStringFormat(stringFormat)
|
---|
[698] | 732 | Dim boundingBox As RectangleF
|
---|
| 733 | SetStatus(GdipMeasureString(nativeGraphics, str, length, nativeFont, layoutRect, nativeFormat, boundingBox, codepointsFitted, linesFilled))
|
---|
| 734 | measureString.Width = boundingBox.Width
|
---|
| 735 | measureString.Height = boundingBox.Height
|
---|
[33] | 736 | End Function
|
---|
| 737 |
|
---|
[698] | 738 | Public
|
---|
[33] | 739 |
|
---|
[698] | 740 | Function MeasureCharacterRanges(s As String, font As Font, ByRef layoutRect As RectangleF, stringFormat As StringFormat) As System.Collections.Generic.IList<Region>
|
---|
| 741 | Dim wcs As PCWSTR
|
---|
| 742 | Dim len = GetStr(s, wcs)
|
---|
| 743 | MeasureCharacterRanges = MeasureCharacterRanges(wcs, len, font, layoutRect, stringFormat)
|
---|
[33] | 744 | End Function
|
---|
| 745 |
|
---|
[698] | 746 | Function MeasureCharacterRanges(str As PCWSTR, length As Long, font As Font, ByRef layoutRect As RectangleF, stringFormat As StringFormat) As System.Collections.Generic.IList<Region>
|
---|
| 747 | If ActiveBasic.IsNothing(stringFormat) Then
|
---|
| 748 | stringFormat = New StringFormat
|
---|
[33] | 749 | End If
|
---|
[698] | 750 | Dim count As Long
|
---|
[701] | 751 | SetStatus(GdipGetStringFormatMeasurableCharacterRangeCount(stringFormat.NativeFormat, count))
|
---|
[698] | 752 | Dim nativeRegions As **GpRegion 'ここで = GC_mallocとすると、エラーになる。
|
---|
| 753 | nativeRegions = GC_malloc(count * SizeOf(*GpRegion))
|
---|
| 754 | Dim regions = New System.Collections.Generic.List<Region>(count)
|
---|
| 755 | MeasureCharacterRanges = regions
|
---|
[33] | 756 |
|
---|
| 757 | Dim i As Long
|
---|
[698] | 758 | For i = 0 To ELM(count)
|
---|
| 759 | Dim t = regions[i]
|
---|
| 760 | nativeRegions[i] = t.nativeRegion
|
---|
[33] | 761 | Next
|
---|
[698] | 762 | Dim nativeFont = getNativeFont(font)
|
---|
[701] | 763 | SetStatus(GdipMeasureCharacterRanges(nativeGraphics, str, length, nativeFont, layoutRect, stringFormat.NativeFormat, count, nativeRegions))
|
---|
[33] | 764 | End Function
|
---|
| 765 |
|
---|
[698] | 766 | 'DrawDriverString
|
---|
| 767 | 'MeasureDriverString
|
---|
[33] | 768 |
|
---|
[698] | 769 | Sub DrawCachedBitmap(cb As CachedBitmap, x As Long, y As Long)
|
---|
| 770 | SetStatus(GdipDrawCachedBitmap(nativeGraphics, cb.nativeCachedBitmap, x, y))
|
---|
| 771 | End Sub
|
---|
[33] | 772 |
|
---|
[698] | 773 | Sub DrawImage(image As Image, ByRef point As PointF)
|
---|
| 774 | DrawImage(image, point.X, point.Y)
|
---|
| 775 | End Sub
|
---|
[33] | 776 |
|
---|
[698] | 777 | Sub DrawImage(image As Image, x As Single, y As Single)
|
---|
| 778 | Dim nativeImage = getNativeImage(image)
|
---|
| 779 | SetStatus(GdipDrawImage(nativeGraphics, nativeImage, x, y))
|
---|
| 780 | End Sub
|
---|
[33] | 781 |
|
---|
[698] | 782 | Sub DrawImage(image As Image, ByRef rect As RectangleF)
|
---|
| 783 | DrawImage(image, rect.X, rect.Y, rect.Width, rect.Height)
|
---|
| 784 | End Sub
|
---|
[33] | 785 |
|
---|
[698] | 786 | Sub DrawImage(image As Image, x As Single, y As Single, width As Single, height As Single)
|
---|
| 787 | Dim nativeImage = getNativeImage(image)
|
---|
| 788 | SetStatus(GdipDrawImageRect(nativeGraphics, nativeImage, x, y, width, height))
|
---|
| 789 | End Sub
|
---|
[33] | 790 |
|
---|
[698] | 791 | Sub DrawImage(image As Image, ByRef point As Point)
|
---|
| 792 | DrawImage(image, point.X, point.Y)
|
---|
| 793 | End Sub
|
---|
[33] | 794 |
|
---|
[698] | 795 | Sub DrawImage(image As Image, x As Long, y As Long)
|
---|
| 796 | Dim nativeImage = getNativeImage(image)
|
---|
| 797 | SetStatus(GdipDrawImageI(nativeGraphics, nativeImage, x, y))
|
---|
| 798 | End Sub
|
---|
[33] | 799 |
|
---|
[698] | 800 | Sub DrawImage(image As Image, ByRef rect As Rectangle)
|
---|
| 801 | DrawImage(image, rect.X, rect.Y, rect.Width, rect.Height)
|
---|
| 802 | End Sub
|
---|
[33] | 803 |
|
---|
[698] | 804 | Sub DrawImage(image As Image, x As Long, y As Long, width As Long, height As Long)
|
---|
| 805 | Dim nativeImage = getNativeImage(image)
|
---|
| 806 | SetStatus(GdipDrawImageRectI(nativeGraphics, nativeImage, x, y, width, height))
|
---|
| 807 | End Sub
|
---|
[33] | 808 |
|
---|
| 809 | ' Affine Draw Image
|
---|
| 810 | ' destPoints.length = 3: rect => parallelogram
|
---|
| 811 | ' destPoints[0] <=> top-left corner of the source rectangle
|
---|
| 812 | ' destPoints[1] <=> top-right corner
|
---|
| 813 | ' destPoints[2] <=> bottom-left corner
|
---|
| 814 | ' destPoints.length = 4: rect => quad
|
---|
| 815 | ' destPoints[3] <=> bottom-right corner
|
---|
| 816 |
|
---|
[698] | 817 | Sub DrawImage(image As Image, destPoints As *PointF, count As Long)
|
---|
[33] | 818 | If count <> 3 And count <> 4 Then
|
---|
[698] | 819 | SetStatus(InvalidParameter)
|
---|
[33] | 820 | End If
|
---|
| 821 |
|
---|
[698] | 822 | Dim nativeImage = getNativeImage(image)
|
---|
| 823 | SetStatus(GdipDrawImagePoints(nativeGraphics, nativeImage, destPoints, count))
|
---|
| 824 | End Sub
|
---|
[33] | 825 |
|
---|
[698] | 826 | Sub DrawImage(image As Image, destPoints As *Point, count As Long)
|
---|
[33] | 827 | If count <> 3 And count <> 4 Then
|
---|
[698] | 828 | SetStatus(InvalidParameter)
|
---|
[33] | 829 | End If
|
---|
| 830 |
|
---|
[698] | 831 | Dim nativeImage = getNativeImage(image)
|
---|
| 832 | SetStatus(GdipDrawImagePointsI(nativeGraphics, nativeImage, destPoints, count))
|
---|
| 833 | End Sub
|
---|
[33] | 834 |
|
---|
[698] | 835 | Sub DrawImage(image As Image, ByRef destRect As Rectangle, ByRef src As Rectangle, srcUnit As GraphicsUnit)
|
---|
| 836 | DrawImage(image, destRect, src.X, src.Y, src.Width, src.Height, srcUnit)
|
---|
| 837 | End Sub
|
---|
[33] | 838 |
|
---|
[698] | 839 | Sub DrawImage(image As Image, ByRef destRect As RectangleF, ByRef src As RectangleF, srcUnit As GraphicsUnit)
|
---|
| 840 | DrawImage(image, destRect, src.X, src.Y, src.Width, src.Height, srcUnit)
|
---|
| 841 | End Sub
|
---|
[33] | 842 |
|
---|
[698] | 843 | Sub DrawImage(image As Image, x As Long, y As Long, ByRef src As Rectangle, srcUnit As GraphicsUnit)
|
---|
| 844 | Dim nativeImage = getNativeImage(image)
|
---|
| 845 | SetStatus(GdipDrawImagePointRectI(nativeGraphics, nativeImage, x, y, src.X, src.Y, src.Width, src.Height, srcUnit))
|
---|
| 846 | End Sub
|
---|
[33] | 847 |
|
---|
[698] | 848 | Sub DrawImage(image As Image, x As Single, y As Single, ByRef src As RectangleF, srcUnit As GraphicsUnit)
|
---|
| 849 | Dim nativeImage = getNativeImage(image)
|
---|
| 850 | SetStatus(GdipDrawImagePointRect(nativeGraphics, nativeImage, x, y, src.X, src.Y, src.Width, src.Height, srcUnit))
|
---|
| 851 | End Sub
|
---|
[33] | 852 |
|
---|
[698] | 853 | Sub DrawImage(image As Image, destPoints As *Point, count As Long, ByRef src As Rectangle, srcUnit As GraphicsUnit, _
|
---|
| 854 | imageAttr = Nothing As ImageAttributes, callback = Nothing As DrawImageAbort, callbackData = 0 As VoidPtr)
|
---|
[33] | 855 |
|
---|
[698] | 856 | Dim nativeImage = getNativeImage(image)
|
---|
| 857 | Dim nativeImageAttr = getNativeImageAttributes(imageAttr)
|
---|
| 858 | SetStatus(GdipDrawImagePointsRectI(nativeGraphics, nativeImage, destPoints, count,
|
---|
| 859 | src.X, src.Y, src.Width, src.Height, srcUnit, nativeImageAttr, callback, callbackData))
|
---|
| 860 | End Sub
|
---|
[33] | 861 |
|
---|
[698] | 862 | Sub DrawImage(image As Image, destPoints As *PointF, count As Long, ByRef src As RectangleF, srcUnit As GraphicsUnit,
|
---|
| 863 | imageAttr = Nothing As ImageAttributes, callback = Nothing As DrawImageAbort, callbackData = 0 As VoidPtr)
|
---|
[33] | 864 |
|
---|
[698] | 865 | Dim nativeImage = getNativeImage(image)
|
---|
| 866 | Dim nativeImageAttr = getNativeImageAttributes(imageAttr)
|
---|
| 867 | SetStatus(GdipDrawImagePointsRect(nativeGraphics, nativeImage, destPoints, count,
|
---|
| 868 | src.X, src.Y, src.Width, src.Height, srcUnit, nativeImageAttr, callback, callbackData))
|
---|
| 869 | End Sub
|
---|
[33] | 870 |
|
---|
[698] | 871 | Sub DrawImage(image As Image, ByRef destRect As RectangleF,
|
---|
[33] | 872 | srcx As Single, srcy As Single, srcwidth As Single, srcheight As Single, srcUnit As GraphicsUnit,
|
---|
[698] | 873 | imageAttr = Nothing As ImageAttributes, callback = Nothing As DrawImageAbort, callbackData = 0 As VoidPtr)
|
---|
[33] | 874 |
|
---|
[698] | 875 | Dim nativeImage = getNativeImage(image)
|
---|
| 876 | Dim nativeImageAttr = getNativeImageAttributes(imageAttr)
|
---|
| 877 | SetStatus(GdipDrawImageRectRect(nativeGraphics, nativeImageAttr,
|
---|
[33] | 878 | destRect.X, destRect.Y, destRect.Width, destRect.Height, srcx, srcy, srcwidth, srcheight,
|
---|
| 879 | srcUnit, nativeImageAttr, callback, callbackData))
|
---|
[698] | 880 | End Sub
|
---|
[33] | 881 |
|
---|
[698] | 882 | Sub DrawImage(image As Image, ByRef destRect As Rectangle,
|
---|
| 883 | srcx As Long, srcy As Long, srcwidth As Long, srcheight As Long, srcUnit As GraphicsUnit,
|
---|
| 884 | imageAttr = Nothing As ImageAttributes, callback = Nothing As DrawImageAbort, callbackData = 0 As VoidPtr)
|
---|
[33] | 885 |
|
---|
[698] | 886 | Dim nativeImage = getNativeImage(image)
|
---|
| 887 | Dim nativeImageAttr = getNativeImageAttributes(imageAttr)
|
---|
| 888 | SetStatus(GdipDrawImageRectRectI(nativeGraphics, nativeImage,
|
---|
| 889 | destRect.X, destRect.Y, destRect.Width, destRect.Height,
|
---|
| 890 | srcx, srcy, srcwidth, srcheight, srcUnit, nativeImageAttr, callback, callbackData))
|
---|
| 891 | End Sub
|
---|
[33] | 892 |
|
---|
[705] | 893 | Sub EnumerateMetafile(metafile As Imaging.Metafile, ByRef destPoint As PointF,
|
---|
[698] | 894 | callback As EnumerateMetafileProc, callbackData = 0 As VoidPtr, imageAttr = Nothing As ImageAttributes)
|
---|
[33] | 895 |
|
---|
[698] | 896 | Dim nativeImage = getNativeImage(metafile)
|
---|
| 897 | Dim nativeImageAttr = getNativeImageAttributes(imageAttr)
|
---|
| 898 | Dim procData As Detail.EnumerateMetafileProcData
|
---|
| 899 | procData.Proc = callback
|
---|
| 900 | procData.Data = callbackData
|
---|
| 901 | SetStatus(GdipEnumerateMetafileDestPoint(nativeGraphics,
|
---|
| 902 | nativeImage, destPoint, AddressOf(Detail.NativeEnumerateMetafileProcEntry), VarPtr(procData), nativeImageAttr))
|
---|
| 903 | End Sub
|
---|
[33] | 904 |
|
---|
[705] | 905 | Sub EnumerateMetafile(metafile As Imaging.Metafile, ByRef destPoint As Point,
|
---|
[698] | 906 | callback As EnumerateMetafileProc, callbackData = 0 As VoidPtr, imageAttr = Nothing As ImageAttributes)
|
---|
[33] | 907 |
|
---|
[698] | 908 | Dim nativeImage = getNativeImage(metafile)
|
---|
| 909 | Dim nativeImageAttr = getNativeImageAttributes(imageAttr)
|
---|
| 910 | Dim procData As Detail.EnumerateMetafileProcData
|
---|
| 911 | procData.Proc = callback
|
---|
| 912 | procData.Data = callbackData
|
---|
| 913 | SetStatus(GdipEnumerateMetafileDestPointI(nativeGraphics,
|
---|
| 914 | nativeImage, destPoint, AddressOf(Detail.NativeEnumerateMetafileProcEntry), VarPtr(procData), nativeImageAttr))
|
---|
| 915 | End Sub
|
---|
[33] | 916 |
|
---|
[705] | 917 | Sub EnumerateMetafile(metafile As Imaging.Metafile, ByRef destRect As RectangleF,
|
---|
[698] | 918 | callback As EnumerateMetafileProc, callbackData = 0 As VoidPtr, imageAttr = Nothing As ImageAttributes)
|
---|
[33] | 919 |
|
---|
[698] | 920 | Dim nativeImage = getNativeImage(metafile)
|
---|
| 921 | Dim nativeImageAttr = getNativeImageAttributes(imageAttr)
|
---|
| 922 | Dim procData As Detail.EnumerateMetafileProcData
|
---|
| 923 | procData.Proc = callback
|
---|
| 924 | procData.Data = callbackData
|
---|
| 925 | SetStatus(GdipEnumerateMetafileDestRect(nativeGraphics,
|
---|
| 926 | nativeImage, destRect, AddressOf(Detail.NativeEnumerateMetafileProcEntry), VarPtr(procData), nativeImageAttr))
|
---|
| 927 | End Sub
|
---|
[33] | 928 |
|
---|
[705] | 929 | Sub EnumerateMetafile(metafile As Imaging.Metafile, ByRef destRect As Rectangle,
|
---|
[698] | 930 | callback As EnumerateMetafileProc, callbackData = 0 As VoidPtr, imageAttr = Nothing As ImageAttributes)
|
---|
[33] | 931 |
|
---|
[698] | 932 | Dim nativeImage = getNativeImage(metafile)
|
---|
| 933 | Dim nativeImageAttr = getNativeImageAttributes(imageAttr)
|
---|
| 934 | Dim procData As Detail.EnumerateMetafileProcData
|
---|
| 935 | procData.Proc = callback
|
---|
| 936 | procData.Data = callbackData
|
---|
| 937 | SetStatus(GdipEnumerateMetafileDestRectI(nativeGraphics,
|
---|
| 938 | nativeImage, destRect, AddressOf(Detail.NativeEnumerateMetafileProcEntry), VarPtr(procData), nativeImageAttr))
|
---|
| 939 | End Sub
|
---|
[33] | 940 |
|
---|
[705] | 941 | Sub EnumerateMetafile(metafile As Imaging.Metafile, destPoints As *PointF, count As Long,
|
---|
[698] | 942 | callback As EnumerateMetafileProc, callbackData = 0 As VoidPtr, imageAttr = Nothing As ImageAttributes)
|
---|
[33] | 943 |
|
---|
[698] | 944 | Dim nativeImage = getNativeImage(metafile)
|
---|
| 945 | Dim nativeImageAttr = getNativeImageAttributes(imageAttr)
|
---|
| 946 | Dim procData As Detail.EnumerateMetafileProcData
|
---|
| 947 | procData.Proc = callback
|
---|
| 948 | procData.Data = callbackData
|
---|
| 949 | SetStatus(GdipEnumerateMetafileDestPoints(nativeGraphics,
|
---|
| 950 | nativeImage,destPoints, count, AddressOf(Detail.NativeEnumerateMetafileProcEntry), VarPtr(procData), nativeImageAttr))
|
---|
| 951 | End Sub
|
---|
[33] | 952 |
|
---|
[705] | 953 | Sub EnumerateMetafile(metafile As Imaging.Metafile, destPoints As *Point, count As Long,
|
---|
[698] | 954 | callback As EnumerateMetafileProc, callbackData = 0 As VoidPtr, imageAttr = Nothing As ImageAttributes)
|
---|
[33] | 955 |
|
---|
[698] | 956 | Dim nativeImage = getNativeImage(metafile)
|
---|
| 957 | Dim nativeImageAttr = getNativeImageAttributes(imageAttr)
|
---|
| 958 | Dim procData As Detail.EnumerateMetafileProcData
|
---|
| 959 | procData.Proc = callback
|
---|
| 960 | procData.Data = callbackData
|
---|
| 961 | SetStatus(GdipEnumerateMetafileDestPointsI(nativeGraphics,
|
---|
| 962 | nativeImage,destPoints, count, AddressOf(Detail.NativeEnumerateMetafileProcEntry), VarPtr(procData), nativeImageAttr))
|
---|
| 963 | End Sub
|
---|
[33] | 964 |
|
---|
[705] | 965 | Sub EnumerateMetafile(metafile As Imaging.Metafile,
|
---|
[698] | 966 | ByRef destPoint As PointF, ByRef srcRect As RectangleF, srcUnit As GraphicsUnit,
|
---|
| 967 | callback As EnumerateMetafileProc, callbackData = 0 As VoidPtr, imageAttr = Nothing As ImageAttributes)
|
---|
[33] | 968 |
|
---|
[698] | 969 | Dim nativeImage = getNativeImage(metafile)
|
---|
| 970 | Dim nativeImageAttr = getNativeImageAttributes(imageAttr)
|
---|
| 971 | Dim procData As Detail.EnumerateMetafileProcData
|
---|
| 972 | procData.Proc = callback
|
---|
| 973 | procData.Data = callbackData
|
---|
| 974 | SetStatus(GdipEnumerateMetafileSrcRectDestPoint(nativeGraphics,
|
---|
| 975 | nativeImage, destPoint, srcRect, srcUnit, AddressOf(Detail.NativeEnumerateMetafileProcEntry), VarPtr(procData), nativeImageAttr))
|
---|
| 976 | End Sub
|
---|
[33] | 977 |
|
---|
[705] | 978 | Sub EnumerateMetafile(metafile As Imaging.Metafile,
|
---|
[698] | 979 | ByRef destPoint As Point, ByRef srcRect As Rectangle, srcUnit As GraphicsUnit,
|
---|
| 980 | callback As EnumerateMetafileProc, callbackData = 0 As VoidPtr, imageAttr = Nothing As ImageAttributes)
|
---|
[33] | 981 |
|
---|
[698] | 982 | Dim nativeImage = getNativeImage(metafile)
|
---|
| 983 | Dim nativeImageAttr = getNativeImageAttributes(imageAttr)
|
---|
| 984 | Dim procData As Detail.EnumerateMetafileProcData
|
---|
| 985 | procData.Proc = callback
|
---|
| 986 | procData.Data = callbackData
|
---|
| 987 | SetStatus(GdipEnumerateMetafileSrcRectDestPointI(nativeGraphics,
|
---|
| 988 | nativeImage, destPoint, srcRect, srcUnit, AddressOf(Detail.NativeEnumerateMetafileProcEntry), VarPtr(procData), nativeImageAttr))
|
---|
| 989 | End Sub
|
---|
[33] | 990 |
|
---|
[705] | 991 | Sub EnumerateMetafile(metafile As Imaging.Metafile,
|
---|
[698] | 992 | ByRef destRect As RectangleF, ByRef srcRect As RectangleF, srcUnit As GraphicsUnit,
|
---|
| 993 | callback As EnumerateMetafileProc, callbackData = 0 As VoidPtr, imageAttr = Nothing As ImageAttributes)
|
---|
[33] | 994 |
|
---|
[698] | 995 | Dim nativeImage = getNativeImage(metafile)
|
---|
| 996 | Dim nativeImageAttr = getNativeImageAttributes(imageAttr)
|
---|
| 997 | Dim procData As Detail.EnumerateMetafileProcData
|
---|
| 998 | procData.Proc = callback
|
---|
| 999 | procData.Data = callbackData
|
---|
| 1000 | SetStatus(GdipEnumerateMetafileSrcRectDestRect(nativeGraphics,
|
---|
| 1001 | nativeImage, destRect, srcRect, srcUnit, AddressOf(Detail.NativeEnumerateMetafileProcEntry), VarPtr(procData), nativeImageAttr))
|
---|
| 1002 | End Sub
|
---|
[33] | 1003 |
|
---|
[705] | 1004 | Sub EnumerateMetafile(metafile As Imaging.Metafile,
|
---|
[698] | 1005 | ByRef destRect As Rectangle, ByRef srcRect As Rectangle, srcUnit As GraphicsUnit,
|
---|
| 1006 | callback As EnumerateMetafileProc, callbackData = 0 As VoidPtr, imageAttr = Nothing As ImageAttributes)
|
---|
[33] | 1007 |
|
---|
[698] | 1008 | Dim nativeImage = getNativeImage(metafile)
|
---|
| 1009 | Dim nativeImageAttr = getNativeImageAttributes(imageAttr)
|
---|
| 1010 | Dim procData As Detail.EnumerateMetafileProcData
|
---|
| 1011 | procData.Proc = callback
|
---|
| 1012 | procData.Data = callbackData
|
---|
| 1013 | SetStatus(GdipEnumerateMetafileSrcRectDestRectI(nativeGraphics,
|
---|
| 1014 | nativeImage, destRect, srcRect, srcUnit, AddressOf(Detail.NativeEnumerateMetafileProcEntry), VarPtr(procData), nativeImageAttr))
|
---|
| 1015 | End Sub
|
---|
[33] | 1016 |
|
---|
[705] | 1017 | Sub EnumerateMetafile(metafile As Imaging.Metafile,
|
---|
[698] | 1018 | destPoints As *PointF, count As Long, ByRef srcRect As RectangleF, srcUnit As GraphicsUnit,
|
---|
| 1019 | callback As EnumerateMetafileProc, callbackData = 0 As VoidPtr, imageAttr = Nothing As ImageAttributes)
|
---|
[33] | 1020 |
|
---|
[698] | 1021 | Dim nativeImage = getNativeImage(metafile)
|
---|
| 1022 | Dim nativeImageAttr = getNativeImageAttributes(imageAttr)
|
---|
| 1023 | Dim procData As Detail.EnumerateMetafileProcData
|
---|
| 1024 | procData.Proc = callback
|
---|
| 1025 | procData.Data = callbackData
|
---|
| 1026 | SetStatus(GdipEnumerateMetafileSrcRectDestPoints(nativeGraphics,
|
---|
| 1027 | nativeImage, destPoints, count, srcRect, srcUnit, AddressOf(Detail.NativeEnumerateMetafileProcEntry), VarPtr(procData), nativeImageAttr))
|
---|
| 1028 | End Sub
|
---|
[33] | 1029 |
|
---|
[705] | 1030 | Sub EnumerateMetafile(metafile As Imaging.Metafile,
|
---|
[698] | 1031 | destPoints As *Point, count As Long, ByRef srcRect As Rectangle, srcUnit As GraphicsUnit,
|
---|
| 1032 | callback As EnumerateMetafileProc, callbackData = 0 As VoidPtr, imageAttr = Nothing As ImageAttributes)
|
---|
[33] | 1033 |
|
---|
[698] | 1034 | Dim nativeImage = getNativeImage(metafile)
|
---|
| 1035 | Dim nativeImageAttr = getNativeImageAttributes(imageAttr)
|
---|
| 1036 | Dim procData As Detail.EnumerateMetafileProcData
|
---|
| 1037 | procData.Proc = callback
|
---|
| 1038 | procData.Data = callbackData
|
---|
| 1039 | SetStatus(GdipEnumerateMetafileSrcRectDestPointsI(nativeGraphics, nativeImage,
|
---|
| 1040 | destPoints, count, srcRect, srcUnit, AddressOf(Detail.NativeEnumerateMetafileProcEntry), VarPtr(procData), nativeImageAttr))
|
---|
| 1041 | End Sub
|
---|
[33] | 1042 |
|
---|
[698] | 1043 | Sub SetClip(g As Graphics)
|
---|
| 1044 | SetClip(g, System.Drawing.Drawing2D.CombineMode.Replace)
|
---|
| 1045 | End Sub
|
---|
[33] | 1046 |
|
---|
[698] | 1047 | Sub SetClip(g As Graphics, combineMode As Drawing2D.CombineMode)
|
---|
| 1048 | SetStatus(GdipSetClipGraphics(nativeGraphics, g.nativeGraphics, combineMode))
|
---|
| 1049 | End Sub
|
---|
[33] | 1050 |
|
---|
[698] | 1051 | Sub SetClip(ByRef rc As RectangleF)
|
---|
| 1052 | SetClip(rc, System.Drawing.Drawing2D.CombineMode.Replace)
|
---|
| 1053 | End Sub
|
---|
[33] | 1054 |
|
---|
[698] | 1055 | Sub SetClip(ByRef rc As RectangleF, combineMode As Drawing2D.CombineMode)
|
---|
| 1056 | SetStatus(GdipSetClipRect(nativeGraphics, rc.X, rc.Y, rc.Width, rc.Height, combineMode))
|
---|
| 1057 | End Sub
|
---|
[33] | 1058 |
|
---|
[698] | 1059 | Sub SetClip(ByRef rc As Rectangle)
|
---|
| 1060 | SetClip(rc, System.Drawing.Drawing2D.CombineMode.Replace)
|
---|
| 1061 | End Sub
|
---|
[33] | 1062 |
|
---|
[698] | 1063 | Sub SetClip(ByRef rc As Rectangle, combineMode As Drawing2D.CombineMode)
|
---|
| 1064 | SetStatus(GdipSetClipRectI(nativeGraphics, rc.X, rc.Y, rc.Width, rc.Height, combineMode))
|
---|
| 1065 | End Sub
|
---|
[33] | 1066 |
|
---|
[698] | 1067 | Sub SetClip(path As GraphicsPath)
|
---|
| 1068 | SetClip(path, System.Drawing.Drawing2D.CombineMode.Replace)
|
---|
| 1069 | End Sub
|
---|
[33] | 1070 |
|
---|
[698] | 1071 | Sub SetClip(path As GraphicsPath, combineMode As Drawing2D.CombineMode)
|
---|
| 1072 | SetStatus(GdipSetClipPath(nativeGraphics, path.nativePath, combineMode))
|
---|
| 1073 | End Sub
|
---|
[33] | 1074 |
|
---|
[698] | 1075 | Sub SetClip(region As Region)
|
---|
| 1076 | SetClip(region, System.Drawing.Drawing2D.CombineMode.Replace)
|
---|
| 1077 | End Sub
|
---|
[33] | 1078 |
|
---|
[698] | 1079 | Sub SetClip(region As Region, combineMode As Drawing2D.CombineMode)
|
---|
| 1080 | SetStatus(GdipSetClipRegion(nativeGraphics, region.nativeRegion, combineMode))
|
---|
| 1081 | End Sub
|
---|
[33] | 1082 |
|
---|
[698] | 1083 | Sub SetClip(hrgn As HRGN)
|
---|
| 1084 | SetClip(hrgn, System.Drawing.Drawing2D.CombineMode.Replace)
|
---|
| 1085 | End Sub
|
---|
[33] | 1086 |
|
---|
[698] | 1087 | Sub SetClip(hrgn As HRGN, combineMode As Drawing2D.CombineMode)
|
---|
| 1088 | SetStatus(GdipSetClipHrgn(nativeGraphics, hrgn, combineMode))
|
---|
| 1089 | End Sub
|
---|
[33] | 1090 |
|
---|
[698] | 1091 | Sub IntersectClip(ByRef rc As RectangleF)
|
---|
| 1092 | SetStatus(GdipSetClipRect(nativeGraphics, rc.X, rc.Y, rc.Width, rc.Height, System.Drawing.Drawing2D.CombineMode.Intersect))
|
---|
| 1093 | End Sub
|
---|
[33] | 1094 |
|
---|
[698] | 1095 | Sub IntersectClip(ByRef rc As Rectangle)
|
---|
| 1096 | SetStatus(GdipSetClipRectI(nativeGraphics, rc.X, rc.Y, rc.Width, rc.Height, System.Drawing.Drawing2D.CombineMode.Intersect))
|
---|
| 1097 | End Sub
|
---|
[33] | 1098 |
|
---|
[698] | 1099 | Sub IntersectClip(region As Region)
|
---|
| 1100 | SetStatus(GdipSetClipRegion(nativeGraphics, region.nativeRegion, System.Drawing.Drawing2D.CombineMode.Intersect))
|
---|
| 1101 | End Sub
|
---|
[33] | 1102 |
|
---|
[698] | 1103 | Sub ExcludeClip(ByRef rc As RectangleF)
|
---|
| 1104 | SetStatus(GdipSetClipRect(nativeGraphics, rc.X, rc.Y, rc.Width, rc.Height, System.Drawing.Drawing2D.CombineMode.Exclude))
|
---|
| 1105 | End Sub
|
---|
[33] | 1106 |
|
---|
[698] | 1107 | Sub ExcludeClip(ByRef rc As Rectangle)
|
---|
| 1108 | SetStatus(GdipSetClipRectI(nativeGraphics, rc.X, rc.Y, rc.Width, rc.Height, System.Drawing.Drawing2D.CombineMode.Exclude))
|
---|
| 1109 | End Sub
|
---|
[33] | 1110 |
|
---|
[698] | 1111 | Sub ExcludeClip(region As Region)
|
---|
| 1112 | SetStatus(GdipSetClipRegion(nativeGraphics, region.nativeRegion, System.Drawing.Drawing2D.CombineMode.Exclude))
|
---|
| 1113 | End Sub
|
---|
[33] | 1114 |
|
---|
[698] | 1115 | Sub ResetClip()
|
---|
| 1116 | SetStatus(GdipResetClip(nativeGraphics))
|
---|
| 1117 | End Sub
|
---|
[33] | 1118 |
|
---|
[698] | 1119 | Sub TranslateClip(dx As Single, dy As Single)
|
---|
| 1120 | SetStatus(GdipTranslateClip(nativeGraphics, dx, dy))
|
---|
| 1121 | End Sub
|
---|
[33] | 1122 |
|
---|
[698] | 1123 | Sub TranslateClip(dx As Long, dy As Long)
|
---|
| 1124 | SetStatus(GdipTranslateClipI(nativeGraphics, dx, dy))
|
---|
| 1125 | End Sub
|
---|
[33] | 1126 |
|
---|
[698] | 1127 | Const Function IsVisible(x As Long, y As Long) As Boolean
|
---|
| 1128 | Dim b = FALSE As BOOL
|
---|
| 1129 | SetStatus(GdipIsVisiblePointI(nativeGraphics, x, y, b))
|
---|
| 1130 | IsVisible = b As Boolean
|
---|
[33] | 1131 | End Function
|
---|
| 1132 |
|
---|
[698] | 1133 | Const Function IsVisible(ByRef pt As Point) As Boolean
|
---|
| 1134 | IsVisible(pt.X, pt.Y)
|
---|
[33] | 1135 | End Function
|
---|
| 1136 |
|
---|
[698] | 1137 | Const Function IsVisible(x As Long, y As Long, width As Long, height As Long) As Boolean
|
---|
| 1138 | Dim b = FALSE As BOOL
|
---|
| 1139 | SetStatus(GdipIsVisibleRectI(nativeGraphics, x, y, width, height, b))
|
---|
| 1140 | IsVisible = b As Boolean
|
---|
[33] | 1141 | End Function
|
---|
| 1142 |
|
---|
[698] | 1143 | Const Function IsVisible(ByRef rc As Rectangle) As Boolean
|
---|
| 1144 | IsVisible = IsVisible(rc.X, rc.Y, rc.Width, rc.Height)
|
---|
[33] | 1145 | End Function
|
---|
| 1146 |
|
---|
[698] | 1147 | Const Function IsVisible(x As Single, y As Single) As Boolean
|
---|
| 1148 | Dim b = FALSE As BOOL
|
---|
| 1149 | SetStatus(GdipIsVisiblePoint(nativeGraphics, x, y, b))
|
---|
| 1150 | IsVisible = b As Boolean
|
---|
[33] | 1151 | End Function
|
---|
| 1152 |
|
---|
[698] | 1153 | Const Function IsVisible(ByRef pt As PointF) As Boolean
|
---|
| 1154 | IsVisible = IsVisible(pt.X, pt.Y)
|
---|
[33] | 1155 | End Function
|
---|
| 1156 |
|
---|
[698] | 1157 | Const Function IsVisible(x As Single, y As Single, width As Single, height As Single) As Boolean
|
---|
| 1158 | Dim b = FALSE As BOOL
|
---|
| 1159 | SetStatus(GdipIsVisibleRect(nativeGraphics, x, y, width, height, b))
|
---|
| 1160 | IsVisible = b As Boolean
|
---|
[33] | 1161 | End Function
|
---|
| 1162 |
|
---|
[698] | 1163 | Const Function IsVisible(ByRef rc As RectangleF) As Boolean
|
---|
| 1164 | IsVisible = IsVisible(rc.X, rc.Y, rc.Width, rc.Height)
|
---|
[33] | 1165 | End Function
|
---|
| 1166 |
|
---|
[698] | 1167 | Const Function Save() As Drawing2D.GraphicsState
|
---|
| 1168 | SetStatus(GdipSaveGraphics(nativeGraphics, Save))
|
---|
[33] | 1169 | End Function
|
---|
| 1170 |
|
---|
[698] | 1171 | Sub Restore(gstate As Drawing2D.GraphicsState)
|
---|
| 1172 | SetStatus(GdipRestoreGraphics(nativeGraphics, gstate))
|
---|
| 1173 | End Sub
|
---|
[33] | 1174 |
|
---|
[698] | 1175 | Function BeginContainer(ByRef dstrect As RectangleF, ByRef srcrect As RectangleF, unit As GraphicsUnit) As Drawing2D.GraphicsContainer
|
---|
| 1176 | SetStatus(GdipBeginContainer(nativeGraphics, dstrect, srcrect, unit, BeginContainer))
|
---|
[33] | 1177 | End Function
|
---|
| 1178 |
|
---|
[698] | 1179 | Function BeginContainer(ByRef dstrect As Rectangle, ByRef srcrect As Rectangle, unit As GraphicsUnit) As Drawing2D.GraphicsContainer
|
---|
| 1180 | SetStatus(GdipBeginContainerI(nativeGraphics, dstrect, srcrect, unit, BeginContainer))
|
---|
[33] | 1181 | End Function
|
---|
| 1182 |
|
---|
[698] | 1183 | Function BeginContainer() As Drawing2D.GraphicsContainer
|
---|
| 1184 | SetStatus(GdipBeginContainer2(nativeGraphics, BeginContainer))
|
---|
[33] | 1185 | End Function
|
---|
| 1186 |
|
---|
[698] | 1187 | Sub EndContainer(state As Drawing2D.GraphicsContainer)
|
---|
| 1188 | SetStatus(GdipEndContainer(nativeGraphics, state))
|
---|
| 1189 | End Sub
|
---|
[33] | 1190 |
|
---|
[698] | 1191 | Sub AddMetafileComment(data As *Byte, sizeData As DWord)
|
---|
| 1192 | SetStatus(GdipComment(nativeGraphics, sizeData, data))
|
---|
| 1193 | End Sub
|
---|
[33] | 1194 |
|
---|
[698] | 1195 | Static Function GetHalftonePalette() As HPALETTE
|
---|
| 1196 | GdipCreateHalftonePalette()
|
---|
[33] | 1197 | End Function
|
---|
| 1198 |
|
---|
[698] | 1199 | Function NativeGraphics() As *GpGraphics
|
---|
| 1200 | NativeGraphics = nativeGraphics
|
---|
[33] | 1201 | End Function
|
---|
| 1202 |
|
---|
[698] | 1203 | Sub Graphics(graphics As *GpGraphics)
|
---|
| 1204 | nativeGraphics = graphics
|
---|
| 1205 | End Sub
|
---|
[33] | 1206 |
|
---|
[698] | 1207 | Private
|
---|
| 1208 | Static Function getNativePen(pen As Pen) As *GpPen
|
---|
| 1209 | If ActiveBasic.IsNothing(pen) Then
|
---|
| 1210 | getNativePen = 0
|
---|
[33] | 1211 | Else
|
---|
[698] | 1212 | getNativePen = pen.NativePen
|
---|
[33] | 1213 | End If
|
---|
| 1214 | End Function
|
---|
| 1215 |
|
---|
[698] | 1216 | Static Function getNativeBrush(br As Brush) As *GpBrush
|
---|
| 1217 | If ActiveBasic.IsNothing(br) Then
|
---|
| 1218 | getNativeBrush = 0
|
---|
[33] | 1219 | Else
|
---|
[701] | 1220 | getNativeBrush = br.NativeBrush
|
---|
[33] | 1221 | End If
|
---|
| 1222 | End Function
|
---|
| 1223 |
|
---|
[698] | 1224 | Static Function getNativeFont(font As Font) As *GpFont
|
---|
| 1225 | If ActiveBasic.IsNothing(font) Then
|
---|
| 1226 | getNativeFont = 0
|
---|
[33] | 1227 | Else
|
---|
[698] | 1228 | getNativeFont = font.NativeFont
|
---|
[33] | 1229 | End If
|
---|
| 1230 | End Function
|
---|
| 1231 |
|
---|
[698] | 1232 | Static Function getNativeImage(image As Image) As *GpImage
|
---|
| 1233 | If ActiveBasic.IsNothing(image) Then
|
---|
| 1234 | getNativeImage = 0
|
---|
[33] | 1235 | Else
|
---|
[703] | 1236 | getNativeImage = image.NativeImage
|
---|
[33] | 1237 | End If
|
---|
| 1238 | End Function
|
---|
| 1239 |
|
---|
[698] | 1240 | Static Function getNativeImageAttributes(imageAttr As ImageAttributes) As *GpImageAttributes
|
---|
| 1241 | If ActiveBasic.IsNothing(imageAttr) Then
|
---|
| 1242 | getNativeImageAttributes = 0
|
---|
[33] | 1243 | Else
|
---|
[698] | 1244 | getNativeImageAttributes = imageAttr.nativeImage
|
---|
[33] | 1245 | End If
|
---|
| 1246 | End Function
|
---|
| 1247 |
|
---|
| 1248 | nativeGraphics As *GpGraphics
|
---|
| 1249 | End Class
|
---|
| 1250 |
|
---|
[635] | 1251 | End Namespace
|
---|
| 1252 | End Namespace
|
---|