Damit es nicht so abstrakt aussieht, hier ein ungefähr 5 Minuten Gebastel für ein Oszilloskop als Test.
Code: Alles auswählen
#iStandardSize = 16
#iStandardDepth = 32
#StandardUnit = #PB_Unit_Pixel
#StandardBackground = #PB_Image_Transparent
Declare.i VectorIcon(iSize.i = #iStandardSize, iImageNumber.i = #PB_Any)
Procedure.i StartVectorImage(iImageNumber.i, iWidth.i, iHeight.i = 0, iDepth.i = #iStandardDepth,
iBackColor.i = #StandardBackground, iUnit.i = #StandardUnit)
; -> iImageNumber: Die Image-Nummer oder #PB_Any für das Erstellen eines neuen Image.
; -> iWidth: Die Breite des Image in Pixel.
; -> iHeight: Die Höhe des Image in Pixel, Wenn Null übergeben wird, wird die Breite verwendet.
; -> iDepth: Die Farbtiefe in Bit, z.B. 24 oder 32.
; -> iBackColor: Die Farbe für den Hintergrund.
; -> iUnit: Die Einheit für die Größenangaben.
; Die Parameter sind ähnlich wie für die Funktionen CreateImage() und ImageVectorOutput().
; Rückgabe: Die Image-Nummer oder Null bei einem Fehler.
Protected iReturn.i
If (Not iHeight)
iHeight = iWidth
EndIf
iReturn = CreateImage(iImageNumber, iWidth, iHeight, iDepth, iBackColor)
If iReturn
If iImageNumber = #PB_Any
iImageNumber = iReturn
EndIf
If (Not StartVectorDrawing(ImageVectorOutput(iImageNumber, iUnit)))
FreeImage(iImageNumber)
iReturn = 0
EndIf
EndIf
ProcedureReturn iReturn
EndProcedure
Procedure.i VectorIcon(iSize.i = #iStandardSize, iImageNumber.i = #PB_Any)
; Erstellt ein Icon bzw. Image.
; -> iSize: Die Größe des Icons in der Breite und Höhe in Pixel.
; -> iImageNumber: Ein Image-Nummer oder #PB_Any für das Erstellen eines neuen Image.
; Rückgabe: Die Image-Nummer oder Null bei einem Fehler.
Protected iReturn.i, iFontId.i
Protected rCreatedSizeWidth.d = 128
Protected rCreatedSizeHeight.d = 128
Protected rScaleWidth.d = (iSize / rCreatedSizeWidth)
Protected rScaleHeight.d = (iSize / rCreatedSizeHeight)
iReturn = StartVectorImage(iImageNumber, iSize)
If iReturn
ScaleCoordinates(rScaleWidth, rScaleHeight)
; CorelDraw RectangleShape.Curve.
MovePathCursor(16, 103.99)
AddPathLine(23, 103.99)
AddPathCurve(23.82, 103.99, 24.5, 103.31, 24.5, 102.49)
AddPathLine(24.5, 99.49)
AddPathCurve(24.5, 98.66, 23.82, 97.99, 23, 97.99)
AddPathLine(16, 97.99)
AddPathCurve(15.17, 97.99, 14.5, 98.66, 14.5, 99.49)
AddPathLine(14.5, 102.49)
AddPathCurve(14.5, 103.31, 15.17, 103.99, 16, 103.99)
VectorSourceColor($FF7F7F7F)
FillPath(#PB_Path_Preserve)
ResetPath()
; CorelDraw RectangleShape.Curve.
MovePathCursor(105.05, 104.04)
AddPathLine(112.05, 104.04)
AddPathCurve(112.87, 104.04, 113.55, 103.37, 113.55, 102.54)
AddPathLine(113.55, 99.54)
AddPathCurve(113.55, 98.72, 112.87, 98.05, 112.05, 98.05)
AddPathLine(105.05, 98.05)
AddPathCurve(104.22, 98.05, 103.55, 98.72, 103.55, 99.54)
AddPathLine(103.55, 102.54)
AddPathCurve(103.55, 103.37, 104.22, 104.04, 105.05, 104.04)
VectorSourceColor($FF7F7F7F)
FillPath(#PB_Path_Preserve)
ResetPath()
; CorelDraw RectangleShape.
AddPathBox(10, 38, 79.99, 47.99)
VectorSourceColor($FF333333)
FillPath(#PB_Path_Preserve)
ResetPath()
; CorelDraw CurveShape.Curve.
MovePathCursor(9.65, 73.32)
AddPathLine(16.89, 49.66)
AddPathLine(24.86, 73.57)
AddPathLine(32.83, 49.66)
AddPathLine(40.8, 73.57)
AddPathLine(48.77, 49.66)
AddPathLine(56.74, 73.57)
AddPathLine(64.93, 49.66)
AddPathLine(72.9, 73.57)
AddPathLine(80.87, 49.66)
AddPathLine(88.84, 73.57)
VectorSourceColor($FF00FFFF)
StrokePath(3)
ResetPath()
; CorelDraw RectangleShape.
AddPathBox(10, 38, 79.99, 47.99)
VectorSourceColor($FFB2B2B2)
StrokePath(4)
ResetPath()
; CorelDraw CurveShape.Curve.
MovePathCursor(12.25, 32)
AddPathLine(115.74, 32)
AddPathCurve(120.27, 32, 123.98, 35.71, 123.98, 40.24)
AddPathLine(123.98, 89.74)
AddPathCurve(123.98, 94.28, 120.27, 97.99, 115.74, 97.99)
AddPathLine(12.25, 97.99)
AddPathCurve(7.71, 97.99, 4, 94.28, 4, 89.74)
AddPathLine(4, 40.24)
AddPathCurve(4, 35.71, 7.71, 32, 12.25, 32)
MovePathCursor(10, 38)
AddPathLine(89.99, 38)
AddPathLine(89.99, 85.99)
AddPathLine(10, 85.99)
AddPathLine(10, 38)
VectorSourceColor($FFE5E5E5)
FillPath(#PB_Path_Preserve)
VectorSourceColor($FF000000)
StrokePath(1)
ResetPath()
; CorelDraw EllipseShape.Ellipse.
AddPathEllipse(103.99, 81.99, 4, 4)
VectorSourceColor($FFCCFFFF)
FillPath(#PB_Path_Preserve)
VectorSourceColor($FF000000)
StrokePath(1)
ResetPath()
; CorelDraw EllipseShape.Ellipse.
AddPathEllipse(115.99, 69.99, 4, 4)
VectorSourceColor($FFCCFFFF)
FillPath(#PB_Path_Preserve)
VectorSourceColor($FF000000)
StrokePath(1)
ResetPath()
; CorelDraw EllipseShape.Ellipse.
AddPathEllipse(103.99, 51.99, 4, 4)
VectorSourceColor($FFCCFFFF)
FillPath(#PB_Path_Preserve)
VectorSourceColor($FF000000)
StrokePath(1)
ResetPath()
; CorelDraw EllipseShape.Ellipse.
AddPathEllipse(103.99, 41.99, 3, 3)
VectorSourceColor($FFCCFFFF)
FillPath(#PB_Path_Preserve)
VectorSourceColor($FF000000)
StrokePath(1)
ResetPath()
; CorelDraw EllipseShape.Ellipse.
AddPathEllipse(103.99, 63.99, 3, 3)
VectorSourceColor($FFCCFFFF)
FillPath(#PB_Path_Preserve)
VectorSourceColor($FF000000)
StrokePath(1)
ResetPath()
; CorelDraw EllipseShape.Ellipse.
AddPathEllipse(113.99, 91.99, 3, 3)
VectorSourceColor($FF00CCFF)
FillPath(#PB_Path_Preserve)
VectorSourceColor($FF000000)
StrokePath(1)
ResetPath()
; CorelDraw EllipseShape.Ellipse.
AddPathEllipse(103.99, 91.99, 3, 3)
VectorSourceColor($FF00CCFF)
FillPath(#PB_Path_Preserve)
VectorSourceColor($FF000000)
StrokePath(1)
ResetPath()
; CorelDraw EllipseShape.Ellipse.
AddPathEllipse(93.99, 91.99, 3, 3)
VectorSourceColor($FF00CCFF)
FillPath(#PB_Path_Preserve)
VectorSourceColor($FF000000)
StrokePath(1)
ResetPath()
; CorelDraw EllipseShape.Ellipse.
AddPathEllipse(83.99, 91.99, 3, 3)
VectorSourceColor($FF00CCFF)
FillPath(#PB_Path_Preserve)
VectorSourceColor($FF000000)
StrokePath(1)
ResetPath()
; CorelDraw RectangleShape.
AddPathBox(59.99, 89.99, 14, 4)
VectorSourceColor($FF666666)
FillPath(#PB_Path_Preserve)
VectorSourceColor($FFB2B2B2)
StrokePath(1)
ResetPath()
; CorelDraw RectangleShape.
AddPathBox(42.99, 89.99, 14, 4)
VectorSourceColor($FF666666)
FillPath(#PB_Path_Preserve)
VectorSourceColor($FFB2B2B2)
StrokePath(1)
ResetPath()
; CorelDraw RectangleShape.Curve.
MovePathCursor(11, 89.99)
AddPathLine(15, 89.99)
AddPathCurve(15.55, 89.99, 16, 90.44, 16, 90.99)
AddPathLine(16, 92.99)
AddPathCurve(16, 93.54, 15.55, 93.99, 15, 93.99)
AddPathLine(11, 93.99)
AddPathCurve(10.45, 93.99, 10, 93.54, 10, 92.99)
AddPathLine(10, 90.99)
AddPathCurve(10, 90.44, 10.45, 89.99, 11, 89.99)
VectorSourceColor($FF33CC33)
FillPath(#PB_Path_Preserve)
VectorSourceColor($FF336600)
StrokePath(1)
ResetPath()
; CorelDraw RectangleShape.Curve.
MovePathCursor(92.99, 39.99)
AddPathLine(96.99, 39.99)
AddPathCurve(97.54, 39.99, 97.99, 40.44, 97.99, 41)
AddPathLine(97.99, 42.99)
AddPathCurve(97.99, 43.54, 97.54, 43.99, 96.99, 43.99)
AddPathLine(92.99, 43.99)
AddPathCurve(92.44, 43.99, 91.99, 43.54, 91.99, 42.99)
AddPathLine(91.99, 41)
AddPathCurve(91.99, 40.44, 92.44, 39.99, 92.99, 39.99)
VectorSourceColor($FFCCCC99)
FillPath(#PB_Path_Preserve)
VectorSourceColor($FF999966)
StrokePath(1)
ResetPath()
; CorelDraw RectangleShape.Curve.
MovePathCursor(113.99, 39.99)
AddPathLine(117.99, 39.99)
AddPathCurve(118.54, 39.99, 118.99, 40.44, 118.99, 41)
AddPathLine(118.99, 42.99)
AddPathCurve(118.99, 43.54, 118.54, 43.99, 117.99, 43.99)
AddPathLine(113.99, 43.99)
AddPathCurve(113.44, 43.99, 112.99, 43.54, 112.99, 42.99)
AddPathLine(112.99, 41)
AddPathCurve(112.99, 40.44, 113.44, 39.99, 113.99, 39.99)
VectorSourceColor($FF6600FF)
FillPath(#PB_Path_Preserve)
VectorSourceColor($FFCC99FF)
StrokePath(1)
ResetPath()
; CorelDraw RectangleShape.Curve.
MovePathCursor(113.99, 47.99)
AddPathLine(117.99, 47.99)
AddPathCurve(118.54, 47.99, 118.99, 48.44, 118.99, 48.99)
AddPathLine(118.99, 50.99)
AddPathCurve(118.99, 51.54, 118.54, 51.99, 117.99, 51.99)
AddPathLine(113.99, 51.99)
AddPathCurve(113.44, 51.99, 112.99, 51.54, 112.99, 50.99)
AddPathLine(112.99, 48.99)
AddPathCurve(112.99, 48.44, 113.44, 47.99, 113.99, 47.99)
VectorSourceColor($FFCCCC99)
FillPath(#PB_Path_Preserve)
VectorSourceColor($FF999966)
StrokePath(1)
ResetPath()
; CorelDraw RectangleShape.Curve.
MovePathCursor(92.99, 47.99)
AddPathLine(96.99, 47.99)
AddPathCurve(97.54, 47.99, 97.99, 48.44, 97.99, 48.99)
AddPathLine(97.99, 50.99)
AddPathCurve(97.99, 51.54, 97.54, 51.99, 96.99, 51.99)
AddPathLine(92.99, 51.99)
AddPathCurve(92.44, 51.99, 91.99, 51.54, 91.99, 50.99)
AddPathLine(91.99, 48.99)
AddPathCurve(91.99, 48.44, 92.44, 47.99, 92.99, 47.99)
VectorSourceColor($FFCCCC99)
FillPath(#PB_Path_Preserve)
VectorSourceColor($FF999966)
StrokePath(1)
ResetPath()
; CorelDraw RectangleShape.Curve.
MovePathCursor(92.99, 55.99)
AddPathLine(96.99, 55.99)
AddPathCurve(97.54, 55.99, 97.99, 56.44, 97.99, 56.99)
AddPathLine(97.99, 58.99)
AddPathCurve(97.99, 59.54, 97.54, 59.99, 96.99, 59.99)
AddPathLine(92.99, 59.99)
AddPathCurve(92.44, 59.99, 91.99, 59.54, 91.99, 58.99)
AddPathLine(91.99, 56.99)
AddPathCurve(91.99, 56.44, 92.44, 55.99, 92.99, 55.99)
VectorSourceColor($FFCCCC99)
FillPath(#PB_Path_Preserve)
VectorSourceColor($FF999966)
StrokePath(1)
ResetPath()
; CorelDraw RectangleShape.Curve.
MovePathCursor(92.99, 63.99)
AddPathLine(96.99, 63.99)
AddPathCurve(97.54, 63.99, 97.99, 64.44, 97.99, 64.99)
AddPathLine(97.99, 66.99)
AddPathCurve(97.99, 67.54, 97.54, 67.99, 96.99, 67.99)
AddPathLine(92.99, 67.99)
AddPathCurve(92.44, 67.99, 91.99, 67.54, 91.99, 66.99)
AddPathLine(91.99, 64.99)
AddPathCurve(91.99, 64.44, 92.44, 63.99, 92.99, 63.99)
VectorSourceColor($FFCCCC99)
FillPath(#PB_Path_Preserve)
VectorSourceColor($FF999966)
StrokePath(1)
ResetPath()
; CorelDraw RectangleShape.Curve.
MovePathCursor(92.99, 71.99)
AddPathLine(96.99, 71.99)
AddPathCurve(97.54, 71.99, 97.99, 72.44, 97.99, 72.99)
AddPathLine(97.99, 74.99)
AddPathCurve(97.99, 75.54, 97.54, 75.99, 96.99, 75.99)
AddPathLine(92.99, 75.99)
AddPathCurve(92.44, 75.99, 91.99, 75.54, 91.99, 74.99)
AddPathLine(91.99, 72.99)
AddPathCurve(91.99, 72.44, 92.44, 71.99, 92.99, 71.99)
VectorSourceColor($FFCCCC99)
FillPath(#PB_Path_Preserve)
VectorSourceColor($FF999966)
StrokePath(1)
ResetPath()
; CorelDraw RectangleShape.Curve.
MovePathCursor(92.99, 79.99)
AddPathLine(96.99, 79.99)
AddPathCurve(97.54, 79.99, 97.99, 80.44, 97.99, 80.99)
AddPathLine(97.99, 82.99)
AddPathCurve(97.99, 83.54, 97.54, 83.99, 96.99, 83.99)
AddPathLine(92.99, 83.99)
AddPathCurve(92.44, 83.99, 91.99, 83.54, 91.99, 82.99)
AddPathLine(91.99, 80.99)
AddPathCurve(91.99, 80.44, 92.44, 79.99, 92.99, 79.99)
VectorSourceColor($FFCCCC99)
FillPath(#PB_Path_Preserve)
VectorSourceColor($FF999966)
StrokePath(1)
ResetPath()
; CorelDraw CurveShape.Curve.
MovePathCursor(100.52, 32)
AddPathCurve(100.82, 31.25, 100.99, 30.44, 100.99, 29.6)
AddPathLine(100.99, 26.4)
AddPathCurve(100.99, 22.88, 98.11, 20, 94.59, 20)
AddPathLine(31.4, 20)
AddPathCurve(27.88, 20, 25, 22.88, 25, 26.4)
AddPathLine(25, 29.6)
AddPathCurve(25, 30.44, 25.17, 31.25, 25.47, 32)
AddPathLine(31.17, 32)
AddPathCurve(31.06, 31.68, 31, 31.35, 31, 31)
AddPathLine(31, 27)
AddPathCurve(31, 25.35, 32.35, 24, 34, 24)
AddPathLine(91.99, 24)
AddPathCurve(93.64, 24, 94.99, 25.35, 94.99, 27)
AddPathLine(94.99, 31)
AddPathCurve(94.99, 31.35, 94.93, 31.68, 94.82, 32)
AddPathLine(100.52, 32)
VectorSourceColor($FF999999)
FillPath(#PB_Path_Preserve)
VectorSourceColor($FF000000)
StrokePath(1)
ResetPath()
StopVectorDrawing()
EndIf
ProcedureReturn iReturn
EndProcedure
; ############
If OpenWindow(0, 0, 0, 460, 260, "VectorIcon", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
SetWindowColor(0, #White)
ImageGadget(#PB_Any, 2, 2, 256, 256, ImageID(VectorIcon(256)))
ImageGadget(#PB_Any, 260, 2, 128, 128, ImageID(VectorIcon(128)))
ImageGadget(#PB_Any, 392, 2, 64, 64, ImageID(VectorIcon(64)))
ImageGadget(#PB_Any, 408, 68, 32, 32, ImageID(VectorIcon(32)))
ImageGadget(#PB_Any, 412, 104, 24, 24, ImageID(VectorIcon(24)))
ImageGadget(#PB_Any, 416, 132, 16, 16, ImageID(VectorIcon(16)))
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf