| 1 | ' Classes/System/Drawing/Graphics.ab
|
|---|
| 2 |
|
|---|
| 3 | Namespace System
|
|---|
| 4 | Namespace Drawing
|
|---|
| 5 |
|
|---|
| 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
|
|---|
| 16 | Sub GraphicsPath(native As *GpPath)
|
|---|
| 17 | nativePath = native
|
|---|
| 18 | End Sub
|
|---|
| 19 | Function NativePath() As *GpPath
|
|---|
| 20 | End Function
|
|---|
| 21 | nativePath As *GpPath
|
|---|
| 22 | End Class
|
|---|
| 23 | Class CachedBitmap
|
|---|
| 24 | Public
|
|---|
| 25 | nativeCachedBitmap As *GpCachedBitmap
|
|---|
| 26 | End Class
|
|---|
| 27 |
|
|---|
| 28 | Delegate Function EnumerateMetafileProc(recordType As Imaging.EmfPlusRecordType, flags As DWord, dataSize As DWord, data As *Byte, callbackData As VoidPtr) As Boolean
|
|---|
| 29 |
|
|---|
| 30 | Namespace Detail
|
|---|
| 31 |
|
|---|
| 32 | TypeDef NativeEnumerateMetafileProc = *Function(recordType As Imaging.EmfPlusRecordType, flags As DWord, dataSize As DWord, data As *Byte, callbackData As VoidPtr) As Boolean
|
|---|
| 33 |
|
|---|
| 34 | Type EnumerateMetafileProcData
|
|---|
| 35 | Proc As EnumerateMetafileProc
|
|---|
| 36 | Data As VoidPtr
|
|---|
| 37 | End Type
|
|---|
| 38 |
|
|---|
| 39 | Function NativeEnumerateMetafileProcEntry(recordType As Imaging.EmfPlusRecordType, flags As DWord, dataSize As DWord, data As *Byte, callbackData As VoidPtr) As Boolean
|
|---|
| 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 |
|
|---|
| 47 | Class Graphics
|
|---|
| 48 | Public
|
|---|
| 49 | '=========================================================================
|
|---|
| 50 | ' Properties
|
|---|
| 51 | '=========================================================================
|
|---|
| 52 | Const Function Clip() As Region
|
|---|
| 53 | Clip = New Region
|
|---|
| 54 | SetStatus(GdipGetClip(nativeGraphics, Clip.nativeRegion))
|
|---|
| 55 | End Function
|
|---|
| 56 |
|
|---|
| 57 | Sub Clip(region As Region)
|
|---|
| 58 | Imports System.Drawing.Drawing2D
|
|---|
| 59 | SetStatus(GdipSetClipRegion(nativeGraphics, region.nativeRegion, CombineMode.Replace))
|
|---|
| 60 | End Sub
|
|---|
| 61 |
|
|---|
| 62 | Const Function ClipBounds() As RectangleF
|
|---|
| 63 | SetStatus(GdipGetClipBounds(nativeGraphics, ClipBounds))
|
|---|
| 64 | End Function
|
|---|
| 65 |
|
|---|
| 66 | Const Function ClipBoundsI() As Rectangle
|
|---|
| 67 | SetStatus(GdipGetClipBoundsI(nativeGraphics, ClipBoundsI))
|
|---|
| 68 | End Function
|
|---|
| 69 | /*
|
|---|
| 70 | Const Function CompositingMode() As Drawing2D.CompositingMode
|
|---|
| 71 | SetStatus(GdipGetCompositingMode(nativeGraphics, CompositingMode))
|
|---|
| 72 | End Function
|
|---|
| 73 |
|
|---|
| 74 | Sub CompositingMode(mode As Drawing2D.CompositingMode)
|
|---|
| 75 | SetStatus(GdipSetCompositingMode(nativeGraphics, mode))
|
|---|
| 76 | End Sub
|
|---|
| 77 |
|
|---|
| 78 | Function CompositingQuality() As Drawing2D.CompositingQuality
|
|---|
| 79 | SetStatus(GdipGetCompositingQuality(nativeGraphics, CompositingQuality))
|
|---|
| 80 | End Function
|
|---|
| 81 |
|
|---|
| 82 | Sub CompositingQuality(cq As Drawing2D.CompositingQuality)
|
|---|
| 83 | Return SetStatus(GdipSetCompositingQuality(nativeGraphics, cq))
|
|---|
| 84 | End Sub
|
|---|
| 85 | */
|
|---|
| 86 | Const Function DpiX() As Single
|
|---|
| 87 | SetStatus(GdipGetDpiX(nativeGraphics, DpiX))
|
|---|
| 88 | End Function
|
|---|
| 89 |
|
|---|
| 90 | Const Function DpiY() As Single
|
|---|
| 91 | SetStatus(GdipGetDpiY(nativeGraphics, DpiY))
|
|---|
| 92 | End Function
|
|---|
| 93 | /*
|
|---|
| 94 | Const Function InterpolationMode() As Drawing2D.InterpolationMode
|
|---|
| 95 | SetStatus(GdipGetInterpolationMode(nativeGraphics, InterpolationMode))
|
|---|
| 96 | End Function
|
|---|
| 97 |
|
|---|
| 98 | Sub InterpolationMode(im As Drawing2D.InterpolationMode)
|
|---|
| 99 | InterpolationMode = SetStatus(GdipSetInterpolationMode(nativeGraphics, im))
|
|---|
| 100 | End Sub
|
|---|
| 101 | */
|
|---|
| 102 | Const Function IsClipEmpty() As Boolean
|
|---|
| 103 | Dim b = FALSE As BOOL
|
|---|
| 104 | SetStatus(GdipIsClipEmpty(nativeGraphics, b))
|
|---|
| 105 | IsClipEmpty = b As Boolean
|
|---|
| 106 | End Function
|
|---|
| 107 |
|
|---|
| 108 | Const Function IsVisibleClipEmpty() As Boolean
|
|---|
| 109 | Dim b = FALSE As BOOL
|
|---|
| 110 | SetStatus(GdipIsVisibleClipEmpty(nativeGraphics, b))
|
|---|
| 111 | IsVisibleClipEmpty = b As Boolean
|
|---|
| 112 | End Function
|
|---|
| 113 |
|
|---|
| 114 | Sub PageScale(scale As Single)
|
|---|
| 115 | SetStatus(GdipSetPageScale(nativeGraphics, scale))
|
|---|
| 116 | End Sub
|
|---|
| 117 |
|
|---|
| 118 | Const Function PageScale() As Single
|
|---|
| 119 | SetStatus(GdipGetPageScale(nativeGraphics, PageScale))
|
|---|
| 120 | End Function
|
|---|
| 121 | /*
|
|---|
| 122 | Const Function PageUnit() As GraphicsUnit
|
|---|
| 123 | SetStatus(GdipGetPageUnit(nativeGraphics, PageUnit))
|
|---|
| 124 | End Function
|
|---|
| 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))
|
|---|
| 133 | End Function
|
|---|
| 134 | */
|
|---|
| 135 | Sub PixelOffsetMode(mode As Drawing2D.PixelOffsetMode)
|
|---|
| 136 | SetStatus(GdipSetPixelOffsetMode(nativeGraphics, mode))
|
|---|
| 137 | End Sub
|
|---|
| 138 |
|
|---|
| 139 | Function RenderingOrigin() As Point
|
|---|
| 140 | With RenderingOrigin
|
|---|
| 141 | .X = 0
|
|---|
| 142 | .Y = 0
|
|---|
| 143 | SetStatus(GdipGetRenderingOrigin(nativeGraphics, .X, .Y))
|
|---|
| 144 | End With
|
|---|
| 145 | End Function
|
|---|
| 146 |
|
|---|
| 147 | Sub RenderingOrigin(pt As Point)
|
|---|
| 148 | SetStatus(GdipSetRenderingOrigin(nativeGraphics, pt.X, pt.Y))
|
|---|
| 149 | End Sub
|
|---|
| 150 | /*
|
|---|
| 151 | Function SmoothingMode() As Drawing2D.SmoothingMode
|
|---|
| 152 | SetStatus(GdipGetSmoothingMode(nativeGraphics, SmoothingMode))
|
|---|
| 153 | End Function
|
|---|
| 154 | */
|
|---|
| 155 | Sub SmoothingMode(mode As Drawing2D.SmoothingMode)
|
|---|
| 156 | SetStatus(GdipSetSmoothingMode(nativeGraphics, mode))
|
|---|
| 157 | End Sub
|
|---|
| 158 |
|
|---|
| 159 | Function TextContrast() As DWord
|
|---|
| 160 | SetStatus(GdipGetTextContrast(nativeGraphics, TextContrast))
|
|---|
| 161 | End Function
|
|---|
| 162 |
|
|---|
| 163 | Sub TextContrast(contrast As DWord)
|
|---|
| 164 | SetStatus(GdipSetTextContrast(nativeGraphics, contrast))
|
|---|
| 165 | End Sub
|
|---|
| 166 | /*
|
|---|
| 167 | Function TextRenderingHint() As Text.TextRenderingHint
|
|---|
| 168 | SetStatus(GdipGetTextRenderingHint(nativeGraphics, ByVal VarPtr(TextRenderingHint)))
|
|---|
| 169 | End Function
|
|---|
| 170 | */
|
|---|
| 171 | Sub TextRenderingHint(mode As TextRenderingHint)
|
|---|
| 172 | SetStatus(GdipSetTextRenderingHint(nativeGraphics, mode))
|
|---|
| 173 | End Sub
|
|---|
| 174 |
|
|---|
| 175 | Function Transform() As Drawing2D.Matrix
|
|---|
| 176 | Dim native As *GpMatrix
|
|---|
| 177 | SetStatus(GdipGetWorldTransform(nativeGraphics, native))
|
|---|
| 178 | Transform = New Drawing2D.Matrix(native)
|
|---|
| 179 | End Function
|
|---|
| 180 |
|
|---|
| 181 | Sub Transform(matrix As Drawing2D.Matrix)
|
|---|
| 182 | SetStatus(GdipSetWorldTransform(nativeGraphics, matrix.nativeMatrix))
|
|---|
| 183 | End Sub
|
|---|
| 184 |
|
|---|
| 185 | Function VisibleClipBounds() As RectangleF
|
|---|
| 186 | SetStatus(GdipGetVisibleClipBounds(nativeGraphics, VisibleClipBounds))
|
|---|
| 187 | End Function
|
|---|
| 188 |
|
|---|
| 189 | Function VisibleClipBoundsI() As Rectangle
|
|---|
| 190 | SetStatus(GdipGetVisibleClipBoundsI(nativeGraphics, VisibleClipBoundsI))
|
|---|
| 191 | End Function
|
|---|
| 192 |
|
|---|
| 193 | '=========================================================================
|
|---|
| 194 | ' Methods
|
|---|
| 195 | '=========================================================================
|
|---|
| 196 | Static Function FromHDC(hdc As HDC) As Graphics
|
|---|
| 197 | Dim graphics = 0 As *GpGraphics
|
|---|
| 198 | SetStatus(GdipCreateFromHDC(hdc, graphics))
|
|---|
| 199 | Return New Graphics(graphics)
|
|---|
| 200 | End Function
|
|---|
| 201 |
|
|---|
| 202 | Static Function FromHDC(hdc As HDC, hdevice As HANDLE) As Graphics
|
|---|
| 203 | Dim graphics = 0 As *GpGraphics
|
|---|
| 204 | SetStatus(GdipCreateFromHDC2(hdc, hdevice, graphics))
|
|---|
| 205 | Return New Graphics(graphics)
|
|---|
| 206 | End Function
|
|---|
| 207 |
|
|---|
| 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)
|
|---|
| 212 | End Function
|
|---|
| 213 |
|
|---|
| 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)
|
|---|
| 222 | End Function
|
|---|
| 223 |
|
|---|
| 224 | Static Function FromImage(image As Image) As Graphics
|
|---|
| 225 | If ActiveBasic.IsNothing(image) Then
|
|---|
| 226 | Throw New ArgumentNullException("image")
|
|---|
| 227 | End If
|
|---|
| 228 | Dim graphics = 0 As *GpGraphics
|
|---|
| 229 | SetStatus(GdipGetImageGraphicsContext(image.NativeImage, graphics))
|
|---|
| 230 | Return New Graphics(graphics)
|
|---|
| 231 | End Function
|
|---|
| 232 |
|
|---|
| 233 | Sub Dispose()
|
|---|
| 234 | GdipDeleteGraphics(nativeGraphics)
|
|---|
| 235 | nativeGraphics = 0
|
|---|
| 236 | End Sub
|
|---|
| 237 |
|
|---|
| 238 | Sub ~Graphics()
|
|---|
| 239 | Dispose()
|
|---|
| 240 | End Sub
|
|---|
| 241 |
|
|---|
| 242 | Sub Flush()
|
|---|
| 243 | GdipFlush(nativeGraphics, System.Drawing.Drawing2D.FlushIntention.Flush)
|
|---|
| 244 | End Sub
|
|---|
| 245 |
|
|---|
| 246 | Sub Flush(intention As Drawing2D.FlushIntention)
|
|---|
| 247 | GdipFlush(nativeGraphics, intention)
|
|---|
| 248 | End Sub
|
|---|
| 249 |
|
|---|
| 250 | Function GetHDC() As HDC
|
|---|
| 251 | GetHDC = 0
|
|---|
| 252 | SetStatus(GdipGetDC(nativeGraphics, GetHDC))
|
|---|
| 253 | End Function
|
|---|
| 254 |
|
|---|
| 255 | Sub ReleaseHDC(hdc As HDC)
|
|---|
| 256 | SetStatus(GdipReleaseDC(nativeGraphics, hdc))
|
|---|
| 257 | End Sub
|
|---|
| 258 |
|
|---|
| 259 | Sub ResetTransform()
|
|---|
| 260 | SetStatus(GdipResetWorldTransform(nativeGraphics))
|
|---|
| 261 | End Sub
|
|---|
| 262 |
|
|---|
| 263 | Sub MultiplyTransform(matrix As Drawing2D.Matrix)
|
|---|
| 264 | SetStatus(GdipMultiplyWorldTransform(nativeGraphics, matrix.nativeMatrix, System.Drawing.Drawing2D.MatrixOrder.Prepend))
|
|---|
| 265 | End Sub
|
|---|
| 266 |
|
|---|
| 267 | Sub MultiplyTransform(matrix As Drawing2D.Matrix, order As Drawing2D.MatrixOrder)
|
|---|
| 268 | SetStatus(GdipMultiplyWorldTransform(nativeGraphics, matrix.nativeMatrix, order))
|
|---|
| 269 | End Sub
|
|---|
| 270 |
|
|---|
| 271 | Sub TranslateTransform(dx As Single, dy As Single)
|
|---|
| 272 | SetStatus(GdipTranslateWorldTransform(nativeGraphics, dx, dy, System.Drawing.Drawing2D.MatrixOrder.Prepend))
|
|---|
| 273 | End Sub
|
|---|
| 274 |
|
|---|
| 275 | Sub TranslateTransform(dx As Single, dy As Single, order As Drawing2D.MatrixOrder)
|
|---|
| 276 | SetStatus(GdipTranslateWorldTransform(nativeGraphics, dx, dy, order))
|
|---|
| 277 | End Sub
|
|---|
| 278 |
|
|---|
| 279 | Sub ScaleTransform(sx As Single, sy As Single)
|
|---|
| 280 | SetStatus(GdipScaleWorldTransform(nativeGraphics, sx, sy, System.Drawing.Drawing2D.MatrixOrder.Prepend))
|
|---|
| 281 | End Sub
|
|---|
| 282 |
|
|---|
| 283 | Sub ScaleTransform(sx As Single, sy As Single, order As Drawing2D.MatrixOrder)
|
|---|
| 284 | SetStatus(GdipScaleWorldTransform(nativeGraphics, sx, sy, order))
|
|---|
| 285 | End Sub
|
|---|
| 286 |
|
|---|
| 287 | Sub RotateTransform(angle As Single)
|
|---|
| 288 | SetStatus(GdipRotateWorldTransform(nativeGraphics, angle, System.Drawing.Drawing2D.MatrixOrder.Prepend))
|
|---|
| 289 | End Sub
|
|---|
| 290 |
|
|---|
| 291 | Sub RotateTransform(angle As Single, order As Drawing2D.MatrixOrder)
|
|---|
| 292 | SetStatus(GdipRotateWorldTransform(nativeGraphics, angle, order))
|
|---|
| 293 | End Sub
|
|---|
| 294 |
|
|---|
| 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
|
|---|
| 298 |
|
|---|
| 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
|
|---|
| 302 |
|
|---|
| 303 | Const Function GetNearestColor(color As Color) As Color
|
|---|
| 304 | GetNearestColor = color
|
|---|
| 305 | SetStatus(GdipGetNearestColor(nativeGraphics, GetNearestColor))
|
|---|
| 306 | End Function
|
|---|
| 307 |
|
|---|
| 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
|
|---|
| 311 |
|
|---|
| 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
|
|---|
| 315 |
|
|---|
| 316 | Sub DrawLines(pen As Pen, points As *PointF, count As Long)
|
|---|
| 317 | SetStatus(GdipDrawLines(nativeGraphics, pen.NativePen, points, count))
|
|---|
| 318 | End Sub
|
|---|
| 319 |
|
|---|
| 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
|
|---|
| 323 |
|
|---|
| 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
|
|---|
| 327 |
|
|---|
| 328 | Sub DrawLines(pen As Pen, points As *Point, count As Long)
|
|---|
| 329 | SetStatus(GdipDrawLinesI(nativeGraphics, pen.NativePen, points, count))
|
|---|
| 330 | End Sub
|
|---|
| 331 |
|
|---|
| 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
|
|---|
| 335 |
|
|---|
| 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
|
|---|
| 339 |
|
|---|
| 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
|
|---|
| 343 |
|
|---|
| 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
|
|---|
| 347 |
|
|---|
| 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
|
|---|
| 351 |
|
|---|
| 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
|
|---|
| 355 |
|
|---|
| 356 | Sub DrawBeziers(pen As Pen, points As *PointF, count As Long)
|
|---|
| 357 | SetStatus(GdipDrawBeziers(nativeGraphics, pen.NativePen, points, count))
|
|---|
| 358 | End Sub
|
|---|
| 359 |
|
|---|
| 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
|
|---|
| 363 |
|
|---|
| 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
|
|---|
| 367 |
|
|---|
| 368 | Sub DrawBeziers(pen As Pen, points As *Point, count As Long)
|
|---|
| 369 | SetStatus(GdipDrawBeziersI(nativeGraphics, pen.NativePen, points, count))
|
|---|
| 370 | End Sub
|
|---|
| 371 |
|
|---|
| 372 | Sub DrawRectangle(pen As Pen, ByRef rect As RectangleF)
|
|---|
| 373 | DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height)
|
|---|
| 374 | End Sub
|
|---|
| 375 |
|
|---|
| 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
|
|---|
| 379 |
|
|---|
| 380 | Sub DrawRectangles(pen As Pen, rects As *RectangleF, count As Long)
|
|---|
| 381 | SetStatus(GdipDrawRectangles(nativeGraphics, pen.NativePen, rects, count))
|
|---|
| 382 | End Sub
|
|---|
| 383 |
|
|---|
| 384 | Sub DrawRectangle(pen As Pen, ByRef rect As Rectangle)
|
|---|
| 385 | DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height)
|
|---|
| 386 | End Sub
|
|---|
| 387 |
|
|---|
| 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
|
|---|
| 391 |
|
|---|
| 392 | Sub DrawRectangles(pen As Pen, rects As *Rectangle, count As Long)
|
|---|
| 393 | SetStatus(GdipDrawRectanglesI(nativeGraphics, pen.NativePen, rects, count))
|
|---|
| 394 | End Sub
|
|---|
| 395 |
|
|---|
| 396 | Sub DrawEllipse(pen As Pen, ByRef rect As RectangleF)
|
|---|
| 397 | DrawEllipse(pen, rect.X, rect.Y, rect.Width, rect.Height)
|
|---|
| 398 | End Sub
|
|---|
| 399 |
|
|---|
| 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
|
|---|
| 403 |
|
|---|
| 404 | Sub DrawEllipse(pen As Pen, ByRef rect As Rectangle)
|
|---|
| 405 | DrawEllipse(pen, rect.X, rect.Y, rect.Width, rect.Height)
|
|---|
| 406 | End Sub
|
|---|
| 407 |
|
|---|
| 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
|
|---|
| 411 |
|
|---|
| 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
|
|---|
| 415 |
|
|---|
| 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
|
|---|
| 419 |
|
|---|
| 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
|
|---|
| 423 |
|
|---|
| 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
|
|---|
| 427 |
|
|---|
| 428 | Sub DrawPolygon(pen As Pen, points As *PointF, count As Long)
|
|---|
| 429 | SetStatus(GdipDrawPolygon(nativeGraphics, pen.NativePen, points, count))
|
|---|
| 430 | End Sub
|
|---|
| 431 |
|
|---|
| 432 | Sub DrawPolygon(pen As Pen, points As *Point, count As Long)
|
|---|
| 433 | SetStatus(GdipDrawPolygonI(nativeGraphics, pen.NativePen, points, count))
|
|---|
| 434 | End Sub
|
|---|
| 435 |
|
|---|
| 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
|
|---|
| 442 |
|
|---|
| 443 | Sub DrawCurve(pen As Pen, points As *PointF, count As Long)
|
|---|
| 444 | SetStatus(GdipDrawCurve(nativeGraphics, pen.NativePen, points, count))
|
|---|
| 445 | End Sub
|
|---|
| 446 |
|
|---|
| 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
|
|---|
| 450 |
|
|---|
| 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
|
|---|
| 454 |
|
|---|
| 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
|
|---|
| 458 |
|
|---|
| 459 | Sub DrawCurve(pen As Pen, points As *Point, count As Long)
|
|---|
| 460 | SetStatus(GdipDrawCurveI(nativeGraphics, pen.NativePen, points, count))
|
|---|
| 461 | End Sub
|
|---|
| 462 |
|
|---|
| 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
|
|---|
| 466 |
|
|---|
| 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
|
|---|
| 470 |
|
|---|
| 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
|
|---|
| 474 |
|
|---|
| 475 | Sub DrawClosedCurve(pen As Pen, points As *PointF, count As Long)
|
|---|
| 476 | SetStatus(GdipDrawClosedCurve(nativeGraphics, pen.NativePen, points, count))
|
|---|
| 477 | End Sub
|
|---|
| 478 |
|
|---|
| 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
|
|---|
| 482 |
|
|---|
| 483 | Sub DrawClosedCurve(pen As Pen, points As *Point, count As Long)
|
|---|
| 484 | SetStatus(GdipDrawClosedCurveI(nativeGraphics, pen.NativePen, points, count))
|
|---|
| 485 | End Sub
|
|---|
| 486 |
|
|---|
| 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
|
|---|
| 490 |
|
|---|
| 491 | Sub Clear(color As Color)
|
|---|
| 492 | SetStatus(GdipGraphicsClear(nativeGraphics, color))
|
|---|
| 493 | End Sub
|
|---|
| 494 |
|
|---|
| 495 | Sub FillRectangle(brush As Brush, ByRef rect As RectangleF)
|
|---|
| 496 | FillRectangle(brush, rect.X, rect.Y, rect.Width, rect.Height)
|
|---|
| 497 | End Sub
|
|---|
| 498 |
|
|---|
| 499 | Sub FillRectangle(brush As Brush, x As Single, y As Single, width As Single, height As Single)
|
|---|
| 500 | SetStatus(GdipFillRectangle(nativeGraphics, brush.NativeBrush, x, y, width, height))
|
|---|
| 501 | End Sub
|
|---|
| 502 |
|
|---|
| 503 | Sub FillRectangles(brush As Brush, rects As *RectangleF, count As Long)
|
|---|
| 504 | SetStatus(GdipFillRectangles(nativeGraphics,brush.NativeBrush,rects, count))
|
|---|
| 505 | End Sub
|
|---|
| 506 |
|
|---|
| 507 | Sub FillRectangle(brush As Brush, ByRef rect As Rectangle)
|
|---|
| 508 | FillRectangle(brush, rect.X, rect.Y, rect.Width, rect.Height)
|
|---|
| 509 | End Sub
|
|---|
| 510 |
|
|---|
| 511 | Sub FillRectangle(brush As Brush, x As Long, y As Long, width As Long, height As Long)
|
|---|
| 512 | SetStatus(GdipFillRectangleI(nativeGraphics, brush.NativeBrush, x, y, width, height))
|
|---|
| 513 | End Sub
|
|---|
| 514 |
|
|---|
| 515 | Sub FillRectangles(brush As Brush, rects As *Rectangle, count As Long)
|
|---|
| 516 | SetStatus(GdipFillRectanglesI(nativeGraphics, brush.NativeBrush, rects, count))
|
|---|
| 517 | End Sub
|
|---|
| 518 |
|
|---|
| 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
|
|---|
| 522 |
|
|---|
| 523 | Sub FillPolygon(brush As Brush, points As *PointF, count As Long, fillMode As Drawing2D.FillMode)
|
|---|
| 524 | SetStatus(GdipFillPolygon(nativeGraphics, brush.NativeBrush, points, count, fillMode))
|
|---|
| 525 | End Sub
|
|---|
| 526 |
|
|---|
| 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
|
|---|
| 530 |
|
|---|
| 531 | Sub FillPolygon(brush As Brush, points As *Point, count As Long, fillMode As Drawing2D.FillMode)
|
|---|
| 532 | SetStatus(GdipFillPolygonI(nativeGraphics, brush.NativeBrush, points, count, fillMode))
|
|---|
| 533 | End Sub
|
|---|
| 534 |
|
|---|
| 535 | Sub FillEllipse(brush As Brush, ByRef rect As RectangleF)
|
|---|
| 536 | FillEllipse(brush, rect.X, rect.Y, rect.Width, rect.Height)
|
|---|
| 537 | End Sub
|
|---|
| 538 |
|
|---|
| 539 | Sub FillEllipse(brush As Brush, x As Single, y As Single, width As Single, height As Single)
|
|---|
| 540 | SetStatus(GdipFillEllipse(nativeGraphics, brush.NativeBrush, x, y, width, height))
|
|---|
| 541 | End Sub
|
|---|
| 542 |
|
|---|
| 543 | Sub FillEllipse(brush As Brush, ByRef rect As Rectangle)
|
|---|
| 544 | FillEllipse(brush, rect.X, rect.Y, rect.Width, rect.Height)
|
|---|
| 545 | End Sub
|
|---|
| 546 |
|
|---|
| 547 | Sub FillEllipse(brush As Brush, x As Long, y As Long, width As Long, height As Long)
|
|---|
| 548 | SetStatus(GdipFillEllipseI(nativeGraphics, brush.NativeBrush, x, y, width, height))
|
|---|
| 549 | End Sub
|
|---|
| 550 |
|
|---|
| 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
|
|---|
| 554 |
|
|---|
| 555 | Sub FillPie(brush As Brush, x As Single, y As Single, width As Single, height As Single, startAngle As Single, sweepAngle As Single)
|
|---|
| 556 | SetStatus(GdipFillPie(nativeGraphics, brush.NativeBrush, x, y, width, height, startAngle, sweepAngle))
|
|---|
| 557 | End Sub
|
|---|
| 558 |
|
|---|
| 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
|
|---|
| 562 |
|
|---|
| 563 | Sub FillPie(brush As Brush, x As Long, y As Long, width As Long, height As Long, startAngle As Single, sweepAngle As Single)
|
|---|
| 564 | SetStatus(GdipFillPieI(nativeGraphics, brush.NativeBrush, x, y, width, height, startAngle, sweepAngle))
|
|---|
| 565 | End Sub
|
|---|
| 566 |
|
|---|
| 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
|
|---|
| 571 | SetStatus(GdipFillPath(nativeGraphics, brush.NativeBrush, path.nativePath))
|
|---|
| 572 | End Sub
|
|---|
| 573 |
|
|---|
| 574 | Sub FillClosedCurve(brush As Brush, points As *PointF, count As Long)
|
|---|
| 575 | SetStatus(GdipFillClosedCurve(nativeGraphics, brush.NativeBrush, points, count))
|
|---|
| 576 | End Sub
|
|---|
| 577 |
|
|---|
| 578 | Sub FillClosedCurve(brush As Brush, points As *PointF, count As Long, fillMode As Drawing2D.FillMode)
|
|---|
| 579 | SetStatus(GdipFillClosedCurve2(nativeGraphics, brush.NativeBrush, points, count, 0.5, fillMode))
|
|---|
| 580 | End Sub
|
|---|
| 581 |
|
|---|
| 582 | Sub FillClosedCurve(brush As Brush, points As *PointF, count As Long, fillMode As Drawing2D.FillMode, tension As Single)
|
|---|
| 583 | SetStatus(GdipFillClosedCurve2(nativeGraphics, brush.NativeBrush, points, count, tension, fillMode))
|
|---|
| 584 | End Sub
|
|---|
| 585 |
|
|---|
| 586 | Sub FillClosedCurve(brush As Brush, points As *Point, count As Long)
|
|---|
| 587 | SetStatus(GdipFillClosedCurveI(nativeGraphics, brush.NativeBrush, points, count))
|
|---|
| 588 | End Sub
|
|---|
| 589 |
|
|---|
| 590 | Sub FillClosedCurve(brush As Brush, points As *Point, count As Long, fillMode As Drawing2D.FillMode)
|
|---|
| 591 | SetStatus(GdipFillClosedCurve2I(nativeGraphics, brush.NativeBrush, points, count, 0.5, fillMode))
|
|---|
| 592 | End Sub
|
|---|
| 593 |
|
|---|
| 594 | Sub FillClosedCurve(brush As Brush, points As *Point, count As Long, fillMode As Drawing2D.FillMode, tension As Single)
|
|---|
| 595 | SetStatus(GdipFillClosedCurve2I(nativeGraphics, brush.NativeBrush, points, count, tension, fillMode))
|
|---|
| 596 | End Sub
|
|---|
| 597 |
|
|---|
| 598 | Sub FillRegion(brush As Brush, region As Region)
|
|---|
| 599 | SetStatus(GdipFillRegion(nativeGraphics, brush.NativeBrush, region.nativeRegion))
|
|---|
| 600 | End Sub
|
|---|
| 601 |
|
|---|
| 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
|
|---|
| 609 |
|
|---|
| 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
|
|---|
| 618 |
|
|---|
| 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)
|
|---|
| 621 | Dim nativeFormat = GetNativeStringFormat(stringFormat)
|
|---|
| 622 | Dim nativeBrush = getNativeBrush(brush)
|
|---|
| 623 | SetStatus(GdipDrawString(nativeGraphics, str, length, nativeFont, layoutRect, nativeFormat, nativeBrush))
|
|---|
| 624 | End Sub
|
|---|
| 625 |
|
|---|
| 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
|
|---|
| 629 |
|
|---|
| 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
|
|---|
| 638 |
|
|---|
| 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
|
|---|
| 644 |
|
|---|
| 645 | Function MeasureString(s As String, font As Font) As SizeF
|
|---|
| 646 | Dim pt As PointF
|
|---|
| 647 | MeasureString = MeasureString(s, font, pt, Nothing)
|
|---|
| 648 | End Function
|
|---|
| 649 |
|
|---|
| 650 | Function MeasureString(s As String, font As Font, ByRef layoutRectSize As SizeF) As SizeF
|
|---|
| 651 | MeasureString = MeasureString(s, font, layoutRectSize, Nothing)
|
|---|
| 652 | End Function
|
|---|
| 653 |
|
|---|
| 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)
|
|---|
| 658 | End Function
|
|---|
| 659 |
|
|---|
| 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)
|
|---|
| 664 | End Function
|
|---|
| 665 |
|
|---|
| 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)
|
|---|
| 670 | End Function
|
|---|
| 671 |
|
|---|
| 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)
|
|---|
| 676 | End Function
|
|---|
| 677 |
|
|---|
| 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)
|
|---|
| 681 | End Function
|
|---|
| 682 |
|
|---|
| 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)
|
|---|
| 685 | End Function
|
|---|
| 686 |
|
|---|
| 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)
|
|---|
| 689 | End Function
|
|---|
| 690 |
|
|---|
| 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)
|
|---|
| 700 | End Function
|
|---|
| 701 |
|
|---|
| 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)
|
|---|
| 711 | End Function
|
|---|
| 712 |
|
|---|
| 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))
|
|---|
| 715 | End Function
|
|---|
| 716 |
|
|---|
| 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)
|
|---|
| 727 | End Function
|
|---|
| 728 |
|
|---|
| 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)
|
|---|
| 731 | Dim nativeFormat = GetNativeStringFormat(stringFormat)
|
|---|
| 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
|
|---|
| 736 | End Function
|
|---|
| 737 |
|
|---|
| 738 | Public
|
|---|
| 739 |
|
|---|
| 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)
|
|---|
| 744 | End Function
|
|---|
| 745 |
|
|---|
| 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
|
|---|
| 749 | End If
|
|---|
| 750 | Dim count As Long
|
|---|
| 751 | SetStatus(GdipGetStringFormatMeasurableCharacterRangeCount(stringFormat.NativeFormat, count))
|
|---|
| 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
|
|---|
| 756 |
|
|---|
| 757 | Dim i As Long
|
|---|
| 758 | For i = 0 To ELM(count)
|
|---|
| 759 | Dim t = regions[i]
|
|---|
| 760 | nativeRegions[i] = t.nativeRegion
|
|---|
| 761 | Next
|
|---|
| 762 | Dim nativeFont = getNativeFont(font)
|
|---|
| 763 | SetStatus(GdipMeasureCharacterRanges(nativeGraphics, str, length, nativeFont, layoutRect, stringFormat.NativeFormat, count, nativeRegions))
|
|---|
| 764 | End Function
|
|---|
| 765 |
|
|---|
| 766 | 'DrawDriverString
|
|---|
| 767 | 'MeasureDriverString
|
|---|
| 768 |
|
|---|
| 769 | Sub DrawCachedBitmap(cb As CachedBitmap, x As Long, y As Long)
|
|---|
| 770 | SetStatus(GdipDrawCachedBitmap(nativeGraphics, cb.nativeCachedBitmap, x, y))
|
|---|
| 771 | End Sub
|
|---|
| 772 |
|
|---|
| 773 | Sub DrawImage(image As Image, ByRef point As PointF)
|
|---|
| 774 | DrawImage(image, point.X, point.Y)
|
|---|
| 775 | End Sub
|
|---|
| 776 |
|
|---|
| 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
|
|---|
| 781 |
|
|---|
| 782 | Sub DrawImage(image As Image, ByRef rect As RectangleF)
|
|---|
| 783 | DrawImage(image, rect.X, rect.Y, rect.Width, rect.Height)
|
|---|
| 784 | End Sub
|
|---|
| 785 |
|
|---|
| 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
|
|---|
| 790 |
|
|---|
| 791 | Sub DrawImage(image As Image, ByRef point As Point)
|
|---|
| 792 | DrawImage(image, point.X, point.Y)
|
|---|
| 793 | End Sub
|
|---|
| 794 |
|
|---|
| 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
|
|---|
| 799 |
|
|---|
| 800 | Sub DrawImage(image As Image, ByRef rect As Rectangle)
|
|---|
| 801 | DrawImage(image, rect.X, rect.Y, rect.Width, rect.Height)
|
|---|
| 802 | End Sub
|
|---|
| 803 |
|
|---|
| 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
|
|---|
| 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 |
|
|---|
| 817 | Sub DrawImage(image As Image, destPoints As *PointF, count As Long)
|
|---|
| 818 | If count <> 3 And count <> 4 Then
|
|---|
| 819 | SetStatus(InvalidParameter)
|
|---|
| 820 | End If
|
|---|
| 821 |
|
|---|
| 822 | Dim nativeImage = getNativeImage(image)
|
|---|
| 823 | SetStatus(GdipDrawImagePoints(nativeGraphics, nativeImage, destPoints, count))
|
|---|
| 824 | End Sub
|
|---|
| 825 |
|
|---|
| 826 | Sub DrawImage(image As Image, destPoints As *Point, count As Long)
|
|---|
| 827 | If count <> 3 And count <> 4 Then
|
|---|
| 828 | SetStatus(InvalidParameter)
|
|---|
| 829 | End If
|
|---|
| 830 |
|
|---|
| 831 | Dim nativeImage = getNativeImage(image)
|
|---|
| 832 | SetStatus(GdipDrawImagePointsI(nativeGraphics, nativeImage, destPoints, count))
|
|---|
| 833 | End Sub
|
|---|
| 834 |
|
|---|
| 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
|
|---|
| 838 |
|
|---|
| 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
|
|---|
| 842 |
|
|---|
| 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
|
|---|
| 847 |
|
|---|
| 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
|
|---|
| 852 |
|
|---|
| 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)
|
|---|
| 855 |
|
|---|
| 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
|
|---|
| 861 |
|
|---|
| 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)
|
|---|
| 864 |
|
|---|
| 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
|
|---|
| 870 |
|
|---|
| 871 | Sub DrawImage(image As Image, ByRef destRect As RectangleF,
|
|---|
| 872 | srcx As Single, srcy As Single, srcwidth As Single, srcheight As Single, srcUnit As GraphicsUnit,
|
|---|
| 873 | imageAttr = Nothing As ImageAttributes, callback = Nothing As DrawImageAbort, callbackData = 0 As VoidPtr)
|
|---|
| 874 |
|
|---|
| 875 | Dim nativeImage = getNativeImage(image)
|
|---|
| 876 | Dim nativeImageAttr = getNativeImageAttributes(imageAttr)
|
|---|
| 877 | SetStatus(GdipDrawImageRectRect(nativeGraphics, nativeImageAttr,
|
|---|
| 878 | destRect.X, destRect.Y, destRect.Width, destRect.Height, srcx, srcy, srcwidth, srcheight,
|
|---|
| 879 | srcUnit, nativeImageAttr, callback, callbackData))
|
|---|
| 880 | End Sub
|
|---|
| 881 |
|
|---|
| 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)
|
|---|
| 885 |
|
|---|
| 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
|
|---|
| 892 |
|
|---|
| 893 | Sub EnumerateMetafile(metafile As Imaging.Metafile, ByRef destPoint As PointF,
|
|---|
| 894 | callback As EnumerateMetafileProc, callbackData = 0 As VoidPtr, imageAttr = Nothing As ImageAttributes)
|
|---|
| 895 |
|
|---|
| 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
|
|---|
| 904 |
|
|---|
| 905 | Sub EnumerateMetafile(metafile As Imaging.Metafile, ByRef destPoint As Point,
|
|---|
| 906 | callback As EnumerateMetafileProc, callbackData = 0 As VoidPtr, imageAttr = Nothing As ImageAttributes)
|
|---|
| 907 |
|
|---|
| 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
|
|---|
| 916 |
|
|---|
| 917 | Sub EnumerateMetafile(metafile As Imaging.Metafile, ByRef destRect As RectangleF,
|
|---|
| 918 | callback As EnumerateMetafileProc, callbackData = 0 As VoidPtr, imageAttr = Nothing As ImageAttributes)
|
|---|
| 919 |
|
|---|
| 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
|
|---|
| 928 |
|
|---|
| 929 | Sub EnumerateMetafile(metafile As Imaging.Metafile, ByRef destRect As Rectangle,
|
|---|
| 930 | callback As EnumerateMetafileProc, callbackData = 0 As VoidPtr, imageAttr = Nothing As ImageAttributes)
|
|---|
| 931 |
|
|---|
| 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
|
|---|
| 940 |
|
|---|
| 941 | Sub EnumerateMetafile(metafile As Imaging.Metafile, destPoints As *PointF, count As Long,
|
|---|
| 942 | callback As EnumerateMetafileProc, callbackData = 0 As VoidPtr, imageAttr = Nothing As ImageAttributes)
|
|---|
| 943 |
|
|---|
| 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
|
|---|
| 952 |
|
|---|
| 953 | Sub EnumerateMetafile(metafile As Imaging.Metafile, destPoints As *Point, count As Long,
|
|---|
| 954 | callback As EnumerateMetafileProc, callbackData = 0 As VoidPtr, imageAttr = Nothing As ImageAttributes)
|
|---|
| 955 |
|
|---|
| 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
|
|---|
| 964 |
|
|---|
| 965 | Sub EnumerateMetafile(metafile As Imaging.Metafile,
|
|---|
| 966 | ByRef destPoint As PointF, ByRef srcRect As RectangleF, srcUnit As GraphicsUnit,
|
|---|
| 967 | callback As EnumerateMetafileProc, callbackData = 0 As VoidPtr, imageAttr = Nothing As ImageAttributes)
|
|---|
| 968 |
|
|---|
| 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
|
|---|
| 977 |
|
|---|
| 978 | Sub EnumerateMetafile(metafile As Imaging.Metafile,
|
|---|
| 979 | ByRef destPoint As Point, ByRef srcRect As Rectangle, srcUnit As GraphicsUnit,
|
|---|
| 980 | callback As EnumerateMetafileProc, callbackData = 0 As VoidPtr, imageAttr = Nothing As ImageAttributes)
|
|---|
| 981 |
|
|---|
| 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
|
|---|
| 990 |
|
|---|
| 991 | Sub EnumerateMetafile(metafile As Imaging.Metafile,
|
|---|
| 992 | ByRef destRect As RectangleF, ByRef srcRect As RectangleF, srcUnit As GraphicsUnit,
|
|---|
| 993 | callback As EnumerateMetafileProc, callbackData = 0 As VoidPtr, imageAttr = Nothing As ImageAttributes)
|
|---|
| 994 |
|
|---|
| 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
|
|---|
| 1003 |
|
|---|
| 1004 | Sub EnumerateMetafile(metafile As Imaging.Metafile,
|
|---|
| 1005 | ByRef destRect As Rectangle, ByRef srcRect As Rectangle, srcUnit As GraphicsUnit,
|
|---|
| 1006 | callback As EnumerateMetafileProc, callbackData = 0 As VoidPtr, imageAttr = Nothing As ImageAttributes)
|
|---|
| 1007 |
|
|---|
| 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
|
|---|
| 1016 |
|
|---|
| 1017 | Sub EnumerateMetafile(metafile As Imaging.Metafile,
|
|---|
| 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)
|
|---|
| 1020 |
|
|---|
| 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
|
|---|
| 1029 |
|
|---|
| 1030 | Sub EnumerateMetafile(metafile As Imaging.Metafile,
|
|---|
| 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)
|
|---|
| 1033 |
|
|---|
| 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
|
|---|
| 1042 |
|
|---|
| 1043 | Sub SetClip(g As Graphics)
|
|---|
| 1044 | SetClip(g, System.Drawing.Drawing2D.CombineMode.Replace)
|
|---|
| 1045 | End Sub
|
|---|
| 1046 |
|
|---|
| 1047 | Sub SetClip(g As Graphics, combineMode As Drawing2D.CombineMode)
|
|---|
| 1048 | SetStatus(GdipSetClipGraphics(nativeGraphics, g.nativeGraphics, combineMode))
|
|---|
| 1049 | End Sub
|
|---|
| 1050 |
|
|---|
| 1051 | Sub SetClip(ByRef rc As RectangleF)
|
|---|
| 1052 | SetClip(rc, System.Drawing.Drawing2D.CombineMode.Replace)
|
|---|
| 1053 | End Sub
|
|---|
| 1054 |
|
|---|
| 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
|
|---|
| 1058 |
|
|---|
| 1059 | Sub SetClip(ByRef rc As Rectangle)
|
|---|
| 1060 | SetClip(rc, System.Drawing.Drawing2D.CombineMode.Replace)
|
|---|
| 1061 | End Sub
|
|---|
| 1062 |
|
|---|
| 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
|
|---|
| 1066 |
|
|---|
| 1067 | Sub SetClip(path As GraphicsPath)
|
|---|
| 1068 | SetClip(path, System.Drawing.Drawing2D.CombineMode.Replace)
|
|---|
| 1069 | End Sub
|
|---|
| 1070 |
|
|---|
| 1071 | Sub SetClip(path As GraphicsPath, combineMode As Drawing2D.CombineMode)
|
|---|
| 1072 | SetStatus(GdipSetClipPath(nativeGraphics, path.nativePath, combineMode))
|
|---|
| 1073 | End Sub
|
|---|
| 1074 |
|
|---|
| 1075 | Sub SetClip(region As Region)
|
|---|
| 1076 | SetClip(region, System.Drawing.Drawing2D.CombineMode.Replace)
|
|---|
| 1077 | End Sub
|
|---|
| 1078 |
|
|---|
| 1079 | Sub SetClip(region As Region, combineMode As Drawing2D.CombineMode)
|
|---|
| 1080 | SetStatus(GdipSetClipRegion(nativeGraphics, region.nativeRegion, combineMode))
|
|---|
| 1081 | End Sub
|
|---|
| 1082 |
|
|---|
| 1083 | Sub SetClip(hrgn As HRGN)
|
|---|
| 1084 | SetClip(hrgn, System.Drawing.Drawing2D.CombineMode.Replace)
|
|---|
| 1085 | End Sub
|
|---|
| 1086 |
|
|---|
| 1087 | Sub SetClip(hrgn As HRGN, combineMode As Drawing2D.CombineMode)
|
|---|
| 1088 | SetStatus(GdipSetClipHrgn(nativeGraphics, hrgn, combineMode))
|
|---|
| 1089 | End Sub
|
|---|
| 1090 |
|
|---|
| 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
|
|---|
| 1094 |
|
|---|
| 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
|
|---|
| 1098 |
|
|---|
| 1099 | Sub IntersectClip(region As Region)
|
|---|
| 1100 | SetStatus(GdipSetClipRegion(nativeGraphics, region.nativeRegion, System.Drawing.Drawing2D.CombineMode.Intersect))
|
|---|
| 1101 | End Sub
|
|---|
| 1102 |
|
|---|
| 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
|
|---|
| 1106 |
|
|---|
| 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
|
|---|
| 1110 |
|
|---|
| 1111 | Sub ExcludeClip(region As Region)
|
|---|
| 1112 | SetStatus(GdipSetClipRegion(nativeGraphics, region.nativeRegion, System.Drawing.Drawing2D.CombineMode.Exclude))
|
|---|
| 1113 | End Sub
|
|---|
| 1114 |
|
|---|
| 1115 | Sub ResetClip()
|
|---|
| 1116 | SetStatus(GdipResetClip(nativeGraphics))
|
|---|
| 1117 | End Sub
|
|---|
| 1118 |
|
|---|
| 1119 | Sub TranslateClip(dx As Single, dy As Single)
|
|---|
| 1120 | SetStatus(GdipTranslateClip(nativeGraphics, dx, dy))
|
|---|
| 1121 | End Sub
|
|---|
| 1122 |
|
|---|
| 1123 | Sub TranslateClip(dx As Long, dy As Long)
|
|---|
| 1124 | SetStatus(GdipTranslateClipI(nativeGraphics, dx, dy))
|
|---|
| 1125 | End Sub
|
|---|
| 1126 |
|
|---|
| 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
|
|---|
| 1131 | End Function
|
|---|
| 1132 |
|
|---|
| 1133 | Const Function IsVisible(ByRef pt As Point) As Boolean
|
|---|
| 1134 | IsVisible(pt.X, pt.Y)
|
|---|
| 1135 | End Function
|
|---|
| 1136 |
|
|---|
| 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
|
|---|
| 1141 | End Function
|
|---|
| 1142 |
|
|---|
| 1143 | Const Function IsVisible(ByRef rc As Rectangle) As Boolean
|
|---|
| 1144 | IsVisible = IsVisible(rc.X, rc.Y, rc.Width, rc.Height)
|
|---|
| 1145 | End Function
|
|---|
| 1146 |
|
|---|
| 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
|
|---|
| 1151 | End Function
|
|---|
| 1152 |
|
|---|
| 1153 | Const Function IsVisible(ByRef pt As PointF) As Boolean
|
|---|
| 1154 | IsVisible = IsVisible(pt.X, pt.Y)
|
|---|
| 1155 | End Function
|
|---|
| 1156 |
|
|---|
| 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
|
|---|
| 1161 | End Function
|
|---|
| 1162 |
|
|---|
| 1163 | Const Function IsVisible(ByRef rc As RectangleF) As Boolean
|
|---|
| 1164 | IsVisible = IsVisible(rc.X, rc.Y, rc.Width, rc.Height)
|
|---|
| 1165 | End Function
|
|---|
| 1166 |
|
|---|
| 1167 | Const Function Save() As Drawing2D.GraphicsState
|
|---|
| 1168 | SetStatus(GdipSaveGraphics(nativeGraphics, Save))
|
|---|
| 1169 | End Function
|
|---|
| 1170 |
|
|---|
| 1171 | Sub Restore(gstate As Drawing2D.GraphicsState)
|
|---|
| 1172 | SetStatus(GdipRestoreGraphics(nativeGraphics, gstate))
|
|---|
| 1173 | End Sub
|
|---|
| 1174 |
|
|---|
| 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))
|
|---|
| 1177 | End Function
|
|---|
| 1178 |
|
|---|
| 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))
|
|---|
| 1181 | End Function
|
|---|
| 1182 |
|
|---|
| 1183 | Function BeginContainer() As Drawing2D.GraphicsContainer
|
|---|
| 1184 | SetStatus(GdipBeginContainer2(nativeGraphics, BeginContainer))
|
|---|
| 1185 | End Function
|
|---|
| 1186 |
|
|---|
| 1187 | Sub EndContainer(state As Drawing2D.GraphicsContainer)
|
|---|
| 1188 | SetStatus(GdipEndContainer(nativeGraphics, state))
|
|---|
| 1189 | End Sub
|
|---|
| 1190 |
|
|---|
| 1191 | Sub AddMetafileComment(data As *Byte, sizeData As DWord)
|
|---|
| 1192 | SetStatus(GdipComment(nativeGraphics, sizeData, data))
|
|---|
| 1193 | End Sub
|
|---|
| 1194 |
|
|---|
| 1195 | Static Function GetHalftonePalette() As HPALETTE
|
|---|
| 1196 | GdipCreateHalftonePalette()
|
|---|
| 1197 | End Function
|
|---|
| 1198 |
|
|---|
| 1199 | Function NativeGraphics() As *GpGraphics
|
|---|
| 1200 | NativeGraphics = nativeGraphics
|
|---|
| 1201 | End Function
|
|---|
| 1202 |
|
|---|
| 1203 | Sub Graphics(graphics As *GpGraphics)
|
|---|
| 1204 | nativeGraphics = graphics
|
|---|
| 1205 | End Sub
|
|---|
| 1206 |
|
|---|
| 1207 | Private
|
|---|
| 1208 | Static Function getNativePen(pen As Pen) As *GpPen
|
|---|
| 1209 | If ActiveBasic.IsNothing(pen) Then
|
|---|
| 1210 | getNativePen = 0
|
|---|
| 1211 | Else
|
|---|
| 1212 | getNativePen = pen.NativePen
|
|---|
| 1213 | End If
|
|---|
| 1214 | End Function
|
|---|
| 1215 |
|
|---|
| 1216 | Static Function getNativeBrush(br As Brush) As *GpBrush
|
|---|
| 1217 | If ActiveBasic.IsNothing(br) Then
|
|---|
| 1218 | getNativeBrush = 0
|
|---|
| 1219 | Else
|
|---|
| 1220 | getNativeBrush = br.NativeBrush
|
|---|
| 1221 | End If
|
|---|
| 1222 | End Function
|
|---|
| 1223 |
|
|---|
| 1224 | Static Function getNativeFont(font As Font) As *GpFont
|
|---|
| 1225 | If ActiveBasic.IsNothing(font) Then
|
|---|
| 1226 | getNativeFont = 0
|
|---|
| 1227 | Else
|
|---|
| 1228 | getNativeFont = font.NativeFont
|
|---|
| 1229 | End If
|
|---|
| 1230 | End Function
|
|---|
| 1231 |
|
|---|
| 1232 | Static Function getNativeImage(image As Image) As *GpImage
|
|---|
| 1233 | If ActiveBasic.IsNothing(image) Then
|
|---|
| 1234 | getNativeImage = 0
|
|---|
| 1235 | Else
|
|---|
| 1236 | getNativeImage = image.NativeImage
|
|---|
| 1237 | End If
|
|---|
| 1238 | End Function
|
|---|
| 1239 |
|
|---|
| 1240 | Static Function getNativeImageAttributes(imageAttr As ImageAttributes) As *GpImageAttributes
|
|---|
| 1241 | If ActiveBasic.IsNothing(imageAttr) Then
|
|---|
| 1242 | getNativeImageAttributes = 0
|
|---|
| 1243 | Else
|
|---|
| 1244 | getNativeImageAttributes = imageAttr.nativeImage
|
|---|
| 1245 | End If
|
|---|
| 1246 | End Function
|
|---|
| 1247 |
|
|---|
| 1248 | nativeGraphics As *GpGraphics
|
|---|
| 1249 | End Class
|
|---|
| 1250 |
|
|---|
| 1251 | End Namespace
|
|---|
| 1252 | End Namespace
|
|---|