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