Discussion forum about PANORAMIC language

Mac, Windows & Android application development with PANORAMIC language
 
HomeFAQSearchRegisterMemberlistUsergroupsLog in
Latest topics
» Hello world.
by Mon Jun 19, 2017 1:37 am

» Biomorphes de PICKOVER
by Sun Jun 18, 2017 2:33 am

» In less than 10 lines of code
by Fri Jun 16, 2017 5:03 am

» Effect Dopler
by Fri Jun 16, 2017 3:29 am

» SuperEllipse
by Wed Jun 14, 2017 4:01 am

» Plants
by Wed Jun 14, 2017 3:38 am

» Mira's attractor
by Wed Jun 14, 2017 3:30 am

» Triangle of Sierpinski
by Wed Jun 14, 2017 3:22 am

» Esthétique polaire
by Wed Jun 14, 2017 3:16 am

» Butterfly effect : Lorenz equations
by Wed Jun 14, 2017 3:08 am

» Collision detection
by Tue Jun 13, 2017 5:09 am

» The Bees Laline Paull Epub Books
by Mon Oct 10, 2016 8:58 pm

» PANORAMIC for Mac OSX 10 is available
by Tue Aug 09, 2016 6:08 pm

» ide
by Sat Jul 16, 2016 12:27 am

» Can I change the program icon/logo in my application ?
by Thu Jul 07, 2016 3:32 am

Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Share | 
 

 Panoramic Draw

View previous topic View next topic Go down 
AuthorMessage
lodchjo



Number of posts : 10
Registration date : 2012-01-30

PostSubject: Panoramic Draw   Mon Jan 30, 2012 4:41 pm

Hi!

For a long time already I have been playing with the idea of making a drawing program that doesn't work with pixels, but with instructions. Now i finally made one with the Panoramic programming language.

The most interesting about it is, that the program generates all the codes you need to use the drawing in your own programs. Even better: you can save the result as a bas-file, open it with panoramic and run it immediately, without any modifications!

- Left-click on the canvas to read the X1/Y1-coordinates.
- Right-click on the canvas to read the X2/Y2-coordinates.
- Beware that the grid is not very compatible with the flood-instruction.

Here's the code, i hope you like it!

Lode

Code:


label pen, fill, tpen, tfill, tst, wis, pw, pos, grd, pnst, abt, ld, sv, err
dim x, y, a$, xpos, ypos, ctr, pn$, kl$, fl$, pns, fs$, i$(10)
on_error_goto err
data "2d_circle", "2d_flood", "2d_line", "2d_point", "2d_rectangle"
data "2d_pen_dash", "2d_pen_dash_dot", "2d_pen_dash_dot_dot", "2d_pen_dot", "2d_pen_solid"
caption 0,"Panoramic Draw"
width 0,240
height 0,500
color 0, 255,255,255
main_menu 50
sub_menu 51:parent 51,50:caption 51,"Load":on_click 51,ld
sub_menu 52:parent 52,50:caption 52,"Save":on_click 52,sv
sub_menu 53:parent 53,50:caption 53,"Grid":on_click 53,grd
sub_menu 54:parent 54,50:caption 54,"Clear":on_click 54,wis
sub_menu 55:parent 55,50:caption 55,"Help":on_click 55,abt
open_dialog 60
save_dialog 61
form 1:color 1,255,255,255
left 1,240:height 1,500:width 1,500
combo 2
top 2,5:left 2,5:width 2,120:height 2,25
for x = 1 to 5
 read a$
 item_add 2, a$
