Please do not be too angry. Yesterday I was really too tired for this work.
Now i've got the declaration for this fault. After the whole copying, testing, converting it to your new programm and creating the uploaded filed, i've got two Upload-Folders on USB-Stick and have uploaded an old file.
Since you have already integrated a part of my intended post, i've tried to figure out what is still missing.
-icon for Windows. Like the icon itself, the workaround has no calculated CAD-precision.
(if you look at the parts you see, the angles are a little 'faked') but it should be enough for an icon.
are not the same on Windows and Linux (in addition to your mentioned bug with #PB_Path_Connected).
-Icon with your Windows-workaround (which should be in the download-file). The only difference against the original version is only a small (lazy) correction of the position.
-Icon got only an attempt to find a better color for the flap in the call for the color-version.
I finally tried to re-integrate the missing parts in your new edition with the (again) new procedure-format but got a "
So i let it in the previous format and hope, that not too much is missing' ...
Code: Select all
;-declares ...
; Declare.i ChartRing(img.i, size.i, color1.i, color2.i, color3.i, color4.i, color5.i= 0)
Declare.i FirstAid_Convex (img.i, size.i, color1.i, color2.i=0)
Declare.i NoEntry_Convex (img.i, size.i, color1.i, color2.i=0)
Declare.i Stop3_Convex (img.i, size.i, color1.i, color2.i=0)
Declare.i Download2_Convex (img.i, size.i, color.i, color2.i=0)
;-
;-macros new ...
;general macro to create a convex & round / rectangular / rounded corner background area
Macro Convex_Area(_colorbright_, _darken_); for 'x_Convex()'-icons
;The brighter the _colorbright_ & lower the _darken_-factor (0.0 ... 1.0), the stronger is the effect.
VectorSourceLinearGradient(0, 0, size, size)
VectorSourceGradientColor(_colorbright_, 0.0)
VectorSourceGradientColor(Color_Darken(_colorbright_, _darken_), 1.0)
EndMacro
;-
;-procedures mod ...
Procedure.i FirstAid (img.i, size.i, color1.i, color2.i=0)
; in : img : number of the image which is to be created, or #PB_Any
; size : width and height (number of pixels)
; color1: foreground color #1
; color2: foreground color #2 (default = 0: 100% transparent)
; out: return value: if img = #Pb_Any => number of the created image,
; error => 0
; [org. by Omi]
Protected ret.i
Protected p8.d = size / 8.0
Protected p2.d = size / 2.0
ret = StartVectorIconOutput(img, size)
If ret
VectorSourceColor(color2)
; panel: round corners
AddPathBox (p8, p8, size - 2 * p8, size - 2 * p8)
FillPath ()
AddPathBox (p8, p8, size - 2 * p8, size - 2 * p8)
StrokePath (p8 * 2, #PB_Path_RoundCorner)
VectorSourceColor(color1)
; hor. bar
MovePathCursor(p8, p2)
AddPathLine (size - 2 * p8, 0, #PB_Path_Relative)
; vert. bar
MovePathCursor(p2, p8)
AddPathLine (0, size - 2 * p8, #PB_Path_Relative)
StrokePath (size / 5)
StopVectorDrawing()
EndIf
ProcedureReturn ret
EndProcedure
Procedure.i NoEntry (img.i, size.i, color1.i, color2.i=0)
; in : img : number of the image which is to be created, or #PB_Any
; size : width and height (number of pixels)
; color1: foreground color #1
; color2: foreground color #2 (default = 0: 100% transparent)
; out: return value: if img = #Pb_Any => number of the created image,
; error => 0
; [org. by Omi]
Protected ret.i
Protected p8.d = size / 8.0
Protected p2.d = size / 2.0
ret = StartVectorIconOutput(img, size)
If ret
; panel
VectorSourceColor(color2)
AddPathCircle (p2, p2, p2)
FillPath()
; bar
VectorSourceColor(color1)
MovePathCursor (p8, p2)
AddPathLine (size - 2 * p8, 0, #PB_Path_Relative)
StrokePath (size/5)
StopVectorDrawing()
EndIf
ProcedureReturn ret
EndProcedure
Procedure.i Stop3 (img.i, size.i, color1.i, color2.i=0)
; in : img : number of the image which is to be created, or #PB_Any
; size : width and height (number of pixels)
; color1: foreground color #1
; color2: foreground color #2 (default = 0: 100% transparent)
; out: return value: if img = #Pb_Any => number of the created image,
; error => 0
; [org. by Omi]
Protected ret.i
Protected hw.d = size / 3.5
Protected half.d = size / 2.0
ret = StartVectorIconOutput(img, size)
If ret
VectorSourceColor(color2)
; panel
AddPathCircle (half, half, half)
FillPath()
VectorSourceColor(color1)
; cross
MovePathCursor (hw, hw)
AddPathLine (size - hw, size - hw)
MovePathCursor (hw, size - hw)
AddPathLine (size - hw, hw)
StrokePath (size / 10)
StopVectorDrawing()
EndIf
ProcedureReturn ret
EndProcedure
;- only pos-correction (your fixed version) ...
Procedure.i ChartPie (img.i, size.i, color1.i, color2.i, color3.i, color4.i, color5.i= 0)
; in : img : number of the image which is to be created, or #PB_Any
; size : width and height (number of pixels)
; color1: foreground color #1
; color2: foreground color #2
; color3: foreground color #3
; color4: foreground color #4
; color5: foreground color #5
; out: return value: if img = #Pb_Any => number of the created image,
; error => 0
; [org. by Omi, 10.04.2016]
Protected ret.i
Protected p.d = size / 32
Protected p16.d= size / 16
Protected p8.d = size / 8
Protected p4.d = size / 4
Protected p2.d = size / 2
ret = StartVectorIconOutput(img, size)
If ret
; border
If color5
VectorSourceColor(color5)
AddPathBox(0, 0, size, size)
FillPath()
EndIf
TranslateCoordinates(0, -p16)
; bottom right
MovePathCursor (size - p16, p2)
AddPathEllipse (p2, p2 + p8, p2 - p16, p2 - p4, 0, 90, #PB_Path_Connected)
AddPathLine (p2, p2 + p4)
ClosePath()
VectorSourceColor(Color_Darken(color3, 0.8))
FillPath(#PB_Path_Preserve)
VectorSourceColor(color1)
StrokePath (p)
; bottom left
MovePathCursor (p2, p2 + p4)
AddPathEllipse (p2, p2 + p8, p2 - p16, p2 - p4, 90, 180, #PB_Path_Connected)
AddPathLine (p16, p2)
ClosePath()
VectorSourceColor(Color_Darken(color4, 0.8))
FillPath(#PB_Path_Preserve)
VectorSourceColor(color1)
StrokePath (p)
; pieces
MovePathCursor (p2, p2)
AddPathEllipse (p2, p2, p2 - p16, p2 - p4, 210, 330, #PB_Path_Connected)
VectorSourceColor(color2)
ClosePath ()
FillPath(#PB_Path_Preserve)
VectorSourceColor(color1)
StrokePath (p)
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
; Workaround for bug in PB 5.42 on Windows, see
; <http://www.purebasic.fr/english/viewtopic.php?f=4&t=65540>
Protected.d x1, y1, x2, y2
x1 = p2 + 0.69*p2 * Cos(Radian(330))
y1 = p2 + 0.69*p2 * Sin(Radian(330))
x2 = p2 + 0.53*p2 * Cos(Radian( 90))
y2 = p2 + 0.53*p2 * Sin(Radian( 90))
MovePathCursor(x1, y1)
AddPathLine(x2, y2-0.03*p2)
VectorSourceColor(color3)
StrokePath (p)
AddPathEllipse (p2, p2, p2 - p16, p2 - p4, 330, 90)
MovePathCursor (x1, y1)
AddPathLine (p2, p2)
AddPathLine (x2, y2)
FillPath(#PB_Path_Preserve)
VectorSourceColor(color1)
StrokePath (p)
CompilerElse
MovePathCursor (p2, p2)
AddPathEllipse (p2, p2, p2 - p16, p2 - p4, 330, 90, #PB_Path_Connected)
VectorSourceColor(color3)
ClosePath ()
FillPath(#PB_Path_Preserve)
VectorSourceColor(color1)
StrokePath (p)
CompilerEndIf
MovePathCursor (p2, p2)
AddPathEllipse (p2, p2, p2 - p16, p2 - p4, 90, 210, #PB_Path_Connected)
VectorSourceColor(color4)
ClosePath ()
FillPath (#PB_Path_Preserve)
VectorSourceColor(color1)
StrokePath (p)
StopVectorDrawing()
EndIf
ProcedureReturn ret
EndProcedure
;-
;- procedures new ...
Procedure.i ChartRing(img.i, size.i, color1.i, color2.i, color3.i, color4.i, color5.i= 0)
; in : img : number of the image which is to be created, or #PB_Any
; size : width and height (number of pixels)
; color1: foreground color #1
; color2: foreground color #2
; color3: foreground color #1
; color4: foreground color #2
; color5: foreground color #1
; out: return value: if img = #Pb_Any => number of the created image,
; error => 0
; [org. by Omi]
Protected ret.i
Protected p.d = size / 32
Protected p16.d = size / 16
Protected p8.d = size / 8
Protected p4.d = size / 4
Protected p2.d = size / 2
Protected angle1.d, angle2.d, angle3.d
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
angle1= 196
angle2= 344
angle3= 90
CompilerElse
angle1= 210
angle2= 330
angle3= 90
CompilerEndIf
ret = StartVectorIconOutput(img, size)
If ret
;border
If color5
VectorSourceColor(color5)
AddPathBox(0, 0, size, size)
FillPath()
EndIf
TranslateCoordinates(0, -p)
;rand
MovePathCursor (size - p16 + p / 3, p2 + p)
AddPathEllipse (p2, p2 + p8, p2 - p16, p2 - p4 + p, 0, 90, #PB_Path_Connected)
AddPathLine (p2, p2 + p4)
ClosePath()
VectorSourceColor(Color_Darken(color3, 0.6))
FillPath(#PB_Path_Preserve)
StrokePath (p)
CompilerIf #PB_Compiler_OS = #PB_OS_Windows
MovePathCursor (p2 - p / 2, p2 + p8)
AddPathLine (p2 - p / 2, p2 + p4)
AddPathEllipse (p2, p2 + p8, p2 - p16, p2 - p4 + p, 92, 180)
AddPathLine (p * 1.5, p2 )
AddPathLine (p2 - p / 2, p2 + p8)
ClosePath()
VectorSourceColor(Color_Darken(color4, 0.6))
FillPath(#PB_Path_Preserve)
StrokePath (p)
CompilerElse
MovePathCursor (p2 - p / 2, p2 + p4)
AddPathEllipse (p2, p2 + p8, p2 - p16, p2 - p4 + p, 92, 180, #PB_Path_Connected)
AddPathLine (p16 - p/3, p2 + p)
ClosePath()
VectorSourceColor(Color_Darken(color4, 0.6))
FillPath(#PB_Path_Preserve)
StrokePath (p)
CompilerEndIf
MovePathCursor (p2 - p * 9, p2 - p4)
AddPathEllipse (p2, p2 + p4 - p, p2 - p16, p2 - p4 + p, 230, 310, #PB_Path_Connected)
AddPathLine (p2 + p * 9, p2 - p4)
ClosePath()
VectorSourceColor(Color_Darken(color2, 0.6))
FillPath(#PB_Path_Preserve)
StrokePath (p)
;
;pieces
AddPathEllipse (p2, p2 - p, p2 - p8, p4 - p, angle1, angle2)
VectorSourceColor(color2)
StrokePath (p8+p16)
AddPathEllipse (p2, p2 - p, p2 - p8, p4 - p, angle2, angle3)
VectorSourceColor(color3)
StrokePath (p8+p16)
AddPathEllipse (p2, p2 - p, p2 - p8, p4 - p, angle3, angle1)
VectorSourceColor(color4)
StrokePath (p8+p16)
;lines
VectorSourceColor(Color_Darken(color1, 0.6))
MovePathCursor (size - p * 3, p2 - p * 6)
AddPathLine (size - p * 8, p2 - p * 3)
AddPathLine (0, p * 3, #PB_Path_Relative)
StrokePath (p)
MovePathCursor (p * 3, p2 - p * 6)
AddPathLine (p * 8, p2 - p * 3)
AddPathLine (0, p * 3, #PB_Path_Relative)
StrokePath (p)
MovePathCursor (p2, p2 + p * 3 )
AddPathLine (p2, p2 + p / 2 * 26)
StrokePath (p)
StopVectorDrawing()
EndIf
ProcedureReturn ret
EndProcedure
;- +
;-(Johns assessment needed ...)
Procedure.i FirstAid_Convex (img.i, size.i, color1.i, color2.i=0)
; in : img : number of the image which is to be created, or #PB_Any
; size : width and height (number of pixels)
; color1: foreground color #1
; color2: foreground color #2 (default = 0: 100% transparent)
; out: return value: if img = #Pb_Any => number of the created image,
; error => 0
; [org. by Omi]
Protected ret.i
Protected p8.d = size / 8.0
Protected p2.d = size / 2.0
ret = StartVectorIconOutput(img, size)
If ret
; panel: round corners
Convex_Area(color2, 0.4)
AddPathBox (p8, p8, size - 2 * p8, size - 2 * p8)
FillPath ()
AddPathBox (p8, p8, size - 2 * p8, size - 2 * p8)
StrokePath (p8 * 2, #PB_Path_RoundCorner)
VectorSourceColor(color1)
; hor. bar
MovePathCursor(p8, p2)
AddPathLine (size - 2 * p8, 0, #PB_Path_Relative)
; vert. bar
MovePathCursor(p2, p8)
AddPathLine (0, size - 2 * p8, #PB_Path_Relative)
StrokePath (size / 5)
StopVectorDrawing()
EndIf
ProcedureReturn ret
EndProcedure
Procedure.i NoEntry_Convex (img.i, size.i, color1.i, color2.i=0)
; in : img : number of the image which is to be created, or #PB_Any
; size : width and height (number of pixels)
; color1: foreground color #1
; color2: foreground color #2 (default = 0: 100% transparent)
; out: return value: if img = #Pb_Any => number of the created image,
; error => 0
; [org. by Omi]
Protected ret.i
Protected p8.d = size / 8.0
Protected p2.d = size / 2.0
ret = StartVectorIconOutput(img, size)
If ret
; panel
Convex_Area(color2, 0.4)
AddPathCircle (p2, p2, p2)
FillPath()
; bar
VectorSourceColor(color1)
MovePathCursor (p8, p2)
AddPathLine (size - 2 * p8, 0, #PB_Path_Relative)
StrokePath (size/5)
StopVectorDrawing()
EndIf
ProcedureReturn ret
EndProcedure
Procedure.i Stop3_Convex (img.i, size.i, color1.i, color2.i=0)
; in : img : number of the image which is to be created, or #PB_Any
; size : width and height (number of pixels)
; color1: foreground color #1
; color2: foreground color #2 (default = 0: 100% transparent)
; out: return value: if img = #Pb_Any => number of the created image,
; error => 0
; [org. by Omi]
Protected ret.i
Protected hw.d = size / 3.5
Protected half.d = size / 2.0
ret = StartVectorIconOutput(img, size)
If ret
; panel
Convex_Area(color2, 0.4)
AddPathCircle (half, half, half)
FillPath()
VectorSourceColor(color1)
; cross
MovePathCursor (hw, hw)
AddPathLine (size - hw, size - hw)
MovePathCursor (hw, size - hw)
AddPathLine (size - hw, hw)
StrokePath (size / 10)
StopVectorDrawing()
EndIf
ProcedureReturn ret
EndProcedure
Procedure.i Download2_Convex (img.i, size.i, color1.i, color2.i=0)
; in : img : number of the image which is to be created, or #PB_Any
; size : width and height (number of pixels)
; color1: foreground color #1
; color2: foreground color #2 (default = 0: 100% transparent)
; out: return value: if img = #Pb_Any => number of the created image,
; error => 0
; [org. by Omi]
Protected ret.i
Protected p8.d = size / 8
Protected p4.d = size / 4
Protected p2.d = size / 2
ret = StartVectorIconOutput(img, size)
If ret
Convex_Area(color2, 0.4)
; panel: round corners
AddPathBox(p8, p8, size - p4, size - p4)
FillPath()
AddPathBox(p8, p8, size - p4, size - p4)
StrokePath(p4, #PB_Path_RoundCorner)
; arrow
VectorSourceColor(color1)
MovePathCursor(p2, p8)
AddPathLine (p2, size - p4)
StrokePath (size/5)
MovePathCursor(p2 - p4, size - p2 + p8)
AddPathLine (p2 + p4, size - p2 + p8)
AddPathLine (p2, size - p8)
ClosePath()
FillPath()
StopVectorDrawing()
EndIf
ProcedureReturn ret
EndProcedure
Data.s "FirstAidConvex", "NoEntryConvex", "Stop3Convex", "Download2Convex"
;-
;- calls new, color ...
NewElement(imgEnabled(), FirstAid_Convex(#PB_Any, size, #CSS_White, #CSS_OrangeRed))
NewElement(imgEnabled(), NoEntry_Convex(#PB_Any, size, #CSS_White, #CSS_OrangeRed))
NewElement(imgEnabled(), Stop3_Convex(#PB_Any, size, #CSS_White, #CSS_OrangeRed))
NewElement(imgEnabled(), Download2_Convex(#PB_Any, size, #CSS_White, #CSS_LimeGreen))
NewElement(imgEnabled(), ChartRing (#PB_Any, size, #CSS_DarkGray, #CSS_DarkOrange, #CSS_Yellow, #CSS_CornflowerBlue, #CSS_White))
;- calls mod. (smart color change)
NewElement(imgEnabled(), Open3(#PB_Any, size, #CSS_GoldenRod, #CSS_Chocolate))
;- calls mod. color
NewElement(imgEnabled(), ChartPie (#PB_Any, size, #CSS_Black, #CSS_DarkOrange, #CSS_Yellow, #CSS_CornflowerBlue, #CSS_White))
;- calls new, greyed ...
NewElement(imgDisabled(), FirstAid_Convex(#PB_Any, size, #CSS_WhiteSmoke, #CSS_Silver))
NewElement(imgDisabled(), NoEntry_Convex(#PB_Any, size, #CSS_WhiteSmoke, #CSS_Silver))
NewElement(imgDisabled(), Stop3_Convex(#PB_Any, size, #CSS_WhiteSmoke, #CSS_Silver))
NewElement(imgDisabled(), Download2_Convex(#PB_Any, size, #CSS_WhiteSmoke, #CSS_Silver))
NewElement(imgDisabled(), ChartRing (#PB_Any, size, #CSS_DimGrey, #CSS_Silver, #CSS_Silver, #CSS_Silver))
;- calls mod.
;NewElement(imgDisabled(), Open3(#PB_Any, size, #CSS_Silver, #CSS_Silver)); w/o change
;- calls mod. grey
NewElement(imgDisabled(), ChartPie (#PB_Any, size, #CSS_DimGrey, #CSS_Silver, #CSS_Silver, #CSS_Silver, #CSS_White))
I guess that the current snapshot was taken on Linux. I've just noticed that the visual differences are greater than thought between the systems.
Just had the idea of an 'Volume'-icon and be happy to be too slow. Your version is look much better than my 'idea'.