-
Notifications
You must be signed in to change notification settings - Fork 0
/
DRAW2.EX
948 lines (908 loc) · 21.4 KB
/
DRAW2.EX
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
-----------------------------------------------------------
-- drawing for children version 0.1 AM 2;12 time 14/12/05
-----------------------------------------------------------
without type_check
without warning
include graphics.e
include image.e
include font.e
include get.e
include mouse2.e
if graphics_mode(258) then
end if
procedure line(atom x,atom y,atom xx,atom yy,atom color)
draw_line(color, {{x, y}, {xx, yy}})
end procedure
procedure rectangle(atom x,atom y,atom xx,atom yy,atom color,atom sel)
polygon(color, sel, {{x, y}, {xx, y}, {xx, yy},{x,yy}})
end procedure
sequence button_info,button_image_info
integer button_number,button_image_number
button_info={}
button_number=0
button_image_info={}
button_image_number=0
constant BUTTON_X=1
constant BUTTON_Y=2
constant BUTTON_WIDTH=3
constant BUTTON_SEL=4
constant BUTTON_NAME=5
constant BUTTON_DRAW=6
constant BUTTON_ID=7
constant BUTTON_IMAGE_X=1
constant BUTTON_IMAGE_Y=2
constant BUTTON_IMAGE_SEL=3
constant BUTTON_IMAGE_IMAGES=4
constant BUTTON_IMAGE_DRAW=5
constant BUTTON_IMAGE_ID=6
function create(sequence string)
if equal(string[1],"button")=1 then
button_number+=1
button_info=append(button_info,{string[2],string[3],0,0,string[4],1,button_number})
return button_number
end if
if equal(string[1],"button_image")=1 then
button_image_number+=1
button_image_info=append(button_image_info,{string[2],string[3],0,string[4],1,button_image_number})
return button_image_number
end if
end function
procedure draw_all()
for i=1 to length(button_info) do
button_info[i][BUTTON_DRAW]=1
end for
end procedure
function on_click(sequence string)
if equal(string[1],"button")=1 then
for i=1 to length(button_info) do
if button_info[i][BUTTON_ID]=string[2] then
if button_info[i][BUTTON_SEL]=1 then
button_info[i][BUTTON_SEL]=0
return 1
else
return 0
end if
end if
end for
end if
end function
procedure button_dos()
integer x,y,width,sel,draw
sequence name
for i=1 to length(button_info) do
x=button_info[i][BUTTON_X]
y=button_info[i][BUTTON_Y]
width=button_info[i][BUTTON_WIDTH]
sel=button_info[i][BUTTON_SEL]
name=button_info[i][BUTTON_NAME]
draw=button_info[i][BUTTON_DRAW]
width=length(name)
width+=2
width=width*8
if mouse_x>x and mouse_x< x+width and mouse_y>y and mouse_y<y+18 then
line(x,y,x+width,y,-1)
line(x,y,x,y+18,-1)
line(x,y+18,x+width,y+18,7)
line(x+width,y,x+width,y+18,7)
else
line(x,y,x+width,y,7)
line(x,y,x,y+18,7)
line(x,y+18,x+width,y+18,-1)
line(x+width,y,x+width,y+18,-1)
end if
if mouse_x>x and mouse_x< x+width and mouse_y>y and mouse_y<y+18 and mouse_button=mb_left then
sel=1
mouse_button=0
end if
if draw=1 then
line(x,y,x+width,y,7)
line(x,y+18,x+width,y+18,-1)
line(x,y,x,y+18,7)
line(x+width,y,x+width,y+18,-1)
rectangle(x+1,y+1,x+width-1,y+17,7,1)
draw_text({x+8,y+1},name,0,7,0)
draw=0
end if
button_info[i][BUTTON_WIDTH]=width
button_info[i][BUTTON_SEL]=sel
button_info[i][BUTTON_DRAW]=draw
end for
end procedure
procedure button_image_dos()
integer x,y,sel,draw,width,height
atom timer
sequence images
timer=0
for i=1 to length(button_image_info) do
x=button_image_info[i][BUTTON_IMAGE_X]
y=button_image_info[i][BUTTON_IMAGE_Y]
sel=button_image_info[i][BUTTON_IMAGE_SEL]
images=button_image_info[i][BUTTON_IMAGE_IMAGES]
draw=button_image_info[i][BUTTON_IMAGE_DRAW]
width=length(images[1][1])
height=length(images[1])
if mouse_x>x and mouse_x< x+width and mouse_y>y and mouse_y<y+height then
else
end if
if mouse_x>x and mouse_x< x+width and mouse_y>y and mouse_y<y+height and mouse_button=mb_left then
display_image({x,y},images[2])
timer=time()+.20
while 1 do
if time()>timer then
exit
end if
end while
display_image({x,y},images[1])
sel=1
mouse_button=0
end if
if draw=1 then
display_image({x,y},images[1])
draw=0
end if
button_image_info[i][BUTTON_IMAGE_SEL]=sel
button_image_info[i][BUTTON_IMAGE_DRAW]=draw
end for
end procedure
function file_read(sequence string)
sequence buffer
object line
integer fn
fn = open(string, "r")
if fn = -1 then
end if
buffer = {}
while 1 do
line = gets(fn)
if atom(line) then
exit
end if
line=line[1..length(line)-1]
buffer = append(buffer, line)
end while
close(fn)
return buffer
end function
function make_image(sequence data)
sequence image
integer pos1
image={}
pos1=1
for i=1 to length(data) do
image=append(image,{})
pos1=1
for j=1 to length(data[i]) do
if data[i][j]!='"' then
if data[i][j]='A' then
image[i]&=10
elsif data[i][j]='B' then
image[i]&=11
elsif data[i][j]='C' then
image[i]&=12
elsif data[i][j]='D' then
image[i]&=13
elsif data[i][j]='E' then
image[i]&=14
elsif data[i][j]='F' then
image[i]&=-1
else
image[i]&=data[i][j]
end if
end if
end for
end for
return image
end function
sequence image
image={}
procedure load_images(sequence string)
sequence temp,file_data,info
integer pos
pos=1
info={}
temp=file_read(string)
file_data={}
for i=1 to length(temp)-1 do
if temp[i][1]!='"' then
for j=1 to length(temp[i]) do
if temp[i][j]=',' then
info=append(info,temp[i][1..j-1])
info=append(info,temp[i][j+1..length(temp[i])])
exit
end if
end for
for j=i+1 to length(temp)-1 do
if temp[j][1]!='"' or j=length(temp)-1 then
if j=length(temp)-1 then
pos=j+1
exit
else
pos=j-1
exit
end if
end if
end for
file_data=append(file_data,{temp[i+1..pos],info})
info={}
end if
end for
temp={}
for i=1 to length(file_data) do
image=append(image,{make_image(file_data[i][1]),file_data[i][2]})
end for
end procedure
integer key, t_x,t_y,x1,y1, zoom_x,zoom_y,t_c,grid2
integer width_p,height_p,color,color2,grid
integer draw, mode
atom temp_x,temp_y
sequence s
sequence temp_image
integer click,l_x,l_y,button,soid
sequence temp_line
temp_image={}
for i=1 to 32 do
temp_image=append(temp_image,repeat(0,32))
end for
zoom_x=10
zoom_y=10
t_x=1
t_y=1
t_c=0
x1=1
y1=1
width_p=32
height_p=32
color=-1
color2=0
grid=3
grid2=1
s={}
temp_x=0
temp_y=0
draw=0
click=0
mode=1
l_x=1
l_y=1
temp_line={}
button=0
soid=1
procedure cls()
clear_screen()
draw_all()
end procedure
procedure new()
position(2,2)
width_p= prompt_number("What is width_p of the image enter number between 0 50? ", {0, 50})
height_p= prompt_number("What is height_p of image enter number between 0 50? ", {0, 50})
cls()
temp_image={}
for i=1 to height_p do
temp_image=append(temp_image,repeat(0,width_p))
end for
zoom_x=6
zoom_y=6
t_x=1
t_y=1
t_c=0
x1=1
y1=1
color=-1
color2=0
grid2=1
grid=3
s={}
temp_x=0
temp_y=0
draw=0
click=0
mode=1
l_x=1
l_y=1
temp_line={}
button=0
soid=1
end procedure
procedure draw_pos(integer pos1, integer pos2,integer all)
for y=1 to height_p do
for x=1 to width_p do
if x=pos1 and y=pos2 then
rectangle(zoom_x*t_x,zoom_y*t_y,zoom_x*(t_x+1),zoom_y*(t_y+1),t_c,1)
if zoom_x>=grid then
if grid2=1 then
rectangle(zoom_x*t_x,zoom_y*t_y,zoom_x*(t_x+1),zoom_y*(t_y+1),8,0)
end if
end if
rectangle(zoom_x*x,zoom_y*y,zoom_x*(x+1),zoom_y*(y+1),color,1)
if zoom_x>=grid then
if grid2=1 then
rectangle(zoom_x*x,zoom_y*y,zoom_x*(x+1),zoom_y*(y+1),-1,0)
end if
end if
else
if all=1 then
rectangle(zoom_x*x,zoom_y*y,zoom_x*(x+1),zoom_y*(y+1),temp_image[y][x],1)
if zoom_x>=grid then
if grid2 =1 then
rectangle(zoom_x*x,zoom_y*y,zoom_x*(x+1),zoom_y*(y+1),8,0)
end if
end if
end if
end if
end for
end for
end procedure
procedure draw_mouse2()
if temp_x!=mouse_x or temp_y!=mouse_y then
display_image({temp_x,temp_y},s)
s=save_image({mouse_x,mouse_y},{mouse_x+5,mouse_y+5})
rectangle(mouse_x,mouse_y,mouse_x+5,mouse_y+5,RED,1)
temp_x=mouse_x
temp_y=mouse_y
end if
end procedure
procedure draw_mouse()
x1=floor(mouse_x/zoom_x)
y1=floor(mouse_y/zoom_y)
if x1>=1 and x1<=width_p and y1>=1 and y1<=height_p then
if mouse_button=mb_right and mode>=2 then
if click=0 then
button=2
draw=1
mouse_button=0
l_x=x1
l_y=y1
temp_line=temp_image
click+=1
elsif click=1 then
if button=1 then
temp_image=temp_line
draw_pos(x1,y1,1)
end if
mouse_button=0
click=0
end if
end if
if mouse_button=mb_left and mode>=2 then
if click=0 then
button=1
draw=1
mouse_button=0
l_x=x1
l_y=y1
temp_line=temp_image
click+=1
elsif click=1 then
if button=2 then
temp_image=temp_line
draw_pos(x1,y1,1)
end if
mouse_button=0
click=0
end if
end if
if mouse_button=mb_left and mode=1 then
temp_image[y1][x1]=color
draw=1
mouse_button=0
end if
if mouse_button=mb_right and mode=1 then
temp_image[y1][x1]=color2
draw=2
mouse_button=0
end if
if t_x!=x1 or t_y!=y1 then
draw_text({300,580},"x "&sprint(x1)&" ",-1,0,0)
draw_text({360,580},"y "&sprint(y1)&" ",-1,0,0)
if draw=0 then
t_c=temp_image[t_y][t_x]
elsif draw=1 then
t_c=color
draw=0
elsif draw=2 then
t_c=color2
draw=0
end if
draw_pos(x1,y1,0)
if mode=1 then
elsif mode=2 and click=1 then
temp_image=temp_line
display_image({30,30},temp_image)
if button=1 then
line(29+l_x,29+l_y,29+x1,29+y1,color)
elsif button=2 then
line(29+l_x,29+l_y,29+x1,29+y1,color2)
end if
for i=1 to height_p do
for j=1 to width_p do
temp_image[i][j]=get_pixel({29+j,29+i})
end for
end for
draw_pos(x1,y1,1)
elsif mode=3 and click=1 then
temp_image=temp_line
display_image({30,30},temp_image)
if button=1 then
rectangle(29+l_x,29+l_y,29+x1,29+y1,color,soid)
elsif button=2 then
rectangle(29+l_x,29+l_y,29+x1,29+y1,color2,soid)
end if
for i=1 to height_p do
for j=1 to width_p do
temp_image[i][j]=get_pixel({29+j,29+i})
end for
end for
draw_pos(x1,y1,1)
elsif mode=4 and click=1 then
temp_image=temp_line
display_image({30,30},temp_image)
if button=1 then
ellipse(color,soid,{29+l_x,29+l_y} ,{29+x1,29+y1})
elsif button=2 then
ellipse(color2,soid,{29+l_x,29+l_y} ,{29+x1,29+y1})
end if
for i=1 to height_p do
for j=1 to width_p do
temp_image[i][j]=get_pixel({29+j,29+i})
end for
end for
draw_pos(x1,y1,1)
end if
t_x=x1
t_y=y1
end if
else
draw_mouse2()
end if
end procedure
procedure draw_colors(integer xx, integer yy)
for i=-1 to 14 do
rectangle(xx+15*(i+2),yy,xx+15*(i+3),yy+15,i,1)
end for
if mode=1 then
draw_text({300,560},"Pen ",-1,0,0)
elsif mode=2 then
draw_text({300,560},"line ",-1,0,0)
elsif mode=3 then
draw_text({300,560},"rectangle",-1,0,0)
elsif mode=4 then
draw_text({300,560},"cir ",-1,0,0)
end if
draw_text({420,560},"zoom "&sprint(zoom_x),-1,0,0)
draw_text({520,560},"width "&sprint(width_p)&" height "&sprint(height_p),-1,0,0)
draw_text({420,580},"soid "&sprint(soid),-1,0,0)
draw_text({520,580},"grid "&sprint(grid2),-1,0,0)
draw_text({300,580},"x "&sprint(x1)&" ",-1,0,0)
draw_text({360,580},"y "&sprint(y1)&" ",-1,0,0)
end procedure
procedure sel_color(integer xx, integer yy)
for i=-1 to 14 do
if mouse_x>=xx+15*(i+2) and mouse_x<=xx+15*(i+3) and mouse_y>=yy and mouse_y<=yy+15 and mouse_button=mb_left then
color=i
mouse_button=0
rectangle(xx+15,yy-25,xx+30,yy-10,color,1)
rectangle(xx+30,yy-25,xx+45,yy-10,color2,1)
rectangle(xx+15,yy-25,xx+30,yy-10,-1,0)
rectangle(xx+30,yy-25,xx+45,yy-10,-1,0)
exit
end if
if mouse_x>=xx+15*(i+2) and mouse_x<=xx+15*(i+3) and mouse_y>=yy and mouse_y<=yy+15 and mouse_button=mb_right then
color2=i
mouse_button=0
rectangle(xx+15,yy-25,xx+30,yy-10,color,1)
rectangle(xx+30,yy-25,xx+45,yy-10,color2,1)
rectangle(xx+15,yy-25,xx+30,yy-10,-1,0)
rectangle(xx+30,yy-25,xx+45,yy-10,-1,0)
exit
end if
end for
end procedure
function file_exsist(sequence string)
atom fn
fn = open(string, "r")
if fn = -1 then
return 0
else
return 1
close(fn)
end if
end function
procedure open_pic()
integer format
sequence file, ima
format=0
position(2,2)
if compare(prompt_string("Do You Want To Open A Image Yes or NO? "),"y") =0 then
file = prompt_string("Enter A File Name? ")
if file_exsist(file)=1 then
for i=1 to length(file) do
if file[i]='.' then
if equal(file[i+1..length(file)],"bmp")=1 then
format=1
elsif equal(file[i+1..length(file)],"pic")=1 then
format=2
end if
exit
end if
end for
if format=1 then
ima=read_bitmap(file)
temp_image=ima[2]
elsif format=2 then
image={}
load_images(file)
temp_image=image[1][1]
end if
height_p=length(temp_image)
zoom_x=6
zoom_y=6
width_p=length(temp_image[1])
t_x=1
t_y=1
t_c=0
x1=1
y1=1
color=-1
else
puts(1,"\n image not found")
sleep(2)
end if
end if
end procedure
procedure write_pic(sequence file_name, sequence pic)
integer fn,width,height
sequence bmp_image
bmp_image={}
width=length(pic[1])
height=length(pic)
for i=1 to height do
bmp_image=append(bmp_image,repeat(0,width))
end for
for i=1 to length(pic) do
for j=1 to length(pic[i]) do
if pic[i][j]=10 then
bmp_image[i][j]='A'
elsif pic[i][j]=11 then
bmp_image[i][j]='B'
elsif pic[i][j]=12 then
bmp_image[i][j]='C'
elsif pic[i][j]=13 then
bmp_image[i][j]='D'
elsif pic[i][j]=14 then
bmp_image[i][j]='E'
elsif pic[i][j]=-1 then
bmp_image[i][j]='F'
elsif pic[i][j]=15 then
bmp_image[i][j]='F'
else
bmp_image[i][j]=pic[i][j]
end if
end for
end for
fn = open(file_name, "w")
if fn = -1 then
end if
print(fn,width)
puts(fn,",")
print(fn,height)
puts(fn,"\n")
for i=1 to height do
puts(fn,'"')
for j=1 to width do
if bmp_image[i][j]>=0 and bmp_image[i][j]<=9 then
print(fn,bmp_image[i][j])
else
puts(fn,bmp_image[i][j])
end if
if j=width and i!=height then
puts(fn,'"'&"\n")
end if
if j=width and i=height then
puts(fn,'"')
end if
end for
end for
close(fn)
end procedure
procedure save()
integer err,format
sequence file
format=0
position(2,2)
if compare(prompt_string("Do You Want To Save Image Yes or NO? "),"y") =0 then
file = prompt_string("Enter A File Name? ")
for i=1 to length(file) do
if file[i]='.' then
if equal(file[i+1..length(file)],"bmp")=1 then
format=1
elsif equal(file[i+1..length(file)],"pic")=1 then
format=2
end if
exit
end if
end for
if format=1 then
cls()
display_image({1,1},temp_image)
err=save_screen({{1,1},{width_p, height_p}},file)
elsif format=2 then
write_pic(file,temp_image)
else
puts(1,"\n could not save")
sleep(2)
end if
end if
end procedure
draw_pos(1,1,1)
draw_colors(0,560)
integer button1,button2,button3,button4,button5,button6,button7,button8,button9
button1=create({"button",550,20,"zoom (-)"})
button2=create({"button",550,50,"zoom (+)"})
button3=create({"button",550,80,"mode (m)"})
button4=create({"button",550,110,"new (n)"})
button5=create({"button",550,140,"open (o)"})
button6=create({"button",550,170,"save (s)"})
button7=create({"button",550,260,"exit (e)"})
button8=create({"button",550,200,"soid (f)"})
button9=create({"button",550,230,"grid (g)"})
integer button10,button11,button12
button10=create({"button",650,20,"rotate (r)"})
button11=create({"button",650,50,"filp v (v)"})
button12=create({"button",650,80,"filp h (h)"})
procedure row()
sequence temp
integer l
l=0
temp=temp_image
l=height_p
for i=1 to height_p do
for j=1 to width_p do
temp_image[l][j]=temp[j][i]
end for
l-=1
end for
end procedure
procedure flip_h()
for i=1 to length(temp_image) do
temp_image[i]=reverse(temp_image[i])
end for
end procedure
procedure flip_v()
temp_image=reverse(temp_image)
end procedure
procedure keys()
if key='v' then
flip_v()
cls()
draw_colors(0,560)
draw_pos(x1,y1,1)
end if
if key='h' then
flip_h()
cls()
draw_colors(0,560)
draw_pos(x1,y1,1)
end if
if key='r' then
row()
cls()
draw_colors(0,560)
draw_pos(x1,y1,1)
end if
if key='+' then
if zoom_x*height_p<500 then
zoom_x+=1
zoom_y+=1
cls()
draw_colors(0,560)
draw_pos(x1,y1,1)
end if
end if
if key='-' then
if zoom_x>1 then
zoom_x-=1
zoom_y-=1
cls()
draw_colors(0,560)
draw_pos(x1,y1,1)
end if
end if
if key='m' then
mode+=1
if mode=5 then
mode=1
end if
draw_colors(0,560)
end if
if key='f' then
if soid=0 then
soid=1
else
soid=0
end if
draw_colors(0,560)
end if
if key='n' then
position(2,2)
if compare(prompt_string("Start New Image Yes or NO? "),"y") =0 then
new()
end if
cls()
draw_colors(0,560)
draw_pos(x1,y1,1)
end if
if key='s' then
save()
cls()
draw_colors(0,560)
draw_pos(x1,y1,1)
end if
if key='o' then
open_pic()
cls()
draw_colors(0,560)
draw_pos(x1,y1,1)
end if
if key='e' then
position(2,2)
if compare(prompt_string("Do You Want To Exit Yes or NO? "),"y") =0 then
position(1,1)
clear_screen()
if graphics_mode(18) then
end if
abort(0)
end if
cls()
draw_colors(0,560)
draw_pos(x1,y1,1)
end if
if key='g' then
if grid2=0 then
grid2=1
else
grid2=0
end if
draw_colors(0,560)
draw_pos(x1,y1,1)
end if
end procedure
procedure commands()
if on_click({"button",button1})=1 then
if zoom_x>1 then
zoom_x-=1
zoom_y-=1
cls()
draw_colors(0,560)
draw_pos(x1,y1,1)
end if
end if
if on_click({"button",button2})=1 then
if zoom_x*height_p<500 then
zoom_x+=1
zoom_y+=1
cls()
draw_colors(0,560)
draw_pos(x1,y1,1)
end if
end if
if on_click({"button",button3})=1 then
mode+=1
if mode=5 then
mode=1
end if
draw_colors(0,560)
end if
if on_click({"button",button4})=1 then
position(2,2)
if compare(prompt_string("Start New Image Yes or NO? "),"y") =0 then
new()
end if
cls()
draw_colors(0,560)
draw_pos(x1,y1,1)
end if
if on_click({"button",button5})=1 then
open_pic()
cls()
draw_colors(0,560)
draw_pos(x1,y1,1)
end if
if on_click({"button",button6})=1 then
save()
cls()
draw_colors(0,560)
draw_pos(x1,y1,1)
end if
if on_click({"button",button7})=1 then
position(2,2)
if compare(prompt_string("Do You Want To Exit Yes or NO? "),"y") =0 then
position(1,1)
clear_screen()
if graphics_mode(18) then
end if
abort(0)
end if
cls()
draw_colors(0,560)
draw_pos(x1,y1,1)
end if
if on_click({"button",button8})=1 then
if soid=0 then
soid=1
else
soid=0
end if
draw_colors(0,560)
end if
if on_click({"button",button9})=1 then
if grid2=0 then
grid2=1
else
grid2=0
end if
draw_colors(0,560)
draw_pos(x1,y1,1)
end if
if on_click({"button",button10})=1 then
row()
cls()
draw_colors(0,560)
draw_pos(x1,y1,1)
end if
if on_click({"button",button11})=1 then
flip_v()
cls()
draw_colors(0,560)
draw_pos(x1,y1,1)
end if
if on_click({"button",button12})=1 then
flip_h()
cls()
draw_colors(0,560)
draw_pos(x1,y1,1)
end if
end procedure
integer bm1,bm2,bm3,bm4
image={}
load_images("a_up.pic")
bm1=create({"button_image",600,400,{image[1][1],image[2][1]}})
image={}
load_images("a_l.pic")
bm2=create({"button_image",576,424,{image[1][1],image[2][1]}})
image={}
load_images("a_d.pic")
bm3=create({"button_image",600,424,{image[1][1],image[2][1]}})
image={}
load_images("a_r.pic")
bm4=create({"button_image",624,424,{image[1][1],image[2][1]}})
image={}
load_images("aa.pic")
temp_image=image[1][1]
height_p=length(temp_image)
zoom_x=6
zoom_y=6
width_p=length(temp_image[1])
t_x=1
t_y=1
t_c=0
x1=1
y1=1
color=-1
cls()
draw_pos(1,1,1)
draw_colors(0,560)
while 1 do
key=get_key()
if key != -1 then
keys()
if key=27 then
exit
end if
end if
mouse()
draw_mouse()
sel_color(0,560)
button_dos()
button_image_dos()
commands()
end while