next x
alpha 3
left 3,3:top 3,33:width 3,10:caption 3,"X1"
edit 4
left 4,20:top 4,30:width 4,30
alpha 5
left 5,55:top 5,33:width 5,10:caption 5,"Y1"
edit 6
left 6,75:top 6,30:width 6,30
alpha 7
left 7,125:top 7,33:width 7,10:caption 7,"X2"
edit 8
left 8,145:top 8,30:width 8,30
alpha 9
left 9,180:top 9,33:width 9,10:caption 9,"Y2"
edit 10
left 10,200:top 10,30:width 10,30
alpha 11
left 11,140:top 11,8:width 11,30:caption 11,"Radius: "
edit 12
left 12,180:top 12,5:width 12,50
container 13
left 13,3:top 13,60:width 13,225:height 13,95
alpha 14:parent 14,13:font_bold 14
left 14,10:top 14,1:width 14,10:caption 14,"  Pen color  "
alpha 15:parent 15,13
left 15,5:top 15,20:width 15,20:caption 15,"Red"
scroll_bar 16:parent 16,13:min 16,0:max 16,255:position 16,0:on_change 16,pen
left 16,40:top 16,20:width 16,145
edit 17:parent 17,13:text 17,"0": on_change 17,tpen
left 17,190:top 17,18:width 17,30
alpha 18:parent 18,13
left 18,5:top 18,45:width 18,20:caption 18,"Green"
scroll_bar 19:parent 19,13:min 19,0:max 19,255:position 19,0:on_change 19,pen
left 19,40:top 19,45:width 19,145
edit 20:parent 20,13:text 20,"0":on_change 20,tpen
left 20,190:top 20,43:width 20,30
alpha 21:parent 21,13
left 21,5:top 21,70:width 21,20:caption 21,"Blue"
scroll_bar 22:parent 22,13:min 22,0:max 22,255:position 22,0:on_change 22,pen
left 22,40:top 22,70:width 22,145
edit 23:parent 23,13:text 23,"0":on_change 23,tpen
left 23,190:top 23,68:width 23,30
alpha 24
left 24,3:top 24,163:width 24,50:caption 24,"PenWidth:"
edit 25:text 25,"1":on_change 25,pw
left 25,55:top 25,160:width 25,30
alpha 26
left 26,87:top 26,163:width 26,25:caption 26,"Style:"
combo 27:on_change 27,pnst
left 27,115:top 27,160:width 27,115
for x = 1 to 5
 read a$
 item_add 27, a$
next x
container 28
left 28,3:top 28,185:width 28,225:height 28,95
alpha 29:parent 29,28:font_bold 29
left 29,10:top 29,1:width 29,10:caption 29,"  Fill color  "
alpha 30:parent 30,28
left 30,5:top 30,20:width 30,20:caption 30,"Red"
scroll_bar 31:parent 31,28:min 31,0:max 31,255:position 31,255:on_change 31,fill
left 31,40:top 31,20:width 31,145
edit 32:parent 32,28:text 32,"255":on_change 32,tfill
left 32,190:top 32,18:width 32,30
alpha 33:parent 33,28
left 33,5:top 33,45:width 33,20:caption 33,"Green"
scroll_bar 34:parent 34,28:min 34,0:max 34,255:position 34,255:on_change 34,fill
left 34,40:top 34,45:width 34,145
edit 35:parent 35,28:text 35,"255":on_change 35,tfill
left 35,190:top 35,43:width 35,30
alpha 36:parent 36,28
left 36,5:top 36,70:width 36,20:caption 36,"Blue"
scroll_bar 37:parent 37,28:min 37,0:max 37,255:position 37,255:on_change 37,fill
left 37,40:top 37,70:width 37,145
edit 38:parent 38,28:text 38,"255":on_change 38,tfill
left 38,190:top 38,65:width 38,30
button 39:caption 39,"Draw!":on_click 39,tst
left 39,3:top 39,282:width 39,225
memo 41
left 41,3:top 41,310:width 41,225:height 41,133
timer 42:timer_interval 42,10:timer_on 42:on_timer 42,pos
end

pen:
 text 17, str$(position (16))
 text 20, str$(position (19))
 text 23, str$(position (22))
 font_color 14,position (16), position (19), position (22)
return

tpen:
 position 16, val(text$(17))
 position 19, val(text$(20))
 position 22, val(text$(23))
 font_color 14,position (16), position (19), position (22)
return

