Page 1 of 1

DrawAddBorder

Posted: Mon Oct 02, 2017 10:30 am
by gurj
this:

Code: Select all

;DrawAddBorder http://ataorj.ys168.com
If OpenWindow(0, 0, 0, 900, 200, "DrawAddBorder", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
 CanvasGadget(0, 0, 0, 900, 200)
 ;LoadFont(0, "Tahoma", 6,#PB_Font_Bold);经典细圆简Webdings,Wingdings,Symbol
 LoadFont(0, "Webdings", 0,#PB_Font_Bold)
 ;CreateImage(0, 400, 200,32,$ffffffff)
 If StartVectorDrawing(CanvasVectorOutput(0));Image
  
  VectorFont(FontID(0), 55)
  VectorSourceColor(RGBA(220, 50, 50, 250))
  Text$ = "The quick 框是左键按下 jumped over the lazy doc"
  
  For x = 55 To 59:For y= 55 To 59
    MovePathCursor(x,y)
    DrawVectorText(Text$)
   Next:Next
  VectorSourceColor(RGBA(0, 0, 0, 255))
  MovePathCursor(57,57)
  DrawVectorText(Text$)
  StopVectorDrawing()
  ;ImageGadget(2, 0, 0, 900, 200,ImageID(0))
 EndIf
 
 Repeat
  Event = WaitWindowEvent()
 Until Event = #PB_Event_CloseWindow
EndIf

Re: DrawAddBorder

Posted: Tue Oct 03, 2017 3:40 pm
by gurj
code2:

Code: Select all

;DrawAddBorder http://ataorj.ys168.com
;http://www.purebasic.fr/english/viewtopic.php?f=12&t=69308
If OpenWindow(0, 0, 0, 900, 200, "DrawAddBorder", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
 
 ;LoadFont(0, "Webdings", 55,#PB_Font_Bold)
 LoadFont(0, "Tahoma", 55,#PB_Font_Bold)
 CreateImage(0, 900, 200,32,$ffffffff)
 If StartVectorDrawing(ImageVectorOutput(0))
  
  VectorFont(FontID(0), 55)
  VectorSourceColor(RGBA(255, 0, 0, 255))
  Text$ = "The quick 框是左键按下 jumped over the lazy doc"
  
   MovePathCursor(55,55)
   DrawVectorText(Text$)
  For x= 1 To 2
   MovePathCursor(x,0)
   DrawVectorImage(ImageID(0), 255)
  Next
     MovePathCursor(59,55)
   DrawVectorText(Text$)

  For y= 1 To 2
   MovePathCursor(0,y)
   DrawVectorImage(ImageID(0), 255)
  Next
       MovePathCursor(0,1)
   DrawVectorImage(ImageID(0), 255)

  VectorSourceColor(RGBA(0, 0, 0, 255))
  MovePathCursor(57,57)
  DrawVectorText(Text$)
  StopVectorDrawing()
  ImageGadget(2, 0, 0, 900, 200,ImageID(0))
 EndIf
 
 Repeat
  Event = WaitWindowEvent()
 Until Event = #PB_Event_CloseWindow
EndIf
and
code3:

Code: Select all

;DrawAddBorder http://ataorj.ys168.com
;http://www.purebasic.fr/english/viewtopic.php?f=12&t=69308
If OpenWindow(0, 0, 0, 900, 200, "DrawAddBorder", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
 
 ;LoadFont(0, "Webdings", 55,#PB_Font_Bold)
 LoadFont(0, "Tahoma", 55,#PB_Font_Bold)
 CreateImage(0, 900, 200,32,$ffffffff)
 If StartVectorDrawing(ImageVectorOutput(0))
  
  VectorFont(FontID(0), 55)
  VectorSourceColor(RGBA(0, 0, 0, 255))
  Text$ = "The quick 框是左键按下 jumped over the lazy doc"
  
   MovePathCursor(55,55)
   DrawVectorText(Text$)
  For x= 1 To 2
   MovePathCursor(x,0)
   DrawVectorImage(ImageID(0), 255)
  Next
     MovePathCursor(59,55)
   DrawVectorText(Text$)

  For y= 1 To 2
   MovePathCursor(0,y)
   DrawVectorImage(ImageID(0), 255)
  Next
       MovePathCursor(0,1)
   DrawVectorImage(ImageID(0), 255)

  VectorSourceColor(RGBA(255, 0, 0, 255))
  MovePathCursor(57,57)
  DrawVectorText(Text$)
  StopVectorDrawing()
  ImageGadget(2, 0, 0, 900, 200,ImageID(0))
 EndIf
 
 Repeat
  Event = WaitWindowEvent()
 Until Event = #PB_Event_CloseWindow
EndIf

Re: DrawAddBorder

Posted: Tue Oct 03, 2017 5:41 pm
by walbus
Looking nice, good idea

Re: DrawAddBorder

Posted: Wed Oct 04, 2017 1:16 am
by gurj
hi,@Albus:
code1,2,3 all need more clock time,
and code2 color will is not mere, on my x86 winxp

now, i use code4, although border likely has void, but need lesser clock time.
code4 from code1
code4:

Code: Select all

;DrawAddBorder http://ataorj.ys168.com
;http://www.purebasic.fr/english/viewtopic.php?f=12&t=69308
If OpenWindow(0, 0, 0, 900, 200, "DrawAddBorder", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
 CanvasGadget(0, 0, 0, 900, 200)
 LoadFont(0, "Tahoma", 6,#PB_Font_Bold)
 ;LoadFont(0, "Webdings", 0,#PB_Font_Bold)
 ;CreateImage(0, 400, 200,32,$ffffffff)
 If StartVectorDrawing(CanvasVectorOutput(0));Image
  ResetPath()
  VectorSourceColor($ff000000)
  AddPathBox(0, 0, 900, 200)
  FillPath()
  
  VectorFont(FontID(0), 55)
  VectorSourceColor(RGBA(220, 220, 220, 255))
  Text$ = "The quick 框是左键按下 jumped over the lazy doc"
  
  For x = 55 To 59 Step 2:For y= 55 To 59 Step 2
    If x<>57 Or y<>57
     MovePathCursor(x,y)
    DrawVectorText(Text$):EndIf
  Next:Next
  VectorSourceColor(RGBA(0, 0, 0, 255))
  MovePathCursor(57,57)
  DrawVectorText(Text$)
  StopVectorDrawing()
  ;ImageGadget(2, 0, 0, 900, 200,ImageID(0))
 EndIf
 
 Repeat
  Event = WaitWindowEvent()
 Until Event = #PB_Event_CloseWindow
EndIf

Re: DrawAddBorder

Posted: Wed Oct 04, 2017 10:14 am
by gurj
use CustomDashPath() for border

Code: Select all

;use CustomDashPath() for border
If OpenWindow(0, 0, 0, 400, 200, "VectorDrawing", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
 CanvasGadget(0, 0, 0, 400, 200)
 LoadFont(0, "Times New Roman", 20, #PB_Font_Bold)
 
 If StartVectorDrawing(CanvasVectorOutput(0))
  VectorFont(FontID(0), 150)
  
  MovePathCursor(50, 25)
  AddPathText("Text")
  
  VectorSourceColor(RGBA(255, 0, 0, 255))
  DashPath(9999, 1)
  MovePathCursor(50, 25)
  AddPathText("Text")
  
  VectorSourceColor(RGBA(255,250, 0, 255))
  Dim dashes.d(1)
  dashes(0) = 99999
  dashes(1) = 0
  CustomDashPath(5, dashes())
  
  VectorSourceColor(RGBA(0, 0, 0, 255))
  MovePathCursor(50, 25)
  AddPathText("Text")
  FillPath()
  
  StopVectorDrawing()
 EndIf
 
 Repeat
  Event = WaitWindowEvent()
 Until Event = #PB_Event_CloseWindow
EndIf


Re: DrawAddBorder

Posted: Wed Oct 04, 2017 6:00 pm
by VB6_to_PBx
gurj ,

Thank you very much for this Code !

Re: DrawAddBorder

Posted: Wed Oct 04, 2017 6:19 pm
by walbus
Try this, it looks very cool !

Code: Select all

XIncludeFile("./BucketFill_advanced.pbi") ; Download : "http://www.nachtoptik.de/ablage/BucketFill_advanced.zip"

;use CustomDashPath() for border
If OpenWindow(0, 0, 0, 400, 200, "VectorDrawing", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
 CanvasGadget(0, 0, 0, 400, 200)
 LoadFont(0, "Times New Roman", 20, #PB_Font_Bold)
 
 If StartVectorDrawing(CanvasVectorOutput(0))
  VectorFont(FontID(0), 150)
  
  MovePathCursor(50, 25)
  AddPathText("Text")
  
  VectorSourceColor($FF|$FF000000)
  DashPath(1e3, 1)
  MovePathCursor(50, 25)
  AddPathText("Text")
  
  VectorSourceColor($FFFF|$FF000000)
  Dim dashes.d(1)
  dashes(0) = 1e3
  CustomDashPath(5, dashes())
  
  VectorSourceColor($FF000000)
  MovePathCursor(50, 25)
  AddPathText("Text")
  FillPath()
  
  StopVectorDrawing()
EndIf

UseJPEGImageDecoder() : UsePNGImageDecoder()
texture_1_ID=LoadImage(#PB_Any, #PB_Compiler_Home+"Examples\3D\Data\Textures\RustySteel.jpg")
texture_2_ID=LoadImage(#PB_Any, #PB_Compiler_Home+"Examples\3D\Data\Textures\terrain.png")
texture_3_ID=LoadImage(#PB_Any, #PB_Compiler_Home+"Examples\3D\Data\Textures\terrain_detail.jpg")
SetColor_BF(#Black) : ErrorCheck_BF(BF(-2, 0, texture_1_ID, -1, -1))
SetColor_BF(#Red) : ErrorCheck_BF(BF(-2, 0, texture_2_ID, -1, -1))
SetColorDistanceFill_BF(30) : SetColor_BF(#Yellow) : ErrorCheck_BF(BF(-2, 0, texture_3_ID, -1, -1))

Repeat
  Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf

Re: DrawAddBorder

Posted: Thu Oct 05, 2017 2:03 am
by gurj
thanks!

Re: DrawAddBorder

Posted: Fri Oct 06, 2017 10:57 am
by RSBasic
@gurj
Very nice, thanks for sharing. Image

Re: DrawAddBorder

Posted: Wed Oct 11, 2017 1:31 am
by gurj
here, best way is use StrokePath(5) To replace CustomDashPath(5, dashes())