Hi davido,davido wrote:I have another four icons: Bug, Debug, Crop and ReSize2.
thank you! I've added them to the collection.
Hi davido,davido wrote:I have another four icons: Bug, Debug, Crop and ReSize2.
Code: Select all
; Made with Cartoon ! 0.12
; Date : 08/04/2016
; Pb Version : 5.42 +
Global Zoom.f = 1
Procedure Heart(x,y,ScaleX.f=1,ScaleY.f=1,font=-1,txt$="")
Protected Z.f
Z = Zoom
MovePathCursor((x+109)*Z, (y+105)*Z)
AddPathCurve((x+235)*Z, (y-33)*Z, (x+219)*Z, (y+131)*Z, (x+114)*Z, (y+240)*Z)
AddPathCurve((x-29)*Z, (y+148)*Z, (x+40)*Z, (y)*Z, (x+109)*Z, (y+105)*Z)
VectorSourceColor(-12577347)
FillPath()
EndProcedure
; test code
w = 800
h= 600
OpenWindow(0, 0, 0, w,h, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CanvasGadget(0,0,0,w,h)
If StartVectorDrawing(CanvasVectorOutput(0))
AddPathBox(0,0, GadgetWidth(0),GadgetHeight(0))
VectorSourceColor(RGBA(120,120,120,255))
FillPath()
Heart(0,0)
StopVectorDrawing()
EndIf
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
Code: Select all
; Made with Cartoon ! 0.14
; Date : 12/04/2016
; Pb Version : 5.42 +
Global Zoom.f = 0.5
Procedure Alien2(x,y,ScaleX.f=1,ScaleY.f=1,font=-1,txt$="")
Protected Z.f
Z = Zoom
MovePathCursor((141+x)*Z, (107+y)*Z)
AddPathCurve((168+x)*Z, (98+y)*Z, (188+x)*Z, (154+y)*Z, (151+x)*Z, (161+y)*Z)
AddPathCurve((123+x)*Z, (163+y)*Z, (112+x)*Z, (118+y)*Z, (141+x)*Z, (107+y)*Z)
VectorSourceColor(-2491416)
FillPath()
MovePathCursor((144+x)*Z, (117+y)*Z)
AddPathCurve((159+x)*Z, (112+y)*Z, (183+x)*Z, (142+y)*Z, (153+x)*Z, (148+y)*Z)
AddPathCurve((137+x)*Z, (152+y)*Z, (126+x)*Z, (123+y)*Z, (144+x)*Z, (117+y)*Z)
VectorSourceColor(-16760254)
FillPath()
MovePathCursor((225+x)*Z, (290+y)*Z)
AddPathCurve((397+x)*Z, (263+y)*Z, (181+x)*Z, (342+y)*Z, (82+x)*Z, (347+y)*Z)
AddPathCurve((40+x)*Z, (352+y)*Z, (170+x)*Z, (222+y)*Z, (78+x)*Z, (190+y)*Z)
AddPathCurve((-11+x)*Z, (166+y)*Z, (0+x)*Z, (0+y)*Z, (143+x)*Z, (103+y)*Z)
AddPathCurve((146+x)*Z, (196+y)*Z, (449+x)*Z, (235+y)*Z, (219+x)*Z, (263+y)*Z)
AddPathCurve((173+x)*Z, (265+y)*Z, (193+x)*Z, (297+y)*Z, (225+x)*Z, (290+y)*Z)
VectorSourceColor(-16079976)
FillPath()
MovePathCursor((109+x)*Z, (115+y)*Z)
AddPathCurve((136+x)*Z, (106+y)*Z, (156+x)*Z, (162+y)*Z, (119+x)*Z, (169+y)*Z)
AddPathCurve((91+x)*Z, (171+y)*Z, (80+x)*Z, (126+y)*Z, (109+x)*Z, (115+y)*Z)
VectorSourceColor(-2491416)
FillPath()
MovePathCursor((115+x)*Z, (130+y)*Z)
AddPathCurve((130+x)*Z, (125+y)*Z, (154+x)*Z, (155+y)*Z, (124+x)*Z, (161+y)*Z)
AddPathCurve((108+x)*Z, (165+y)*Z, (97+x)*Z, (136+y)*Z, (115+x)*Z, (130+y)*Z)
VectorSourceColor(-16760254)
FillPath()
EndProcedure
; code test
w = 800
h= 600
OpenWindow(0, 0, 0, w,h, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CanvasGadget(0,0,0,w,h)
If StartVectorDrawing(CanvasVectorOutput(0))
AddPathBox(0,0, GadgetWidth(0),GadgetHeight(0))
VectorSourceColor(RGBA(120,120,120,255))
FillPath()
Alien2(0,0)
StopVectorDrawing()
EndIf
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
Hi,[blendman] wrote:Hi
I have created a software to create vector drawing (and animation in a futur version).
I have added an export in the menu : "Export in purebasic".
So you can use this software to create your icon/image and export in purebasic.
The Thread :
http://www.purebasic.fr/english/viewtop ... 27&t=65389
Code: Select all
;updt ...
;Declare.i ToClipboard (img.i, size.i, color1.i, color2.i)
;Declare.i FromClipboard (img.i, size.i, color1.i, color2.i)
Declare.i NewDocument (img.i, size.i, color1.i, color2.i, color3.i)
;new ...
Declare.i CloseDocument (img.i, size.i, color1.i, color2.i, color3.i, color4.i= 0)
Declare.i EditDocument (img.i, size.i, color1.i, color2.i, color3.i)
Declare.i ClearDocument (img.i, size.i, color1.i, color2.i, color3.i)
Declare.i ImportDocument (img.i, size.i, color1.i, color2.i, color3.i)
Declare.i ExportDocument (img.i, size.i, color1.i, color2.i, color3.i)
Declare.i SortAscending (img.i, size.i, color1.i, color2.i, color3.i)
Declare.i SortDescending (img.i, size.i, color1.i, color2.i, color3.i)
Declare.i SortBlockAscending (img.i, size.i, color1.i, color2.i)
Declare.i SortBlockDescending (img.i, size.i, color1.i, color2.i)
Declare.i ChartLine (img.i, size.i, color1.i, color2.i, color3.i, color4.i= 0)
Declare.i ChartDot(img.i, size.i, color1.i, color2.i, color3.i= 0)
Declare.i ChartBarVert(img.i, size.i, color1.i, color2.i, color3.i, color4.i, color5.i= 0)
Declare.i ChartCylVert(img.i, size.i, color1.i, color2.i, color3.i, color4.i, color5.i= 0)
Declare.i ChartPie(img.i, size.i, color1.i, color2.i, color3.i, color4.i, color5.i= 0)
;- Func new ...
Procedure.i Color_Darken(Color.i, Fact.d)
;By Omi, atm. for ChartPie & ChartBarVert
Protected.i ColorRet
;Divided into lines in order to avoid error message... (don't know how to do it in a macro)
If Fact > 1.0 : Fact = 1.0 : EndIf
ColorRet= Color & $ff000000
ColorRet+ (Color & $ff0000) * Fact
ColorRet+ (Color & $ff00) * Fact
ColorRet+ (Color & $ff) * Fact
ProcedureReturn ColorRet
EndProcedure
;- Procs mod ...
Procedure.i ToClipboard (img.i, size.i, color1.i, color2.i); mod. 14.04.
; 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
; out: return value: if img = #Pb_Any => number of the created image,
; error => 0
; [org. by Omi]
Protected ret.i
Protected hw.d = Round(size / 10.0, #PB_Round_Up)
Protected p.d = size / 32
Protected p2.d = size / 2
Protected p4.d = size / 4
Protected p8.d = size / 8
Protected p16.d = size / 16
ret = StartVectorIconOutput(img, size)
If ret
VectorSourceColor(color1)
; box
AddPathBox (hw, hw, size - 2 * hw, size - hw - size / 32)
StrokePath (size / 16, #PB_Path_DiagonalCorner)
; ring
AddPathCircle (p2, hw+1, hw, 180, 0)
StrokePath (size / 32)
; clamb
AddPathCircle (p2 + hw, 3*hw, hw-1, 180, 0)
FillPath()
AddPathCircle (p2 - hw, 3*hw, hw-1, 180, 0)
FillPath ()
StrokePath (size / 16)
MovePathCursor(p2 - hw, 2 * hw)
AddPathLine (2 * hw, 0, #PB_Path_Relative)
StrokePath (2 * hw, #PB_Path_RoundCorner)
VectorSourceColor(color2)
MovePathCursor(p2 + p4, p2 - p16)
AddPathLine (p2, p2 + p8)
AddPathLine (p2 + p4, p2 + p4 + p16)
ClosePath ()
FillPath ()
MovePathCursor(p2 + p4, p2 + p8)
AddPathLine (size, p2 + p8)
StrokePath (p8)
StopVectorDrawing()
EndIf
ProcedureReturn ret
EndProcedure
Procedure.i FromClipboard (img.i, size.i, color1.i, color2.i); mod. 14.04.
; 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
; out: return value: if img = #Pb_Any => number of the created image,
; error => 0
; [org. by Omi]
Protected ret.i
Protected hw.d = Round(size / 10.0, #PB_Round_Up)
Protected p.d = size / 32
Protected p2.d = size / 2
Protected p4.d = size / 4
Protected p8.d = size / 8
Protected p16.d = size / 16
ret = StartVectorIconOutput(img, size)
If ret
VectorSourceColor(color1)
; box
AddPathBox (hw, hw, size - 2 * hw, size - hw - size / 32)
StrokePath (size / 16, #PB_Path_DiagonalCorner)
; ring
AddPathCircle (p2, hw + 1, hw, 180, 0)
StrokePath (size / 32 + 0.1)
; clamb
AddPathCircle (p2 + hw, 3*hw, hw-1, 180, 0)
FillPath ()
StrokePath (size / 16)
AddPathCircle (p2 - hw, 3*hw, hw-1, 180, 0)
FillPath ()
StrokePath (size / 16)
MovePathCursor(p2 - hw, 2 * hw)
AddPathLine (2 * hw, 0, #PB_Path_Relative)
StrokePath (2 * hw, #PB_Path_RoundCorner)
; arrow
VectorSourceColor(color2)
MovePathCursor(size - p4, p2 - p16)
AddPathLine (size, p2 + p8)
AddPathLine (size - p4, p2 + p4 + p16)
ClosePath ()
FillPath ()
MovePathCursor(p2, p2 + p8)
AddPathLine (size - p4, p2 + p8)
StrokePath (p8)
StopVectorDrawing()
EndIf
ProcedureReturn ret
EndProcedure
Procedure.i NewDocument (img.i, size.i, color1.i, color2.i, color3.i); updt 10.04.
; 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
; 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 = size / 16
Protected p8 = size / 8
Protected p4 = size / 4
Protected p2 = size / 2
ret = StartVectorIconOutput(img, size)
If ret
; frame
MovePathCursor(p8, p16)
AddPathLine (size - p4 - p16, p16)
AddPathLine (size - p8, p4)
AddPathLine (size - p8, size - p16)
AddPathLine (p8, size - p16)
ClosePath ()
VectorSourceColor(color1)
FillPath(#PB_Path_Preserve)
VectorSourceColor(color2)
StrokePath (p16)
; dog-ear
MovePathCursor(size - p4 - p16, p16)
AddPathLine (size - p4 - p16, p4)
AddPathLine (size - p8, p4)
StrokePath (p)
; lines
MovePathCursor( 7 * p, 9 * p)
AddPathLine (19 * p, 9 * p)
MovePathCursor( 7 * p, 13 * p)
AddPathLine (24 * p, 13 * p)
MovePathCursor( 7 * p, 17 * p)
AddPathLine (16 * p, 17 * p)
MovePathCursor( 7 * p, 21 * p)
AddPathLine (13 * p, 21 * p)
MovePathCursor( 7 * p, 25 * p)
AddPathLine (14 * p, 25 * p)
StrokePath (p)
; +
VectorSourceColor(color3)
MovePathCursor(p2 + p8 + p, p2 + p16)
AddPathLine (p2 + p8 + p, size - p8)
MovePathCursor(p2, p2 + p4 - p)
AddPathLine (size - p8 - p16, p2 + p4 - p)
StrokePath (p16)
StopVectorDrawing()
EndIf
ProcedureReturn ret
EndProcedure
;- Procs new ...
Procedure.i EditDocument (img.i, size.i, color1.i, color2.i, color3.i); new 10.04.
; 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
; 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 = size / 16
Protected p8 = size / 8
Protected p4 = size / 4
Protected p2 = size / 2
ret = StartVectorIconOutput(img, size)
If ret
; frame
MovePathCursor(p8, p16)
AddPathLine (size - p4 - p16, p16)
AddPathLine (size - p8, p4)
AddPathLine (size - p8, size - p16)
AddPathLine (p8, size - p16)
ClosePath ()
VectorSourceColor(color1)
FillPath(#PB_Path_Preserve)
VectorSourceColor(color2)
StrokePath (p16)
; dog-ear
MovePathCursor(size - p4 - p16, p16)
AddPathLine (size - p4 - p16, p4)
AddPathLine (size - p8, p4)
StrokePath (p)
; lines
MovePathCursor( 7 * p, 9 * p)
AddPathLine (19 * p, 9 * p)
MovePathCursor( 7 * p, 13 * p)
AddPathLine (20 * p, 13 * p)
MovePathCursor( 7 * p, 17 * p)
AddPathLine (15 * p, 17 * p)
MovePathCursor( 7 * p, 21 * p)
AddPathLine (10 * p, 21 * p)
MovePathCursor( 7 * p, 25 * p)
AddPathLine ( 9 * p, 25 * p)
StrokePath (p)
; pen
VectorSourceColor(color3)
MovePathCursor(size - p, 7 * p)
AddPathLine (size - 5 * p, 11 * p)
StrokePath (p8)
VectorSourceColor(color1)
MovePathCursor(size - 5 * p, 11 * p)
AddPathLine (size - 6 * p, 12 * p)
StrokePath (p8)
VectorSourceColor(color3)
MovePathCursor(size - 6 * p, 12 * p)
AddPathLine (p2 - p, 23 * p)
StrokePath (p8)
MovePathCursor(13 * p, 23 * p)
AddPathLine (p2 - p8, 26 * p)
AddPathLine (p2 - p, 25 * p)
ClosePath()
FillPath()
StopVectorDrawing()
EndIf
ProcedureReturn ret
EndProcedure
Procedure.i ClearDocument (img.i, size.i, color1.i, color2.i, color3.i); new 10.04.
; 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
; 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 = size / 16
Protected p8 = size / 8
Protected p4 = size / 4
Protected p2 = size / 2
ret = StartVectorIconOutput(img, size)
If ret
; frame
MovePathCursor(p8, p16)
AddPathLine (size - p4 - p16, p16)
AddPathLine (size - p8, p4)
AddPathLine (size - p8, size - p16)
AddPathLine (p8, size - p16)
ClosePath ()
VectorSourceColor(color1)
FillPath(#PB_Path_Preserve)
VectorSourceColor(color2)
StrokePath (p16)
; dog-ear
MovePathCursor(size - p4 - p16, p16)
AddPathLine (size - p4 - p16, p4)
AddPathLine (size - p8, p4)
StrokePath (p)
; clear
VectorSourceColor(color3)
MovePathCursor( 7 * p, 19 * p)
AddPathLine ( 13 * p, 13 * p)
AddPathLine ( 25 * p, 13 * p)
AddPathLine ( 25 * p, 25 * p)
AddPathLine ( 13 * p, 25 * p)
ClosePath()
FillPath()
VectorSourceColor(color1)
MovePathCursor( 15 * p, 15 * p)
AddPathLine ( 23 * p, 23 * p)
MovePathCursor( 23 * p, 15 * p)
AddPathLine ( 15 * p, 23 * p)
StrokePath(p * 3)
StopVectorDrawing()
EndIf
ProcedureReturn ret
EndProcedure
Procedure.i ImportDocument (img.i, size.i, color1.i, color2.i, color3.i); new 10.04.
; 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
; 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 = size / 16
Protected p8 = size / 8
Protected p4 = size / 4
Protected p2 = size / 2
ret = StartVectorIconOutput(img, size)
If ret
; frame
MovePathCursor(p8, p16)
AddPathLine (size - p4 - p16, p16)
AddPathLine (size - p8, p4)
AddPathLine (size - p8, size - p16)
AddPathLine (p8, size - p16)
ClosePath ()
VectorSourceColor(color1)
FillPath(#PB_Path_Preserve)
VectorSourceColor(color2)
StrokePath (p16)
; dog-ear
MovePathCursor(size - p4 - p16, p16)
AddPathLine (size - p4 - p16, p4)
AddPathLine (size - p8, p4)
StrokePath (p)
; arrow
VectorSourceColor(color3)
MovePathCursor(p2 + p4, p2 - p16)
AddPathLine (p2, p2 + p8)
AddPathLine (p2 + p4, p2 + p4 + p16)
ClosePath ()
FillPath ()
MovePathCursor(p2 + p4, p2 + p8)
AddPathLine (size, p2 + p8)
StrokePath (p8)
VectorSourceColor(color1)
MovePathCursor(p2 + p4, p2 + p)
AddPathLine (size - p16 - p, p2 + p)
MovePathCursor(p2 + p4, p2 + p4 - p)
AddPathLine (size - p16 - p, p2 + p4 - p)
StrokePath (p16)
StopVectorDrawing()
EndIf
ProcedureReturn ret
EndProcedure
Procedure.i ExportDocument (img.i, size.i, color1.i, color2.i, color3.i); new 10.04.
; 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
; 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 = size / 16
Protected p8 = size / 8
Protected p4 = size / 4
Protected p2 = size / 2
ret = StartVectorIconOutput(img, size)
If ret
; frame
MovePathCursor(p8, p16)
AddPathLine (size - p4 - p16, p16)
AddPathLine (size - p8, p4)
AddPathLine (size - p8, size - p16)
AddPathLine (p8, size - p16)
ClosePath ()
VectorSourceColor(color1)
FillPath(#PB_Path_Preserve)
VectorSourceColor(color2)
StrokePath (p16)
; dog-ear
MovePathCursor(size - p4 - p16, p16)
AddPathLine (size - p4 - p16, p4)
AddPathLine (size - p8, p4)
StrokePath (p)
; lines
MovePathCursor( 7 * p, 9 * p)
AddPathLine (19 * p, 9 * p)
MovePathCursor( 7 * p, 13 * p)
AddPathLine (24 * p, 13 * p)
MovePathCursor( 7 * p, 17 * p)
AddPathLine (12 * p, 17 * p)
MovePathCursor( 7 * p, 21 * p)
AddPathLine (11 * p, 21 * p)
MovePathCursor( 7 * p, 25 * p)
AddPathLine (18 * p, 25 * p)
StrokePath (p)
; arrow
VectorSourceColor(color3)
MovePathCursor(size - p4, p2 - p16)
AddPathLine (size, p2 + p8)
AddPathLine (size - p4, p2 + p4 + p16)
ClosePath ()
FillPath ()
MovePathCursor(p2, p2 + p8)
AddPathLine (size - p4, p2 + p8)
StrokePath (p8)
VectorSourceColor(color1)
MovePathCursor(p2 + p4 + p/4, p / 2 * 25); not perfect ...
AddPathLine (size - p16 - p/2, p2 + p )
MovePathCursor(p2 + p4 + p/4, p / 2 * 55)
AddPathLine (size - p16 - p/2, p2 + p4 - p)
StrokePath (p16)
StopVectorDrawing()
EndIf
ProcedureReturn ret
EndProcedure
Procedure.i CloseDocument (img.i, size.i, color1.i, color2.i, color3.i, color4.i= 0); new 10.04.
; 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
; 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 = size / 16
Protected p8 = size / 8
Protected p4 = size / 4
Protected p2 = size / 2
ret = StartVectorIconOutput(img, size)
If ret
; frame
MovePathCursor(p8, p16)
AddPathLine (size - p4 - p16, p16)
AddPathLine (size - p8, p4)
AddPathLine (size - p8, size - p16)
AddPathLine (p8, size - p16)
ClosePath ()
VectorSourceColor(color1)
FillPath(#PB_Path_Preserve)
VectorSourceColor(color2)
StrokePath (p16)
; dog-ear
MovePathCursor(size - p4 - p16, p16)
AddPathLine (size - p4 - p16, p4)
AddPathLine (size - p8, p4)
StrokePath (p)
; lines
MovePathCursor( 7 * p, 9 * p)
AddPathLine (19 * p, 9 * p)
MovePathCursor( 7 * p, 13 * p)
AddPathLine (24 * p, 13 * p)
MovePathCursor( 7 * p, 17 * p)
AddPathLine (16 * p, 17 * p)
MovePathCursor( 7 * p, 21 * p)
AddPathLine (13 * p, 21 * p)
MovePathCursor( 7 * p, 25 * p)
AddPathLine (14 * p, 25 * p)
StrokePath (p)
; panel
VectorSourceColor(color3)
AddPathCircle (size - p4, size - p4, p4)
FillPath ()
VectorSourceColor(color4)
AddPathCircle (size - p4, size - p4, p4-p)
StrokePath (p)
; bar
VectorSourceColor(color1)
MovePathCursor (size - 7 * p16, size - p4)
AddPathLine (6 * p16, 0, #PB_Path_Relative)
StrokePath (size / 10)
StopVectorDrawing()
EndIf
ProcedureReturn ret
EndProcedure
Procedure.i SortAscending(img.i, size.i, color1.i, color2.i, color3.i); new 10.04.
; 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
; 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 = size / 16
Protected p8 = size / 8
Protected p4 = size / 4
Protected p2 = size / 2
ret = StartVectorIconOutput(img, size)
If ret
; frame
MovePathCursor(p8, p16)
AddPathLine (size - p4 - p16, p16)
AddPathLine (size - p8, p4)
AddPathLine (size - p8, size - p16)
AddPathLine (p8, size - p16)
ClosePath ()
VectorSourceColor(color1)
FillPath(#PB_Path_Preserve)
VectorSourceColor(color2)
StrokePath (p16)
; dog-ear
MovePathCursor(size - p4 - p16, p16)
AddPathLine (size - p4 - p16, p4)
AddPathLine (size - p8, p4)
StrokePath (p)
; lines
MovePathCursor( 7 * p, 9 * p)
AddPathLine (12 * p, 9 * p)
MovePathCursor( 7 * p, 13 * p)
AddPathLine (12 * p, 13 * p)
MovePathCursor( 7 * p, 17 * p)
AddPathLine (12 * p, 17 * p)
MovePathCursor( 7 * p, 21 * p)
AddPathLine (12 * p, 21 * p)
MovePathCursor( 7 * p, 25 * p)
AddPathLine (12 * p, 25 * p)
StrokePath (p)
; arrow
VectorSourceColor(color3)
MovePathCursor (p2 + p8, p * 10)
AddPathLine (p2 + p8, p2 + p16)
StrokePath (p8)
MovePathCursor (p2 - p16, p2 + p16)
AddPathLine (p2 + p8, size - p16 * 3)
AddPathLine (p2 + p4 + p16, p2 + p16)
ClosePath ()
FillPath ()
StopVectorDrawing()
EndIf
ProcedureReturn ret
EndProcedure
Procedure.i SortDescending(img.i, size.i, color1.i, color2.i, color3.i); new 10.04.
; 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
; 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 = size / 16
Protected p8 = size / 8
Protected p4 = size / 4
Protected p2 = size / 2
ret = StartVectorIconOutput(img, size)
If ret
; frame
MovePathCursor(p8, p16)
AddPathLine (size - p4 - p16, p16)
AddPathLine (size - p8, p4)
AddPathLine (size - p8, size - p16)
AddPathLine (p8, size - p16)
ClosePath ()
VectorSourceColor(color1)
FillPath(#PB_Path_Preserve)
VectorSourceColor(color2)
StrokePath (p16)
; dog-ear
MovePathCursor(size - p4 - p16, p16)
AddPathLine (size - p4 - p16, p4)
AddPathLine (size - p8, p4)
StrokePath (p)
; lines
MovePathCursor( 7 * p, 9 * p)
AddPathLine (12 * p, 9 * p)
MovePathCursor( 7 * p, 13 * p)
AddPathLine (12 * p, 13 * p)
MovePathCursor( 7 * p, 17 * p)
AddPathLine (12 * p, 17 * p)
MovePathCursor( 7 * p, 21 * p)
AddPathLine (12 * p, 21 * p)
MovePathCursor( 7 * p, 25 * p)
AddPathLine (12 * p, 25 * p)
StrokePath (p)
; arrow
VectorSourceColor(color3)
MovePathCursor (p2 + p8, p2 + p16)
AddPathLine (p2 + p8, size - p16 * 3)
StrokePath (p8)
MovePathCursor (p2 - p16, p2 + p16)
AddPathLine (p2 + p8, p16 * 5)
AddPathLine (p2 + p4 + p16, p2 + p16)
ClosePath ()
FillPath ()
StopVectorDrawing()
EndIf
ProcedureReturn ret
EndProcedure
Procedure.i SortBlockAscending(img.i, size.i, color1.i, color2.i); new 10.04.
; 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
; 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 = size / 16
Protected p8 = size / 8
Protected p4 = size / 4
Protected p2 = size / 2
ret = StartVectorIconOutput(img, size)
If ret
; frame
MovePathCursor(p8, p16)
AddPathLine (size - p4 - p16, p16)
AddPathLine (size - p8, p4)
AddPathLine (size - p8, size - p16)
AddPathLine (p8, size - p16)
ClosePath ()
VectorSourceColor(color1)
FillPath(#PB_Path_Preserve)
VectorSourceColor(color2)
StrokePath (p16)
; dog-ear
MovePathCursor(size - p4 - p16, p16)
AddPathLine (size - p4 - p16, p4)
AddPathLine (size - p8, p4)
StrokePath (p)
; block
AddPathBox (6 * p, 9 * p, p2 + p8, p2)
FillPath()
; lines
MovePathCursor( 7 * p, 6 * p)
AddPathLine (12 * p, 6 * p)
StrokePath (p16)
VectorSourceColor(color1)
MovePathCursor( 7 * p, 17 * p)
AddPathLine (12 * p, 17 * p)
MovePathCursor( 7 * p, 21 * p)
AddPathLine (12 * p, 21 * p)
MovePathCursor( 7 * p, 13 * p)
AddPathLine (12 * p, 13 * p)
StrokePath (p16)
; arrow
VectorSourceColor(color1)
MovePathCursor (p2 + p8, p * 11)
AddPathLine (p2 + p8, p2 + p16)
StrokePath (p8)
MovePathCursor (p2 - p16, p2 + p)
AddPathLine (p2 + p8, size - p4)
AddPathLine (p2 + p4 + p16, p2 + p)
ClosePath ()
FillPath ()
StopVectorDrawing()
EndIf
ProcedureReturn ret
EndProcedure
Procedure.i SortBlockDescending(img.i, size.i, color1.i, color2.i); new 10.04.
; 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
; 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 = size / 16
Protected p8 = size / 8
Protected p4 = size / 4
Protected p2 = size / 2
ret = StartVectorIconOutput(img, size)
If ret
; frame
MovePathCursor(p8, p16)
AddPathLine (size - p4 - p16, p16)
AddPathLine (size - p8, p4)
AddPathLine (size - p8, size - p16)
AddPathLine (p8, size - p16)
ClosePath ()
VectorSourceColor(color1)
FillPath (#PB_Path_Preserve)
VectorSourceColor(color2)
StrokePath (p16)
; dog-ear
MovePathCursor(size - p4 - p16, p16)
AddPathLine (size - p4 - p16, p4)
AddPathLine (size - p8, p4)
StrokePath (p)
; block
AddPathBox (6 * p, 9 * p, p2 + p8, p2)
FillPath ()
; lines
MovePathCursor( 7 * p, 6 * p)
AddPathLine (12 * p, 6 * p)
StrokePath (p16)
VectorSourceColor(color1)
MovePathCursor( 7 * p, 17 * p)
AddPathLine (12 * p, 17 * p)
MovePathCursor( 7 * p, 21 * p)
AddPathLine (12 * p, 21 * p)
MovePathCursor( 7 * p, 13 * p)
AddPathLine (12 * p, 13 * p)
StrokePath (p16)
; arrow
VectorSourceColor(color1)
MovePathCursor (p2 + p8, p2)
AddPathLine (p2 + p8, size - p4 -p)
StrokePath (p8)
MovePathCursor (p2 - p16, p2 + p)
AddPathLine (p2 + p8, p * 10)
AddPathLine (p2 + p4 + p16, p2 + p)
ClosePath ()
FillPath ()
StopVectorDrawing()
EndIf
ProcedureReturn ret
EndProcedure
Procedure.i ChartLine(img.i, size.i, color1.i, color2.i, color3.i, color4.i= 0); new 10.04.
; 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
; out: return value: if img = #Pb_Any => number of the created image,
; error => 0
; [org. by Omi]
Protected i.i, ret.i
Protected p.d = size / 32
Protected p16 = size / 16
Protected p8 = size / 8
Protected p4 = size / 4
Protected p2 = size / 2
ret = StartVectorIconOutput(img, size)
If ret
If color4
VectorSourceColor(color4)
AddPathBox(1, 0, size - 1, size - 1)
FillPath()
EndIf
VectorSourceColor(color1)
For I= 0 To 270 Step 270
RotateCoordinates(p2, p2, I)
; axes
MovePathCursor(0, 0)
AddPathLine (0, size)
; scale
MovePathCursor(0, 0)
AddPathLine (p16, 0)
MovePathCursor(0, p4)
AddPathLine (p16, p4)
MovePathCursor(0, p2)
AddPathLine (p16, p2)
MovePathCursor(0, p2 + p4)
AddPathLine (p16, p2 + p4)
MovePathCursor(0, size)
AddPathLine (p16, size)
StrokePath (1)
Next I
ResetCoordinates()
;lines
VectorSourceColor(color2)
MovePathCursor(p8, p2)
AddPathLine (p4, p * 7)
AddPathLine (p2, p * 15)
AddPathLine (p2 + p4, p * 8)
AddPathLine (size, p * 22)
StrokePath (Round(p, #PB_Round_Up))
VectorSourceColor(color3)
MovePathCursor(p8, p2 + p4)
AddPathLine (p4, p * 18)
AddPathLine (p2, p * 19)
AddPathLine (p2 + p4, p * 24)
AddPathLine (size, p * 12)
StrokePath (Round(p, #PB_Round_Up))
StopVectorDrawing()
EndIf
ProcedureReturn ret
EndProcedure
Procedure.i ChartDot(img.i, size.i, color1.i, color2.i, color3.i= 0); new 10.04.
; 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
; out: return value: if img = #Pb_Any => number of the created image,
; error => 0
; [org. by Omi]
Protected i.i, ret.i
Protected p.d = size / 32
Protected p16 = size / 16
Protected p8 = size / 8
Protected p4 = size / 4
Protected p2 = size / 2
ret = StartVectorIconOutput(img, size)
If ret
If color3
VectorSourceColor(color3)
AddPathBox(1, 0, size - 1, size - 1)
FillPath()
EndIf
VectorSourceColor(color1)
For I= 0 To 270 Step 270
RotateCoordinates(p2, p2, I)
; axes
MovePathCursor(0, 0)
AddPathLine (0, size)
; scale
MovePathCursor(0, 0)
AddPathLine (p16, 0)
MovePathCursor(0, p4)
AddPathLine (p16, p4)
MovePathCursor(0, p2)
AddPathLine (p16, p2)
MovePathCursor(0, p2 + p4)
AddPathLine (p16, p2 + p4)
MovePathCursor(0, size)
AddPathLine (p16, size)
StrokePath (1)
Next I
ResetCoordinates()
;dots
VectorSourceColor(color2)
AddPathCircle (p4 - p16, p * 10, p16)
AddPathCircle (p2 - p16, p * 17, p16)
AddPathCircle (p2 + p4 - p16, p * 8, p16)
AddPathCircle (size - p16, p * 21, p16)
FillPath ()
StopVectorDrawing()
EndIf
ProcedureReturn ret
EndProcedure
Procedure.i ChartBarVert(img.i, size.i, color1.i, color2.i, color3.i, color4.i, color5.i= 0); new 10.04.
; 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
; out: return value: if img = #Pb_Any => number of the created image,
; error => 0
; [org. by Omi]
Protected i.i, ret.i
Protected p.d = size / 32
Protected p16 = size / 16
Protected p8 = size / 8
Protected p4 = size / 4
Protected p2 = size / 2
ret = StartVectorIconOutput(img, size)
If ret
If color5
VectorSourceColor(color5)
AddPathBox(1, 0, size - 1, size - 1)
FillPath()
EndIf
VectorSourceColor(color1)
For I= 0 To 270 Step 270
RotateCoordinates(p2, p2, I)
; axes
MovePathCursor(0, 0)
AddPathLine (0, size)
; scale
MovePathCursor(0, 0)
AddPathLine (p16, 0)
MovePathCursor(0, p4)
AddPathLine (p16, p4)
MovePathCursor(0, p2)
AddPathLine (p16, p2)
MovePathCursor(0, p2 + p4)
AddPathLine (p16, p2 + p4)
MovePathCursor(0, size)
AddPathLine (p16, size)
StrokePath(1)
Next I
ResetCoordinates()
;bars
VectorSourceColor(color4)
AddPathBox (p4, p4, p4 - p16 - p, size - p4 - p8)
FillPath (#PB_Path_Preserve)
VectorSourceColor(Color_Darken(color4, 0.75))
StrokePath (1)
VectorSourceColor(color3)
AddPathBox (p2, p8, p4 - p16 - p, size - p8 - p8)
FillPath (#PB_Path_Preserve)
VectorSourceColor(Color_Darken(color3, 0.75))
StrokePath (1)
VectorSourceColor(color2)
AddPathBox (p4 + p2, p2, p4 - p16 - p, size - p2 - p8)
FillPath (#PB_Path_Preserve)
VectorSourceColor(Color_Darken(color2, 0.75))
StrokePath (1)
StopVectorDrawing()
EndIf
ProcedureReturn ret
EndProcedure
Procedure.i ChartCylVert(img.i, size.i, color1.i, color2.i, color3.i, color4.i, color5.i= 0); new 10.04.
; 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
; out: return value: if img = #Pb_Any => number of the created image,
; error => 0
; [org. by Omi]
Protected i.i, ret.i
Protected p.d = size / 32
Protected p16 = size / 16
Protected p8 = size / 8
Protected p4 = size / 4
Protected p2 = size / 2
ret = StartVectorIconOutput(img, size)
If ret
If color5
VectorSourceColor(color5)
AddPathBox(1, 0, size - 1, size - 1)
FillPath()
EndIf
VectorSourceColor(color1)
For I= 0 To 270 Step 270
RotateCoordinates(p2, p2, I)
; axes
MovePathCursor(0, 0)
AddPathLine (0, size)
; scale
MovePathCursor(0, 0)
AddPathLine (p16, 0)
MovePathCursor(0, p4)
AddPathLine (p16, p4)
MovePathCursor(0, p2)
AddPathLine (p16, p2)
MovePathCursor(0, p2 + p4)
AddPathLine (p16, p2 + p4)
MovePathCursor(0, size)
AddPathLine (p16, size)
StrokePath (1)
Next I
ResetCoordinates()
;cylinders
VectorSourceLinearGradient(p4, 0, p2 - p16+1, 0)
VectorSourceGradientColor (color1, 0.0)
VectorSourceGradientColor (color4, 0.5)
VectorSourceGradientColor (color1, 1.0)
AddPathBox (p4, p4, p4- p16, size - p4 - p16)
FillPath ()
VectorSourceLinearGradient(p2, 0, p4 + p2 - p16+1, 0)
VectorSourceGradientColor (color1, 0.0)
VectorSourceGradientColor (color3, 0.5)
VectorSourceGradientColor (color1, 1.0)
AddPathBox (p2, p8, p4- p16, size - p8 - p16)
FillPath ()
VectorSourceLinearGradient(p4 + p2, 0, size - p16+1, 0)
VectorSourceGradientColor (color1, 0.0)
VectorSourceGradientColor (color2, 0.5)
VectorSourceGradientColor (color1, 1.0)
AddPathBox (p4 + p2, p2, p4- p16, size - p2 - p16)
FillPath ()
StopVectorDrawing()
EndIf
ProcedureReturn ret
EndProcedure
Procedure.i ChartPie(img.i, size.i, color1.i, color2.i, color3.i, color4.i, color5.i= 0); new 10.04.
; 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
; 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 = size / 16
Protected p8 = size / 8
Protected p4 = size / 4
Protected p2 = size / 2
ret = StartVectorIconOutput(img, size)
If ret
;border
If color5
VectorSourceColor(color5)
AddPathBox(0, 0, size, size)
FillPath()
EndIf
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)
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)
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)
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
;-color const ...
#ImgCloseDocument
#ImgEditDocument
#ImgClearDocument
#ImgImportDocument
#ImgExportDocument
#ImgSortAscending
#ImgSortDescending
#ImgSortBlockAsc
#ImgSortBlockDesc
#ImgChartLine
#ImgChartDot
#ImgChartBarVert
#ImgChartCylVert
#ImgChartPie
;-Tooltip textes
Data.s "CloseDocument", "EditDocument", "ClearDocument", "ImportDocument", "ExportDocument", "SortAscending", "SortDescending", "SortBlockAsc", "SortBlockDesc"
Data.s "ChartLine", "ChartDot", "ChartBarVert", "ChartCylVert", "ChartPie"
;-colored mod ...
ToClipboard(#ImgToClipboard, size, #CSS_Navy, #CSS_Black)
FromClipboard(#ImgFromClipboard, size, #CSS_Navy, #CSS_Black)
NewDocument(#ImgNewDocument, size, #CSS_White, #CSS_Navy, #CSS_Black)
;-colored new ...
CloseDocument(#ImgCloseDocument, size, #CSS_White, #CSS_Navy, #CSS_Red)
EditDocument(#ImgEditDocument, size, #CSS_White, #CSS_Navy, #CSS_Black)
ClearDocument(#ImgClearDocument, size, #CSS_White, #CSS_Navy, #CSS_Black)
ImportDocument (#ImgImportDocument, size, #CSS_White, #CSS_Navy, #CSS_Black)
ExportDocument (#ImgExportDocument, size, #CSS_White, #CSS_Navy, #CSS_Black)
SortAscending (#ImgSortAscending, size, #CSS_White, #CSS_Navy, #CSS_Black)
SortDescending (#ImgSortDescending, size, #CSS_White, #CSS_Navy, #CSS_Black)
SortBlockAscending(#ImgSortBlockAsc, size, #CSS_White, #CSS_Navy)
SortBlockDescending (#ImgSortBlockDesc, size, #CSS_White, #CSS_Navy)
ChartLine (#ImgChartLine, size, #CSS_Black, #CSS_Green, #CSS_Blue)
ChartDot (#ImgChartDot, size, #CSS_Black, #CSS_Blue)
ChartBarVert (#ImgChartBarVert, size, #CSS_Black, #CSS_Green, #CSS_Yellow, #CSS_Blue)
ChartCylVert (#ImgChartCylVert, size, #CSS_Black, #CSS_Lime, #CSS_Yellow, #CSS_LightSkyBlue)
ChartPie (#ImgChartPie, size, #CSS_Black, #CSS_Lime, #CSS_Yellow, #CSS_CornflowerBlue)
;-grayed mod ..
ToClipboard(#ImgToClipboard + #IconCount, size, #CSS_Silver, #CSS_Silver); mod ...
FromClipboard(#ImgFromClipboard + #IconCount, size, #CSS_Silver, #CSS_Silver)
NewDocument(#ImgNewDocument + #IconCount, size, #CSS_WhiteSmoke, #CSS_Silver, #CSS_Silver)
;-grayed new ...
CloseDocument(#ImgCloseDocument + #IconCount, size, #CSS_WhiteSmoke, #CSS_Silver, #CSS_Silver, #CSS_WhiteSmoke); new ...
EditDocument(#ImgEditDocument + #IconCount, size, #CSS_WhiteSmoke, #CSS_Silver, #CSS_Silver)
ClearDocument(#ImgClearDocument + #IconCount, size, #CSS_WhiteSmoke, #CSS_Silver, #CSS_Silver)
ImportDocument (#ImgImportDocument + #IconCount, size, #CSS_WhiteSmoke, #CSS_Silver, #CSS_Silver)
ExportDocument (#ImgExportDocument + #IconCount, size, #CSS_WhiteSmoke, #CSS_Silver, #CSS_Silver)
SortAscending (#ImgSortAscending + #IconCount, size, #CSS_WhiteSmoke, #CSS_Silver, #CSS_Silver)
SortDescending (#ImgSortDescending + #IconCount, size, #CSS_WhiteSmoke, #CSS_Silver, #CSS_Silver)
SortBlockAscending(#ImgSortBlockAsc + #IconCount, size, #CSS_WhiteSmoke, #CSS_Silver)
SortBlockDescending (#ImgSortBlockDesc + #IconCount, size, #CSS_WhiteSmoke, #CSS_Silver)
ChartLine (#ImgChartLine + #IconCount, size, #CSS_DimGrey, #CSS_Silver, #CSS_Silver)
ChartDot (#ImgChartDot + #IconCount, size, #CSS_DimGrey, #CSS_Silver)
ChartBarVert (#ImgChartBarVert + #IconCount, size, #CSS_DimGrey, #CSS_Silver, #CSS_Silver, #CSS_Silver)
ChartCylVert (#ImgChartCylVert + #IconCount, size, #CSS_DimGrey, #CSS_Silver, #CSS_Silver, #CSS_Silver)
ChartPie (#ImgChartPie + #IconCount, size, #CSS_DimGrey, #CSS_Silver, #CSS_Silver, #CSS_Silver)
That's pretty fine, thank you!Oma wrote:I've added a simple function (Color_Darken(Color.i, Fact.d)) to darken existing colors. I hope, that's okay for you. (I have no idea how to do it with a macro).
And once again i didn't expect this. Sorry and thanks.One of your icons again disclosed a bug in the VectorDrawing lib
Code: Select all
Color & $ff000000 + (Color & $ff0000) * 0.8 + (Color & $ff00) * 0.8 + (Color & $ff) * 0.8
The same with lines likeCan't use any of the following operands with floats: <<, >>, &, |, !, %
Code: Select all
ColorRet+ Int((Color & $ff0000) * Fact)
Code: Select all
Procedure.i Color_Darken(Color.i, Fact.d)
Protected.i ColorRet, Element
;ColorRet= Color & $ff000000
;ColorRet+ (Color & $ff0000) * Fact
;ColorRet+ (Color & $ff00) * Fact
;ColorRet+ (Color & $ff) * Fact
;... Changed due to Color dependent bug, 2016-04-19 ...
If Fact > 1.0 : Fact = 1.0 : EndIf
ColorRet= (Color & $ff000000)
Element= ((Color & $ff0000) >> 16) * Fact
ColorRet+ Element << 16
Element= ((Color & $ff00) >> 8) * Fact
ColorRet+ Element << 8
Element= (Color & $ff) * Fact
ColorRet+ Element
ProcedureReturn ColorRet
EndProcedure
Actually i saw it the first time on a screenshot from rashads chart-library, but it didn't work on Linux and tried it myself. So i think you'd better give the credits to rashad.I have an icon that needs a pencil, could I plagiarize yours or better still could it be made into a macro?
Code: Select all
Declare.i Rating (img.i, size.i, color1.i, color2.i)
Procedure.i Rating (img.i, size.i, color1.i, color2.i)
; 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
; out: return value: if img = #Pb_Any => number of the created image,
; error => 0
; [by davido]
Protected ret.i, p.d, k.i
ret = StartVectorIconOutput(img, size)
p = size / 32
If ret
VectorSourceColor(color1)
DrawStar(6*p,6*p,5*p)
DrawStar(6*p,16*p,5*p)
DrawStar(16*p,16*p,5*p)
DrawStar(6*p,26*p,5*p)
DrawStar(16*p,26*p,5*p)
DrawStar(26*p,26*p,5*p)
FillPath()
VectorSourceColor(color2)
DrawStar(16*p,6*p,5*p)
DrawStar(26*p,6*p,5*p)
DrawStar(26*p,16*p,5*p)
FillPath()
StopVectorDrawing()
EndIf
ProcedureReturn ret
EndProcedure
#ImgRating
"Rating"
Rating(#ImgRating, size.i, #CSS_Orange, #CSS_WhiteSmoke)
Rating(#ImgRating + #IconCount, size.i, #CSS_Silver, #CSS_WhiteSmoke)
I have transmogrified oma's code into a macro. I think he doesn't mind.davido wrote:@oma,
[...]
I have an icon that needs a pencil, could I plagiarize yours or better still could it be made into a macro?
Code: Select all
Procedure.i Color_Darken(Color.i, Fact.d)
Protected.i Red, Blue, Green, Alpha
If Fact > 1.0 : Fact = 1.0 : EndIf
Alpha = Alpha(Color)
Red = Red(Color) * Fact
Green = Green(Color) * Fact
Blue = Blue(Color) * Fact
ProcedureReturn RGBA(Red, Green, Blue, Alpha)
EndProcedure
Sorry, I do not understand. The PNG preview picture contains ( 7*15 + 8 ) * 2 = 226 icons, and the "vectoricons_svg" folder in the ZIP archive contains 226 SVG files. Both contain your and davidos most recent contributions. And the ZIP archive that I get by dowload from the first post here is identical to my private copy. So can you please tell me more in detail what you think is missing?Oma wrote:@ Hi John,
i think it's time to update to your last collection.
As you probably know, you can think of a macro in PB basically as an instruction for Search and Replace. For instance the following is valid codeOma wrote:I.e. i have no idea why the Protected Vars works within RefreshArrow() without Parameters.
Code: Select all
EnableExplicit
Macro Add()
a + b
EndMacro
Procedure Foo()
Protected.i a, b
a = 3
b = 5
Debug Add()
EndProcedure
Foo()
Code: Select all
EnableExplicit
Procedure Foo()
Protected.i a, b
a = 3
b = 5
Debug a + b
EndProcedure
Foo()
Code: Select all
Macro Add (_a_, _b_)
_a_ + _b_
EndMacro
Code: Select all
Declare.i OrangeFruit (img.i, size.i, color1.i, color2.i)
Declare.i LemonFruit (img.i, size.i, color1.i, color2.i)
Declare.i LimeFruit (img.i, size.i, color1.i, color2.i)
Macro DrawCitrusFruit (_size_, _color1_, _color2_)
; _size_ : width and height
; [by davido]
VectorSourceColor(_color1_)
AddPathCircle(0.5*_size_,0.5*_size_,0.45*_size_)
StrokePath(0.03125*_size_)
VectorSourceColor(_color2_)
AddPathCircle(0.5*_size_,0.5*_size_,0.45*_size_)
FillPath()
VectorSourceColor(_color1_)
AddPathCircle(0.5*_size_,0.5*_size_,0.40*_size_)
FillPath()
VectorSourceColor(_color2_)
MovePathCursor(0.49*_size_,0.5*_size_)
AddPathLine(0.48*_size_,0.1*_size_)
AddPathLine(0.52*_size_,0.1*_size_)
AddPathLine(0.51*_size_,0.5*_size_)
ClosePath()
RotateCoordinates(0.5*_size_,0.5*_size_,50)
MovePathCursor(0.49*_size_,0.5*_size_)
AddPathLine(0.48*_size_,0.1*_size_)
AddPathLine(0.52*_size_,0.1*_size_)
AddPathLine(0.51*_size_,0.5*_size_)
ClosePath()
RotateCoordinates(0.5*_size_,0.5*_size_,75)
MovePathCursor(0.49*_size_,0.5*_size_)
AddPathLine(0.48*_size_,0.1*_size_)
AddPathLine(0.52*_size_,0.1*_size_)
AddPathLine(0.51*_size_,0.5*_size_)
ClosePath()
RotateCoordinates(0.5*_size_,0.5*_size_,45)
MovePathCursor(0.49*_size_,0.5*_size_)
AddPathLine(0.48*_size_,0.1*_size_)
AddPathLine(0.52*_size_,0.1*_size_)
AddPathLine(0.51*_size_,0.5*_size_)
ClosePath()
RotateCoordinates(0.5*_size_,0.5*_size_,65)
MovePathCursor(0.49*_size_,0.5*_size_)
AddPathLine(0.48*_size_,0.1*_size_)
AddPathLine(0.52*_size_,0.1*_size_)
AddPathLine(0.51*_size_,0.5*_size_)
ClosePath()
RotateCoordinates(0.5*_size_,0.5*_size_,55)
MovePathCursor(0.49*_size_,0.5*_size_)
AddPathLine(0.48*_size_,0.1*_size_)
AddPathLine(0.52*_size_,0.1*_size_)
AddPathLine(0.51*_size_,0.5*_size_)
ClosePath()
FillPath()
AddPathCircle(0.5*_size_,0.5*_size_,0.0625*_size_)
FillPath()
EndMacro
Procedure.i OrangeFruit (img.i, size.i, color1.i, color2.i)
; 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
; out: return value: if img = #Pb_Any => number of the created image,
; error => 0
; [by davido]
Protected ret.i
ret = StartVectorIconOutput(img, size)
If ret
DrawCitrusFruit(size,color1,color2)
StopVectorDrawing()
EndIf
ProcedureReturn ret
EndProcedure
Procedure.i LemonFruit (img.i, size.i, color1.i, color2.i)
; 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
; out: return value: if img = #Pb_Any => number of the created image,
; error => 0
; [by davido]
Protected ret.i
ret = StartVectorIconOutput(img, size)
If ret
DrawCitrusFruit(size,color1,color2)
StopVectorDrawing()
EndIf
ProcedureReturn ret
EndProcedure
Procedure.i LimeFruit (img.i, size.i, color1.i, color2.i)
; 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
; out: return value: if img = #Pb_Any => number of the created image,
; error => 0
; [by davido]
Protected ret.i
ret = StartVectorIconOutput(img, size)
If ret
DrawCitrusFruit(size,color1,color2)
StopVectorDrawing()
EndIf
ProcedureReturn ret
EndProcedure
#ImgOrangeFruit
#ImgLemonFruit
#ImgLimeFruit
"Orange Fruit", "LemonFruit", "LimeFruit"
OrangeFruit(#ImgOrangeFruit, size, #CSS_Orange, #CSS_WhiteSmoke)
LimeFruit(#ImgLimeFruit, size, #CSS_LimeGreen, #CSS_WhiteSmoke)
LemonFruit(#ImgLemonFruit, size, #CSS_Khaki, #CSS_WhiteSmoke)
OrangeFruit(#ImgOrangeFruit + #IconCount, size, #CSS_Silver, #CSS_WhiteSmoke)
LemonFruit(#ImgLemonFruit + #IconCount, size, #CSS_Silver, #CSS_WhiteSmoke)
LimeFruit(#ImgLimeFruit + #IconCount, size, #CSS_Silver, #CSS_WhiteSmoke)
No, no!I think the misunderstanding is due to me...
Code: Select all
;transparent, round, 3D-VectorLib-Button-Background by Omi
;update 23.04.2016, 06:10
EnableExplicit
; Object constants
#Win_Main= 0
#Txt1 = 0
#But1 = 1
#But2 = 2
#Img1Off= 0
#Img1On = 1
#Img2Off= 2
#Img2On = 3
Global.i size = 64
Global.i radius = size / 2
Global.s gText = "3D"
Global.i gEvent, gQuit
LoadFont(0, "Arial", 12, #PB_Font_Bold)
Macro Vector3dButton_Text()
; ;change it to your own taste
VectorSourceColor($AA225555)
MovePathCursor(radius-1 - tW / 2, radius-1 - tH / 2)
DrawVectorText(gText)
VectorSourceColor($AA558888)
MovePathCursor(radius+1 - tW / 2, radius+1 - tH / 2)
DrawVectorText(gText)
VectorSourceColor($AABBFFFF)
MovePathCursor(radius - tW / 2, radius - tH / 2)
DrawVectorText(gText)
;or a simple intransparent black ...
; VectorSourceColor($FF000000)
; MovePathCursor(radius - tW / 2, radius - tH / 2)
; DrawVectorText(gText)
EndMacro
Macro Vector3dButton_Triangle()
VectorSourceColor($AABBFFFF)
MovePathCursor(radius - radius / 3, radius - radius / 2)
AddPathLine (radius + radius / 2, radius)
AddPathLine (radius - radius / 3, radius + radius / 2)
ClosePath()
FillPath()
EndMacro
Procedure Vector3dButton_Yellow()
Protected.d tW, tH
If StartVectorDrawing(ImageVectorOutput(#Img1Off))
VectorFont(FontID(0), radius)
tW= VectorTextWidth(gText)
tH= VectorTextHeight(gText)
;mixed convex yellow
VectorSourceLinearGradient(0, 0, size, size)
VectorSourceGradientColor(RGBA( 255, 255, 0, 255), 0.0)
VectorSourceGradientColor(RGBA( 127, 127, 0, 255), 1.0)
AddPathCircle(radius, radius, radius)
FillPath()
;variation from disabling the next 3 line ...
VectorSourceColor($6600DDDD)
AddPathCircle(radius, radius, radius - radius / 8)
FillPath()
;text
Vector3dButton_Text()
StopVectorDrawing()
EndIf
If StartVectorDrawing(ImageVectorOutput(#Img1On))
VectorFont(FontID(0), radius)
tW= VectorTextWidth(gText)
tH= VectorTextHeight(gText)
;mixed flat yellow, appears sunken
VectorSourceLinearGradient(0, 0, size, size)
VectorSourceGradientColor(RGBA( 255, 255, 0, 255), 0.0)
VectorSourceGradientColor(RGBA( 127, 127, 0, 255), 1.0)
AddPathCircle(radius, radius, radius)
FillPath()
VectorSourceColor($FF00DDDD)
AddPathCircle(radius, radius, radius - radius / 8)
FillPath()
;text
Vector3dButton_Text()
StopVectorDrawing()
EndIf
EndProcedure
Procedure Vector3dButton_BlueGray()
Protected.d tW, tH
If StartVectorDrawing(ImageVectorOutput(#Img2Off))
VectorFont(FontID(0), radius)
tW= VectorTextWidth(gText)
tH= VectorTextHeight(gText)
;mixed convex yellow
VectorSourceLinearGradient(0, 0, size, size)
VectorSourceGradientColor(RGBA( 127, 127, 255, 255), 0.0)
VectorSourceGradientColor(RGBA( 0, 0, 255, 255), 1.0)
AddPathCircle(radius, radius, radius)
FillPath()
;try to disable the next 3 line ...
VectorSourceColor($6600DDDD)
AddPathCircle(radius, radius, radius - radius / 8)
FillPath()
;triangle
Vector3dButton_Triangle()
StopVectorDrawing()
EndIf
If StartVectorDrawing(ImageVectorOutput(#Img2On))
VectorFont(FontID(0), radius)
tW= VectorTextWidth(gText)
tH= VectorTextHeight(gText)
;mixed flat yellow, appears sunken
VectorSourceLinearGradient(0, 0, size, size)
VectorSourceGradientColor(RGBA( 127, 127, 255, 255), 0.0)
VectorSourceGradientColor(RGBA( 0, 0, 255, 255), 1.0)
AddPathCircle(radius, radius, radius)
FillPath()
VectorSourceColor($FFA09090)
AddPathCircle(radius, radius, radius - radius / 8)
FillPath()
;triangle
Vector3dButton_Triangle()
StopVectorDrawing()
EndIf
EndProcedure
Procedure Create_WinMain()
If OpenWindow(#Win_Main, 300, 200, 500, 180, "transp. round 3D-VectorLib-Button-Background", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CreateImage(#Img1Off, size, size, 32, #PB_Image_Transparent)
CreateImage(#Img1On, size, size, 32, #PB_Image_Transparent)
Vector3dButton_Yellow()
CreateImage(#Img2Off, size, size, 32, #PB_Image_Transparent)
CreateImage(#Img2On, size, size, 32, #PB_Image_Transparent)
Vector3dButton_BlueGray()
TextGadget(#Txt1, 5, 5, 490, 24, "Transp. ButtonImageGadget with 3D-Image from VectorLib")
ButtonImageGadget(#But1, 10, 30, size, size, ImageID(#Img1Off))
SetGadgetAttribute(#But1, #PB_Button_PressedImage, ImageID(#Img1On))
ButtonImageGadget(#But2, 200, 30, size, size, ImageID(#Img2Off))
SetGadgetAttribute(#But2, #PB_Button_PressedImage, ImageID(#Img2On))
;Linux? (activate the following lines) ...
;gtk_button_set_relief_(GadgetID(#But1), #GTK_RELIEF_NONE)
;gtk_button_set_relief_(GadgetID(#But2), #GTK_RELIEF_NONE)
EndIf
EndProcedure
Create_WinMain()
Repeat
gEvent= WaitWindowEvent()
Select gEvent
Case #PB_Event_CloseWindow
gQuit= #True
EndSelect
Until gQuit