fill:
 text 32, str$(position (31))
 text 35, str$(position (34))
 text 38, str$(position (37))
 color 29,position (31), position (34), position (37)
return

tfill:
 position 31, val(text$(32))
 position 34, val(text$(35))
 position 37, val(text$(38))
 color 29,position (31), position (34), position (37)
return

rem err:
rem return

wis:
pns=0
pn$=""
kl$=""
fl$=""
2d_target_is 1
2d_pen_color 255,255,255
2d_fill_color 255,255,255
2d_rectangle 0,0,width(1),height(1)
for x=0 to count(41)
 item_delete 41,1
next x
return

grd:
2d_target_is 1
2d_pen_color 240,240,240
for x=0 to height(1) step 10
 2d_line 0,x,width(1),x
next x
for x=0 to width(1) step 10
 2d_line x,0,x,height(1)
next x
return

pos:
caption 1, "CANVAS - x: "+str$(mouse_x_position(1))+" y: "+str$(mouse_y_position(1))
if mouse_right_up(1)=1
  text 8, str$(mouse_x_right_down(1))
  text 10, str$(mouse_y_right_down(1))
end_if
if mouse_left_up (1)=1
  text 4, str$(mouse_x_left_down(1))
  text 6, str$(mouse_y_left_down(1))
end_if
return

pw:
 if val(text$(25))>20 then text 25, 20
return

tst:
gosub pnst
2d_target_is 1
 if text$(25)<>"" then 2d_pen_width val(text$(25))
 2d_pen_color val(text$(17)),val(text$(20)),val(text$(23))
 2d_fill_color val(text$(32)),val(text$(35)),val(text$(38))
 if pn$<>text$(25) then pn$=text$(25):item_add 41, "2d_pen_width "+pn$
 if pns<>item_index(27) then item_add 41, item_index$(27)
 if kl$<>text$(17)+","+text$(20)+","+text$(23) then kl$=text$(17)+","+text$(20)+","+text$(23):item_add 41, "2d_pen_color "+kl$
 if fl$<>text$(32)+","+text$(35)+","+text$(38) then fl$=text$(32)+","+text$(35)+","+text$(38):item_add 41, "2d_fill_color "+fl$
 x=item_index(2)
select x
case 1
 2d_circle val(text$(4)),val(text$(6)),val(text$(12))
 item_add 41, "2d_circle "+text$(4)+","+text$(6)+","+text$(12)
case 2
 2d_flood val(text$(4)),val(text$(6)),val(text$(32)),val(text$(35)),val(text$(38))
 item_add 41, "2d_flood "+text$(4)+","+text$(6)+","+text$(32)+","+text$(35)+","+text$(38)
case 3
 2d_line val(text$(4)),val(text$(6)),val(text$(8)),val(text$(10))
 item_add 41, "2d_line "+text$(4)+","+text$(6)+","+text$(8)+","+text$(10)
case 4
 2d_point val(text$(4)),val(text$(6))
 item_add 41, "2d_point "+text$(4)+","+text$(6)
case 5
 2d_rectangle val(text$(4)),val(text$(6)),val(text$(8)),val(text$(10))
 item_add 41, "2d_rectangle "+text$(4)+","+text$(6)+","+text$(8)+","+text$(10)
end_select
return

pnst:
x=item_index(27)
select x
case 1
 2d_pen_dash
case 2
 2d_pen_dash_dot
case 3
 2d_pen_dash_dot_dot
case 4
 2d_pen_dot
case 5
 2d_pen_solid
end_select
return

abt:
 message "Panoramic Draw. Programmed by Lode Van de Velde."+chr$(13)+chr$(13)+"- Left-click on canvas selects X1/Y1-coordinates. "+chr$(13)+"- Right-click on canvas selects X2/Y2-coordinates."+chr$(13)+"- Mind that 'flood' does not work well with the grid turned on!"
return

err:
return

