Create your own icons for toolbars etc. with PureBasic

Share your advanced PureBasic knowledge/code with the community.
Little John
Addict
Addict
Posts: 4785
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Create your own icons for toolbars etc. with PureBasic

Post by Little John »

davido wrote:I have another four icons: Bug, Debug, Crop and ReSize2.
Hi davido,

thank you! I've added them to the collection.
Little John
Addict
Addict
Posts: 4785
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Create your own icons for toolbars etc. with PureBasic

Post by Little John »

Current changes:
  • Simplified the "format" of the icon procedures.
    For new contributions, please use one of the current procedures as template.
  • Added option to save the icons as SVG files (supported by PB only on Linux).
  • For people who don't have Linux, the ZIP archive now also contains a folder with all current icons in the form of SVG files.
  • some small changes
User avatar
[blendman]
Enthusiast
Enthusiast
Posts: 297
Joined: Thu Apr 07, 2011 1:14 pm
Location: 3 arks
Contact:

Re: Create your own icons for toolbars etc. with PureBasic

Post by [blendman] »

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

Some code examples :

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
Of course, to fit your template, you need to adapt the code you got, but it can be a good start to create your icon ;).
Little John
Addict
Addict
Posts: 4785
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Create your own icons for toolbars etc. with PureBasic

Post by Little John »

[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
Hi,

that's impressive and pretty cool. :-)
Oma
Enthusiast
Enthusiast
Posts: 312
Joined: Thu Jun 26, 2014 9:17 am
Location: Germany

Re: Create your own icons for toolbars etc. with PureBasic

Post by Oma »

Hi there!
I hope you all feel fine.

@[blendman] I've eyed your app since i discovered it. Before the next icons, i will certainly try it.

Here are some (first) improvements for a better contrast with 16 pixel icons and a bunch of new icons.
Change the colors if you don't like them.

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).

The moded icons ...
- ToClipboard
- FromClipboard
- NewDocument

The new icons ...
- CloseDocument
- EditDocument
- ClearDocument
- ImportDocument
- ExportDocument
- SortAscending
- SortDescending
- SortBlockAsc
- SortBlockDesc
- ChartLine
- ChartDot
- ChartBarVert
- ChartCylVert
- ChartPie

The Chart...-icons are also possible with colored backgrounds - if you'd prefer - by using every last color parameter.

I hope this posting-assembly doesn't have too much errors.

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)
Best Regards, Charly
PureBasic 5.4-5.7, Linux: (X/L/K)Ubuntus+Mint - Windows XP (32Bit)
PureBasic Linux-API-Library & Viewer: http://www.chabba.de
Little John
Addict
Addict
Posts: 4785
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Create your own icons for toolbars etc. with PureBasic

Post by Little John »

Hi Charly,

that's really great stuff. Thank you so much.
Personally, I'm especially impressed by your "Chart" icons. I wasn't aware that it's possible to put so much information in say 16x16 or 32x32 pixels. :-)
Your icons are also good examples for learning more about PB's VectorDrawing library.
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).
That's pretty fine, thank you!
Since that is a utility function which is of general use (not "only" for the icons here), I put it into the "VDraw" utility module.

I only encountered two problems:
  1. One of your icons again disclosed a bug in the VectorDrawing lib on Windows :-)
    see http://www.purebasic.fr/english/viewtop ... =4&t=65540
    I fixed the bug only for that particular icon ("ChartPie").
  2. There is still another small problem with the ChartPie icon. Both parts at the bottom are colored magenta when the icon is shown in "disabled" state, i.e. when only some shades of grey are used as colors (on Windows and Linux). I don't know the reason why.
Best regards, LJ
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: Create your own icons for toolbars etc. with PureBasic

Post by davido »

@oma,
An excellent set of icons.
I was rather surprised to see cylinder bar chart. I didn't think it would be possible to discern such a subtle difference. Brilliant!

