190607 c1

- Add Pilz.Drawing.Drawing3D.OpenGLFactory
- Fix small bugs in Pilz.UI.PaintingControl
This commit is contained in:
2019-06-07 20:56:19 +02:00
parent ef15e45df7
commit 2f09834fa0
65 changed files with 6670 additions and 118 deletions

View File

@@ -47,6 +47,7 @@ Imports Newtonsoft.Json
Public Property MouseTransparency As Boolean = False
Public ReadOnly Property Layering As New PaintingObjectLayering(Me)
Public ReadOnly Property PaintingObjects As New PaintingObjectList(_Parent) With {.EnableRaisingEvents = False}
Public ReadOnly Property ErrorsAtDrawing As ULong = 0
Public Event MouseClick(sender As PaintingObject, e As MouseEventArgs)
Public Event MouseDown(sender As PaintingObject, e As MouseEventArgs)
@@ -56,6 +57,8 @@ Imports Newtonsoft.Json
Public Event Paint(sender As PaintingObject, e As PaintEventArgs)
Public Event ParentChanged(sender As PaintingObject, e As EventArgs)
Public Event VisibleChanged(sender As PaintingObject, e As EventArgs)
Public Event Moved(sender As PaintingObject, e As EventArgs)
Public Event Moving(sender As PaintingObject, e As EventArgs)
Public Sub New()
End Sub
@@ -69,21 +72,27 @@ Imports Newtonsoft.Json
Me.DrawMethodes.AddRange(drawMethodes)
End Sub
Public Sub RaiseMouseClick(e As MouseEventArgs)
Friend Sub RaiseMouseClick(e As MouseEventArgs)
RaiseEvent MouseClick(Me, e)
End Sub
Public Sub RaiseMouseDown(e As MouseEventArgs)
Friend Sub RaiseMouseDown(e As MouseEventArgs)
RaiseEvent MouseDown(Me, e)
End Sub
Public Sub RaiseMouseUp(e As MouseEventArgs)
Friend Sub RaiseMouseUp(e As MouseEventArgs)
RaiseEvent MouseUp(Me, e)
End Sub
Public Sub RaiseMouseMove(e As MouseEventArgs)
Friend Sub RaiseMouseMove(e As MouseEventArgs)
RaiseEvent MouseMove(Me, e)
End Sub
Private Sub RaisePaint(e As PaintEventArgs)
RaiseEvent Paint(Me, e)
End Sub
Friend Sub RaiseMoved(e As EventArgs)
RaiseEvent Moved(Me, e)
End Sub
Friend Sub RaiseMoving(e As EventArgs)
RaiseEvent Moving(Me, e)
End Sub
Public Property Type As PaintingObjectType
Get
@@ -376,16 +385,22 @@ Imports Newtonsoft.Json
End Set
End Property
<JsonIgnore> Public ReadOnly Property Right As Integer
<JsonIgnore> Public Property Right As Integer
Get
Return X + Width
End Get
Set(value As Integer)
X = value - Width
End Set
End Property
<JsonIgnore> Public ReadOnly Property Bottom() As Integer
<JsonIgnore> Public Property Bottom() As Integer
Get
Return Y + Height
End Get
Set(value As Integer)
Y = value - Height
End Set
End Property
Public Property EnableResize As Boolean
@@ -439,7 +454,11 @@ Imports Newtonsoft.Json
Dim poevargs As New PaintingObjectPaintEventArgs(Me, g, offset)
For Each dm As DelegateDrawPaintingObjectMethode In DrawMethodes
dm?.Invoke(poevargs)
Try
dm?.Invoke(poevargs)
Catch ex As Exception
_ErrorsAtDrawing += 1
End Try
Next
If Selected AndAlso DrawSelectionMethode IsNot Nothing Then
@@ -454,20 +473,27 @@ Imports Newtonsoft.Json
Public Function Clone(includePinnedObject As Boolean) As Object
Dim obj As New PaintingObject
Dim t As Type = Me.GetType
Dim blackField As New List(Of String) From {
Dim metype As Type = Me.GetType
Dim blackField As String() = {
NameOf(_PinnedObjects),
NameOf(resizeEngine),
NameOf(_Parent),
NameOf(BufferedImage)
NameOf(BufferedImage),
NameOf(_ImageProperties)
}
Dim fields As FieldInfo() = t.GetFields(BindingFlags.Public Or BindingFlags.NonPublic Or BindingFlags.IgnoreCase Or BindingFlags.Instance)
For Each field As FieldInfo In fields
If Not blackField.Contains(field.Name) Then
field.SetValue(obj, field.GetValue(Me))
End If
Next
Dim copyFields =
Sub(source As Object, dest As Object, blackFields As String(), t As Type)
Dim fields As New List(Of FieldInfo)(t.GetFields(BindingFlags.Public Or BindingFlags.NonPublic Or BindingFlags.IgnoreCase Or BindingFlags.Instance))
For Each field As FieldInfo In fields
If Not blackFields.Contains(field.Name) Then
field.SetValue(dest, field.GetValue(source))
End If
Next
End Sub
copyFields(Me, obj, blackField, metype)
copyfields(ImageProperties, obj.ImageProperties, {}, ImageProperties.GetType)
If includePinnedObject Then
obj.PinnedObjects.AddRange(PinnedObjects)