ld:
timer_off 42
 gosub wis
 fs$ = File_Name$(60)
 file_load 41,fs$
 for x=1 to count(41)
  a$=ltrim$(rtrim$(item_read$(41,x)))+",0,0,0,0,0,0,0,0"
  if instr(a$," ")<>0 then i$(1)=left$(a$,instr(a$," ")-1):a$=right$(a$,len(a$)-instr(a$," "))
  if instr(a$,",")<>0 then i$(2)=left$(a$,instr(a$,",")-1):a$=right$(a$,len(a$)-instr(a$,","))
  if instr(a$,",")<>0 then i$(3)=left$(a$,instr(a$,",")-1):a$=right$(a$,len(a$)-instr(a$,","))
  if instr(a$,",")<>0 then i$(4)=left$(a$,instr(a$,",")-1):a$=right$(a$,len(a$)-instr(a$,","))
  if instr(a$,",")<>0 then i$(5)=left$(a$,instr(a$,",")-1):a$=right$(a$,len(a$)-instr(a$,","))
  if instr(a$,",")<>0 then i$(6)=left$(a$,instr(a$,",")-1)
  if item_read$(41,x)="2d_pen_dash" then 2d_pen_dash
  if item_read$(41,x)="2d_pen_dash_dot" then 2d_pen_dash_dot
  if item_read$(41,x)="2d_pen_dash_dot_dot" then 2d_pen_dash_dot_dot
  if item_read$(41,x)="2d_pen_dot" then 2d_pen_dot
  if item_read$(41,x)="2d_pen_solid" then 2d_pen_solid
  if i$(1)="2d_pen_width" then 2d_pen_width val(i$(2))
  if i$(1)="2d_pen_color" then 2d_pen_color val(i$(2)),val(i$(3)),val(i$(4))
  if i$(1)="2d_fill_color" then 2d_fill_color val(i$(2)),val(i$(3)),val(i$(4))
  if i$(1)="2d_circle" then 2d_circle val(i$(2)),val(i$(3)),val(i$(4))
  if i$(1)="2d_point" then 2d_point val(i$(2)),val(i$(3))
  if i$(1)="2d_rectangle" then 2d_rectangle val(i$(2)),val(i$(3)),val(i$(4)),val(i$(5))
  if i$(1)="2d_line" then 2d_line val(i$(2)),val(i$(3)),val(i$(4)),val(i$(5))
  if i$(1)="2d_flood" then 2d_flood val(i$(2)),val(i$(3)),val(i$(4)),val(i$(5)),val(i$(6))
  for y=1 to 6
  i$(y)=""
  next y
 next x
 timer_on 42
return

sv:
 fs$ = File_Name$(61)
 file_save 41, fs$
return
Back to top Go down
View user profile
lodchjo



Number of posts : 10
Registration date : 2012-01-30

PostSubject: Re: Panoramic Draw   Sat Feb 25, 2012 11:35 am

And here's the second version! The update features:
- html colour picker
- 2d_fill styles added (cross, diagonal, etc.)
- canvas can be moved and/or resized, auxiliary windows follow
- canvas and colour picker not to be accidentally closed

Code:

label pen, fill, tpen, tfill, tst, wis, pw, pos, grd, pnst, abt, ld, sv, flst, err
dim x, y, a$, xpos, ypos, ctr, pn$, kl$, fl$, pns, fs$, i$(10), fls
on_error_goto err
data "2d_circle", "2d_flood", "2d_line", "2d_point", "2d_rectangle"
data "2d_pen_dash", "2d_pen_dash_dot", "2d_pen_dash_dot_dot", "2d_pen_dot", "2d_pen_solid"
data "2d_fill_cross", "2d_fill_diagonal_cross", "2d_fill_diagonal_down", "2d_fill_diagonal_up", "2d_fill_horizontal", "2d_fill_solid", "2d_fill_vertical"
caption 0,"Panoramic Draw":border_small 0
width 0,240
height 0,600
color 0, 255,255,255
main_menu 50
sub_menu 51:parent 51,50:caption 51,"Load":on_click 51,ld
sub_menu 52:parent 52,50:caption 52,"Save":on_click 52,sv
sub_menu 53:parent 53,50:caption 53,"Grid":on_click 53,grd
sub_menu 54:parent 54,50:caption 54,"Clear":on_click 54,wis
sub_menu 55:parent 55,50:caption 55,"Help":on_click 55,abt
open_dialog 60
save_dialog 61
form 1:color 1,255,255,255:border_small 1
left 1,240:height 1,600:width 1,500
combo 2
top 2,5:left 2,5:width 2,120:height 2,25
for x = 1 to 5
 read a$
 item_add 2, a$