I have an icon that needs a pencil, could I plagiarize yours or better still could it be made into a macro?
DE AA EB
Oma
Enthusiast
Enthusiast
Posts: 312
Joined: Thu Jun 26, 2014 9:17 am
Location: Germany

Re: Create your own icons for toolbars etc. with PureBasic

Post by Oma »

Thanks for the compliments - but i'm still a real vector-rookie :| and
i'm sure that some of my icons could be coded more effective.
One of your icons again disclosed a bug in the VectorDrawing lib
And once again i didn't expect this. Sorry and thanks.

I have a little (or more) dyschromatopsia so please excuse my magenta(™)-bug.
With a bigger desktop zoom i can see the problem too :wink: .
The previous macro, now function: Color_Darken(Color.i, Fact.d) made problems since i tried it.

Code: Select all

Color & $ff000000 + (Color & $ff0000) * 0.8 + (Color & $ff00) * 0.8 + (Color & $ff) * 0.8
delivered an error:
Can't use any of the following operands with floats: <<, >>, &, |, !, %
The same with lines like

Code: Select all

ColorRet+ Int((Color & $ff0000) * Fact)
And the last algo seems to have value-dependent problems too! :?:

Now i tried the old-school way and it seems to work here on 32- and 64-Bit.

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
Be aware that a constant factor on all 3 colors (rgb) delivers a correct darker shade of gray, but (as mk-soft stated in the german forum) may not observe the weightings of the single colors (0.3, 0.59, 0.11)
For this purpose it seems to be good enough, but improvements are welcome.

@davido
First of all, thank you!
I have an icon that needs a pencil, could I plagiarize yours or better still could it be made into a macro?
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.
With the use of gradient, the icon-design could be improved a lot i think, but it costs a lot of time. But there's really no deadline ... :wink:

Best regards, Charly
PureBasic 5.4-5.7, Linux: (X/L/K)Ubuntus+Mint - Windows XP (32Bit)
PureBasic Linux-API-Library & Viewer: http://www.chabba.de
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: Create your own icons for toolbars etc. with PureBasic

Post by davido »

Hi Little John,

I would like to add another Icon: rating

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)
@oma,
Than you for the information regarding the 3-d bar chart. I'm used to thanking RASHAD, who is a prolific poster of useful code. :D
DE AA EB
Little John
Addict
Addict
Posts: 4785
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Create your own icons for toolbars etc. with PureBasic

Post by Little John »

Hi davido!
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?
I have transmogrified oma's code into a macro. I think he doesn't mind. :-)
And thanks for your new "Rating" icon!

Hi oma,
the changed procedure Color_Darken() works fine here, too. Thank you!
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: Create your own icons for toolbars etc. with PureBasic

Post by davido »

Hi Little John,
:)
DE AA EB
Oma
Enthusiast
Enthusiast
Posts: 312
Joined: Thu Jun 26, 2014 9:17 am
Location: Germany

Re: Create your own icons for toolbars etc. with PureBasic

Post by Oma »

Hi folks.
Oh man, increasingly i think i need my big brain lifting. :|
Of course you can do the Color_Darken() this way - it was built in for this purposes in PB... :oops:

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
And if this fails too, i can accuse Fred :wink:

@ Hi John,
i think it's time to update to your last collection.

Excuse me, davido!
I did misunderstand your last statement and question. I thought that the CylinderBars are meant and you wanna use it for a pencil.
Of course, you all can use what you want and/or improve my icons for the collection or private needs.

I must confess that I still haven't understood the macros properly.
Therefore, thanks to John that he converted it to a macro.
I.e. i have no idea why the Protected Vars works within RefreshArrow() without Parameters.

Best Regards, Charly
PureBasic 5.4-5.7, Linux: (X/L/K)Ubuntus+Mint - Windows XP (32Bit)
PureBasic Linux-API-Library & Viewer: http://www.chabba.de
Little John
Addict
Addict
Posts: 4785
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Create your own icons for toolbars etc. with PureBasic

Post by Little John »