next x
alpha 3
left 3,3:top 3,33:width 3,10:caption 3,"X1"
edit 4
left 4,20:top 4,30:width 4,30
alpha 5
left 5,55:top 5,33:width 5,10:caption 5,"Y1"
edit 6
left 6,75:top 6,30:width 6,30
alpha 7
left 7,125:top 7,33:width 7,10:caption 7,"X2"
edit 8
left 8,145:top 8,30:width 8,30
alpha 9
left 9,180:top 9,33:width 9,10:caption 9,"Y2"
edit 10
left 10,200:top 10,30:width 10,30
alpha 11
left 11,140:top 11,8:width 11,30:caption 11,"Radius: "
edit 12
left 12,180:top 12,5:width 12,50
container 13
left 13,3:top 13,60:width 13,225:height 13,95
alpha 14:parent 14,13:font_bold 14
left 14,10:top 14,1:width 14,10:caption 14,"  Pen color  "
alpha 15:parent 15,13
left 15,5:top 15,20:width 15,20:caption 15,"Red"
scroll_bar 16:parent 16,13:min 16,0:max 16,255:position 16,0:on_change 16,pen
left 16,40:top 16,20:width 16,145
edit 17:parent 17,13:text 17,"0": on_change 17,tpen
left 17,190:top 17,18:width 17,30
alpha 18:parent 18,13
left 18,5:top 18,45:width 18,20:caption 18,"Green"
scroll_bar 19:parent 19,13:min 19,0:max 19,255:position 19,0:on_change 19,pen
left 19,40:top 19,45:width 19,145
edit 20:parent 20,13:text 20,"0":on_change 20,tpen
left 20,190:top 20,43:width 20,30
alpha 21:parent 21,13
left 21,5:top 21,70:width 21,20:caption 21,"Blue"
scroll_bar 22:parent 22,13:min 22,0:max 22,255:position 22,0:on_change 22,pen
left 22,40:top 22,70:width 22,145
edit 23:parent 23,13:text 23,"0":on_change 23,tpen
left 23,190:top 23,68:width 23,30
alpha 24
left 24,3:top 24,163:width 24,50:caption 24,"PenWidth:"
edit 25:text 25,"1":on_change 25,pw
left 25,55:top 25,160:width 25,30
alpha 26
left 26,87:top 26,163:width 26,25:caption 26,"Style:"
combo 27:on_change 27,pnst
left 27,115:top 27,160:width 27,115
for x = 1 to 5
 read a$
 item_add 27, a$
next x
container 28
left 28,3:top 28,185:width 28,225:height 28,95
alpha 29:parent 29,28:font_bold 29
left 29,10:top 29,1:width 29,10:caption 29,"  Fill color  "
alpha 30:parent 30,28
left 30,5:top 30,20:width 30,20:caption 30,"Red"
scroll_bar 31:parent 31,28:min 31,0:max 31,255:position 31,255:on_change 31,fill
left 31,40:top 31,20:width 31,145
edit 32:parent 32,28:text 32,"255":on_change 32,tfill
left 32,190:top 32,18:width 32,30
alpha 33:parent 33,28
left 33,5:top 33,45:width 33,20:caption 33,"Green"
scroll_bar 34:parent 34,28:min 34,0:max 34,255:position 34,255:on_change 34,fill
left 34,40:top 34,45:width 34,145
edit 35:parent 35,28:text 35,"255":on_change 35,tfill
left 35,190:top 35,43:width 35,30
alpha 36:parent 36,28
left 36,5:top 36,70:width 36,20:caption 36,"Blue"
scroll_bar 37:parent 37,28:min 37,0:max 37,255:position 37,255:on_change 37,fill
left 37,40:top 37,70:width 37,145
edit 38:parent 38,28:text 38,"255":on_change 38,tfill
left 38,190:top 38,65:width 38,30
button 39:caption 39,"Draw!":on_click 39,tst
left 39,3:top 39,312:width 39,225
memo 41
left 41,3:top 41,340:width 41,225:height 41,200
timer 42:timer_interval 42,10:on_timer 42,pos:timer_off 42
alpha 43
left 43,3:top 43,290:width 43,50:caption 43,"Fill style:"
combo 44:on_change 44,flst
left 44,65:top 44,287:width 44,165
picture 45:parent 45,1
for x = 1 to 7
 read a$
 item_add 44, a$
next x
REM Outil couleur par
DIM wco%, hco%, wct%, hct%, ech%, ecv%, ra%, ga%, ba%, i%, j%, x%, y%
DIM colStr$,bTimer
wco% = 24: hco% = 12: ech% = 0: ecv% = 0
wct% = 6*(wco%+ech%)+10: hct% = 36*(hco%+ecv%)+10
FORM 300: BORDER_SMALL 300
WIDTH 300, wct%+16: HEIGHT 300, hct%+34
LEFT 300, width(1)+left(1):TOP 300, top(1)
PICTURE 301: PARENT 301, 300: WIDTH 301, wct%: HEIGHT 301,hct%
2D_TARGET_IS 301
ra% = 0: ga% = 0: ba% = 0
FOR j% = 0 TO 35
    y% = j%*(hco%+ecv%)
    FOR i% = 0 TO 5
        x% = i%*(wco%+ech%)
        2D_FILL_COLOR ra%,ga%,ba%
        2D_RECTANGLE x%+5,y%+5,x%+wco%+4,y%+hco%+4
        ba% = ba% + HEX("33")
        IF ba% > 255
            ba% = 0: ga% = ga% + HEX("33")
            IF ga% > 255
                ga% = 0: ra% = ra% + HEX("33")
            END_IF
        END_IF
    NEXT i%
NEXT j%
FORM 400:HIDE 400
 timer_on 42
 2d_target_is 45
END

pen:
 text 17, str$(position (16))
 text 20, str$(position (19))
 text 23, str$(position (22))
 font_color 14,position (16), position (19), position (22)
return

tpen:
 position 16, val(text$(17))
 position 19, val(text$(20))
 position 22, val(text$(23))
 font_color 14,position (16), position (19), position (22)
return

fill:
 text 32, str$(position (31))
 text 35, str$(position (34))
 text 38, str$(position (37))
 color 29,position (31), position (34), position (37)
return

tfill:
 position 31, val(text$(32))
 position 34, val(text$(35))
 position 37, val(text$(38))
 color 29,position (31), position (34), position (37)
return

wis:
 2d_clear
 clear 41
return

grd:
2d_target_is 45
2d_pen_color 240,240,240
for x=0 to height(1) step 10
 2d_line 0,x,width(1),x
next x
for x=0 to width(1) step 10
 2d_line x,0,x,height(1)
next x
return

pos:
show 1
LEFT 0, left(1)-width(0)
show 300:LEFT 300, width(1)+left(1):TOP 300, top(1)
TOP 0, top(1)
full_space 45
caption 1, "CANVAS SIZE: "+str$(width(1))+"x"+str$(height(1))+" - Mouse-position: x: "+str$(mouse_x_position(45))+" y: "+str$(mouse_y_position(45))
  x% = MOUSE_X_POSITION(301): y% = MOUSE_Y_POSITION(301)
  ra% = COLOR_PIXEL_RED(301,x%,y%)
  ga% = COLOR_PIXEL_GREEN(301,x%,y%)
  ba% = COLOR_PIXEL_BLUE(301,x%,y%)