Hi Charly,

thanks for the new Color_Darken() function. I'll test it on Windows, and if it works as expected I'll replace the current version with this one.
By the way, I also know this effect: Sometimes one does not see the wood for the trees. :-)
Oma wrote:@ Hi John,
i think it's time to update to your last collection.
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:I.e. i have no idea why the Protected Vars works within RefreshArrow() without Parameters.
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 code

Code: Select all

EnableExplicit

Macro Add()
   a + b
EndMacro

Procedure Foo()
   Protected.i a, b
   
   a = 3
   b = 5
   Debug Add()
EndProcedure   

Foo()
The macro definition contains protected variables, but the content of the macro is not checked where it is defined.
When PB is executing the code, first the macro will be "expanded", that means here: Search for any occurrence of "Add()", and replace it with "a + b".
Then we have this:

Code: Select all

EnableExplicit

Procedure Foo()
   Protected.i a, b
   
   a = 3
   b = 5
   Debug a + b
EndProcedure   

Foo()
Now, after expanding the macro, the code will be checked.
Et voilà, now there is valid code. :-)

However, such a macro is not generally usable, because it only works if the calling code contains variables named a and b.
So generally usable macros should have parameters, in this case

Code: Select all

Macro Add (_a_, _b_)
   _a_ + _b_   
EndMacro
Please note that I always use macro parameters that begin and end with an underscore -- and I never use variable names that begin and end with an underscore. So both cannot be confused.
davido
Addict
Addict
Posts: 1890
Joined: Fri Nov 09, 2012 11:04 pm
Location: Uttoxeter, UK

Re: Create your own icons for toolbars etc. with PureBasic

Post by davido »

Hi Little John,
I would like to add 3 more icons: OrangeFruit, LemonFruit and LimeFruit.
Since these are really the same except for the colour. I have used a Macro: DrawCitrusFruit. I hope it meets your standard.
Note the Macro does not have _x_, _y_ coordinates as I do not expect multiple slices to be used.
I intend to do half slices that will be better suited to be used in multiples.

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)
Thank you for the Pen/Pencil macro. I'll be using that, soon.

Hi oma,
Thank you.
I think the misunderstanding is due to me as I should have been more considerate in the way I presented my request.
DE AA EB
Oma
Enthusiast
Enthusiast
Posts: 312
Joined: Thu Jun 26, 2014 9:17 am
Location: Germany

Re: Create your own icons for toolbars etc. with PureBasic

Post by Oma »

Hi John!
Thank you very much that you take the time for this patience and detailed explanation.
The hitch is, to get rid of the procedural- and "functional"-thinking.
And your effort helps a lot - especially to remember the "Search and Replace" property of macros.
The rest, i think, is a permanent use of them. If i once see the real benefit (as in the example below) i get the handling even out yet - vice versa :wink: .

I'm sorry that my unexplained comment has brought you so much to brood.
It only should mean, i only updated the icon format the last weeks, but i'm working with an older, small icon set. It is about time to bring the collection up to date - (and try [blendman]s cartoon).

Hello davido!
I think the misunderstanding is due to me...
No, no!
I know, when it's time to shutdown the computer, i tend to "glance through" textes rather than reading them.


And now something offtopic:
How about transparent 3D-Button-Backgrounds?
- Only tested on Linux.
- I don't know an OS-independant way how to get rid of the Buttonframe.
- I don't know a way how to get rid of the toggled and touched Button-frame in Linux.
- There still are hardcoded parts.
Maybe you like it, improve it and even find a way to use it in the Icon-Library.

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
Best Regards, Charly

ps:
updated 23.04.2016 - 06:10 + 7:15
Last edited by Oma on Sat Apr 23, 2016 6:22 am, edited 4 times in total.
PureBasic 5.4-5.7, Linux: (X/L/K)Ubuntus+Mint - Windows XP (32Bit)
PureBasic Linux-API-Library & Viewer: http://www.chabba.de
Post Reply