caption 300, "#"+ right$("0"+hex$(ra%),2)+right$("0"+hex$(ga%),2)+right$("0"+hex$(ba%),2)
if MOUSE_LEFT_DOWN(301)=1 then font_color 14, ra%, ga%, ba%: text 17, str$(ra%):text 20, str$(ga%):text 23, str$(ba%)
if MOUSE_RIGHT_DOWN(301)=1 then color 29, ra%, ga%, ba%: text 32, str$(ra%):text 35, str$(ga%):text 38, str$(ba%)
if mouse_right_up(45)=1
  text 8, str$(mouse_x_right_down(45))
  text 10, str$(mouse_y_right_down(45))
end_if
if mouse_left_up (45)=1
  text 4, str$(mouse_x_left_down(45))
  text 6, str$(mouse_y_left_down(45))
end_if
return

pw:
 if val(text$(25))>20 then text 25, 20
return

tst:
2d_target_is 45
 if text$(25)<>"" then 2d_pen_width val(text$(25))
 2d_pen_color val(text$(17)),val(text$(20)),val(text$(23))
 2d_fill_color val(text$(32)),val(text$(35)),val(text$(38))
 if pn$<>text$(25) then pn$=text$(25):item_add 41, "2d_pen_width "+pn$
 if pns<>item_index(27) then item_add 41, item_index$(27):pns=item_index(27)
 if fls<>item_index(44) then item_add 41, item_index$(44):fls=item_index(44)
 if kl$<>text$(17)+","+text$(20)+","+text$(23) then kl$=text$(17)+","+text$(20)+","+text$(23):item_add 41, "2d_pen_color "+kl$
 if fl$<>text$(32)+","+text$(35)+","+text$(38) then fl$=text$(32)+","+text$(35)+","+text$(38):item_add 41, "2d_fill_color "+fl$
 x=item_index(2)
select x
case 1
 2d_circle val(text$(4)),val(text$(6)),val(text$(12))
 item_add 41, "2d_circle "+text$(4)+","+text$(6)+","+text$(12)
case 2
 2d_flood val(text$(4)),val(text$(6)),val(text$(32)),val(text$(35)),val(text$(38))
 item_add 41, "2d_flood "+text$(4)+","+text$(6)+","+text$(32)+","+text$(35)+","+text$(38)
case 3
 2d_line val(text$(4)),val(text$(6)),val(text$(8)),val(text$(10))
 item_add 41, "2d_line "+text$(4)+","+text$(6)+","+text$(8)+","+text$(10)
case 4
 2d_point val(text$(4)),val(text$(6))
 item_add 41, "2d_point "+text$(4)+","+text$(6)
case 5
 2d_rectangle val(text$(4)),val(text$(6)),val(text$(8)),val(text$(10))
 item_add 41, "2d_rectangle "+text$(4)+","+text$(6)+","+text$(8)+","+text$(10)
end_select
return

pnst:
x=item_index(27)
select x
case 1
 2d_pen_dash
case 2
 2d_pen_dash_dot
case 3
 2d_pen_dash_dot_dot
case 4
 2d_pen_dot
case 5
 2d_pen_solid
end_select
return

abt:
 show 400
 print_target_is 400
 print ""
 print "    PANORAMIC DRAW (by Lode Van de Velde)"
 print ""
 print "  - Left-click on canvas selects X1/Y1-coordinates. "
 print "  - Right-click on canvas selects X2/Y2-coordinates."
 print "  - Mind that 'flood' does not work well with the grid turned on!"
 print "  - Mind that 'flood' takes 'fill color', not 'pen color'!!"
 print ""
 print "    COLOR PICKER (by JL35, Nardo and Lode Van de Velde)"
 print ""
 print "  - Left-click color palet selects pen color. "
 print "  - Right-click on color palet selects fill color."
return

ld:
timer_off 42
 gosub wis
 fs$ = File_Name$(60)
 file_load 41,fs$
 for x=1 to count(41)
  a$=ltrim$(rtrim$(item_read$(41,x)))+",0,0,0,0,0,0,0,0"
  if instr(a$," ")<>0 then i$(1)=left$(a$,instr(a$," ")-1):a$=right$(a$,len(a$)-instr(a$," "))
  if instr(a$,",")<>0 then i$(2)=left$(a$,instr(a$,",")-1):a$=right$(a$,len(a$)-instr(a$,","))
  if instr(a$,",")<>0 then i$(3)=left$(a$,instr(a$,",")-1):a$=right$(a$,len(a$)-instr(a$,","))
  if instr(a$,",")<>0 then i$(4)=left$(a$,instr(a$,",")-1):a$=right$(a$,len(a$)-instr(a$,","))
  if instr(a$,",")<>0 then i$(5)=left$(a$,instr(a$,",")-1):a$=right$(a$,len(a$)-instr(a$,","))
  if instr(a$,",")<>0 then i$(6)=left$(a$,instr(a$,",")-1)
  if item_read$(41,x)="2d_pen_dash" then 2d_pen_dash
  if item_read$(41,x)="2d_pen_dash_dot" then 2d_pen_dash_dot
  if item_read$(41,x)="2d_pen_dash_dot_dot" then 2d_pen_dash_dot_dot
  if item_read$(41,x)="2d_pen_dot" then 2d_pen_dot
  if item_read$(41,x)="2d_pen_solid" then 2d_pen_solid
  if item_read$(41,x)="2d_fill_cross" then 2d_fill_cross
  if item_read$(41,x)="2d_fill_diagonal_cross" then 2d_fill_diagonal_cross
  if item_read$(41,x)="2d_fill_diagonal_down" then 2d_fill_diagonal_down
  if item_read$(41,x)="2d_fill_diagonal_up" then 2d_fill_diagonal_up
  if item_read$(41,x)="2d_fill_horizontal" then 2d_fill_horizontal
  if item_read$(41,x)="2d_fill_solid" then 2d_fill_solid
  if item_read$(41,x)="2d_fill_vertical" then 2d_fill_vertical
  if i$(1)="2d_pen_width" then 2d_pen_width val(i$(2))
  if i$(1)="2d_pen_color" then 2d_pen_color val(i$(2)),val(i$(3)),val(i$(4))
  if i$(1)="2d_fill_color" then 2d_fill_color val(i$(2)),val(i$(3)),val(i$(4))
  if i$(1)="2d_circle" then 2d_circle val(i$(2)),val(i$(3)),val(i$(4))
  if i$(1)="2d_point" then 2d_point val(i$(2)),val(i$(3))
  if i$(1)="2d_rectangle" then 2d_rectangle val(i$(2)),val(i$(3)),val(i$(4)),val(i$(5))
  if i$(1)="2d_line" then 2d_line val(i$(2)),val(i$(3)),val(i$(4)),val(i$(5))
  if i$(1)="2d_flood" then 2d_flood val(i$(2)),val(i$(3)),val(i$(4)),val(i$(5)),val(i$(6))
  for y=1 to 6
  i$(y)=""
  next y
 next x
 timer_on 42
return

sv:
 fs$ = File_Name$(61)
 file_save 41, fs$
return

flst:
x=item_index(44)
select x
case 1
 2d_fill_cross
case 2
 2d_fill_diagonal_cross
case 3
 2d_fill_diagonal_down
case 4
 2d_fill_diagonal_up
case 5
 2d_fill_horizontal
case 6
 2d_fill_solid
case 7
 2d_fill_vertical
end_select
return

err:
return
Back to top Go down
View user profile
 
Panoramic Draw
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» Charley Chau Birthday Prize Draw
» FREE Gift Basket draw!! ($400.00 value) *CANADA ONLY
» Steve Horsfall Photography Prize Draw
» Javascript Array
» how to change this in the chatbox

Permissions in this forum:You cannot reply to topics in this forum
Discussion forum about PANORAMIC language :: Panoramic for Windows :: Source code (snippets)-
Jump to: