JL35
Nombre de messages : 7112 Localisation : 77 Date d'inscription : 29/11/2007
| Sujet: Cartes de voeux, menus, etc. Lun 11 Déc 2017 - 15:48 | |
| J'avais déjà fait quelque chose du même genre en 2014, mais là j'ai bien simplifié. En fait il y a 3 subs principales d'insertion d'éléments dans un picture donné, qu'on peut utiliser indépendamment dans un programme quelconque: - insertion d'un dessin élémentaire (trait, rectangle, cercle) - insertion d'une image quelconque - insertion d'un texte Le principe est d'insérer l'élément au clic souris dans le picture, et on peut ensuite le positionner avec précision dans les 4 directions. Le programme d'appel est ici succinct, juste pour la démo, à adapter à ses besoins (choix de l'image de fond d'origine, et procédure de sauvegarde du résultat). Remarque: les fichiers de manoeuvre temporaires dans les subs sont créés chez moi sur mon disque virtuel Z:\ (qui est en mémoire), il faut évidemment adapter à son environnement, par exemple C:\TEMP\ - Code:
-
' Création de cartes de voeux, menus, etc. LABEL Fin,Exec DIM f$,i%,wf%,hf% f$ = "C:\GRAPH\JPG\Goldgate.jpg": wf% = 640: hf% = 480 i% = WIDTH(0)-WIDTH_CLIENT(0): WIDTH 0,wf%+i% i% = HEIGHT(0)-HEIGHT_CLIENT(0): HEIGHT 0,hf%+i%+30 font_bold 0 PICTURE 1: WIDTH 1,wf%: HEIGHT 1,hf%: FILE_LOAD 1,f$
BUTTON 5: TOP 5,HEIGHT(1)+5: LEFT 5,5: CAPTION 5,"Dessin" BUTTON 6: TOP 6,TOP(5): LEFT 6,LEFT(5)+85: CAPTION 6,"Image" BUTTON 7: TOP 7,TOP(6): LEFT 7,LEFT(6)+85: CAPTION 7,"Texte" FOR i% = 5 TO 7: ON_CLICK i%,Exec: NEXT i% BUTTON 10: TOP 10,TOP(7): LEFT 10,WIDTH(1)-85: CAPTION 10,"Quitter": ON_CLICK 10,Fin END
Fin: Terminate ' ============================================================================== Exec: i% = NUMBER_CLICK SELECT i% CASE 5: DesToPic(1) CASE 6: ImgToPic(1) CASE 7: TexToPic(1) END_SELECT RETURN ' ============================================================================== SUB DesToPic(p%) ' Dessin de formes élémentaires sur le picture p% IF LABEL("Chcou") = 0 THEN LABEL Chcou IF LABEL("Ccoud") = 0 THEN LABEL Ccoud IF LABEL("Desoutil") = 0 THEN LABEL Desoutil IF LABEL("Posito") = 0 THEN LABEL Posito IF LABEL("Desfig") = 0 THEN LABEL Desfig IF LABEL("Desfig1") = 0 THEN LABEL Desfig1 IF LABEL("Shiftd") = 0 THEN LABEL Shiftd IF LABEL("Annuld")=0 THEN LABEL Annuld IF LABEL("Fsubd") = 0 THEN LABEL Fsubd DIM_LOCAL fm%,fs%,i%,j%,k%,bhf%,bvf%,pc%,pr%,pa%,x%,y%,x1%,y1%,r%,g%,b%,rf%,gf%,bf% DIM_LOCAL o1%,out%,al%,et%,im%,w%,h%,a$,co%,cc% fm% = 750 FORM fm%: BORDER_SMALL fm%: WIDTH fm%,400: HEIGHT fm%,160 TOP fm%,(SCREEN_Y-HEIGHT(fm%))/2: LEFT fm%,(SCREEN_X-WIDTH(fm%))/2 FONT_NAME fm%,"Arial": FONT_BOLD fm%: ON_CLOSE fm%,Fsubd COLOR fm%,190,255,255 CAPTION fm%," - INSERTION DE FIGURES GÉOMÉTRIQUES -" bhf% = WIDTH(fm%)-WIDTH_CLIENT(fm%): bvf% = HEIGHT(fm%)-HEIGHT_CLIENT(fm%) i%=fm%+1: ALPHA i%: PARENT i%,fm%: TOP i%,5: LEFT i%,5 CAPTION i%,"Épaisseur Trait: Couleur trait: Couleur rempl.:" i%=i%+1: SPIN i%: PARENT i%,fm%: TOP i%,TOP(i%-1)-3: LEFT i%,LEFT(i%-1)+90 WIDTH i%,40: MIN i%,1: MAX i%,20: POSITION i%,1: et%=i% i%=i%+1: PICTURE i%: PARENT i%,fm%: TOP i%,1: HEIGHT i%,22: WIDTH i%,30: ' couleur de tracé LEFT i%,LEFT(i%-1)+120: COLOR i%,0,0,0: ON_CLICK i%,Chcou: pc% = i% i%=i%+1: PICTURE i%: PARENT i%,fm%: TOP i%,TOP(i%-1): HEIGHT i%,22: WIDTH i%,30 LEFT i%,LEFT(i%-1)+127: COLOR i%,128,128,128: ON_CLICK i%,Chcou: pr% = i% i%=i%+1: PICTURE i%: PARENT i%,fm%: TOP i%,TOP(i%-1)+25: LEFT i%,5: HEIGHT i%,20 WIDTH i%,WIDTH(fm%)-bhf%-10: ON_CLICK i%,Ccoud: pa% = i%: ' palette k% = WIDTH(i%)/16 2D_TARGET_IS i% FOR j% = 0 TO 15 SELECT j% CASE 0: 2D_FILL_COLOR 0,0,0: ' Noir CASE 1: 2D_FILL_COLOR 0,0,128: ' Bleu CASE 2: 2D_FILL_COLOR 0,128,0: ' Vert CASE 3: 2D_FILL_COLOR 0,128,128: ' Cyan CASE 4: 2D_FILL_COLOR 128,0,0: ' Rouge CASE 5: 2D_FILL_COLOR 128,0,128: ' Magenta CASE 6: 2D_FILL_COLOR 128,64,0: ' Brun CASE 7: 2D_FILL_COLOR 192,192,192: ' Blanc CASE 8: 2D_FILL_COLOR 128,128,128: ' Gris CASE 9: 2D_FILL_COLOR 0,0,255: ' Bleu clair CASE 10: 2D_FILL_COLOR 0,255,0: ' Vert clair CASE 11: 2D_FILL_COLOR 0,255,255: ' Cyan clair CASE 12: 2D_FILL_COLOR 255,0,0: ' Rouge clair CASE 13: 2D_FILL_COLOR 255,0,255: ' Magenta clair CASE 14: 2D_FILL_COLOR 255,255,0: ' Jaune CASE 15: 2D_FILL_COLOR 255,255,255: ' Blanc intense END_SELECT 2D_RECTANGLE j%*k%,0,(j%+1)*k%-1,HEIGHT(i%) NEXT j% i%=i%+1: ALPHA i%: PARENT i%,fm%: TOP i%,TOP(pa%)+HEIGHT(pa%): LEFT i%,50 FONT_BOLD_OFF i%: FONT_ITALIC i% CAPTION i%,"cliquer le type (trait ou remplissage), puis la couleur désirée" ' Boîte à outils : j% = 30 i%=i%+1: PICTURE i%: PARENT i%,fm%: TOP i%,TOP(i%-1)+20: LEFT i%,5: o1%=i% WIDTH i%,j%: HEIGHT i%,j% 2D_TARGET_IS i%: 2D_PEN_COLOR 255,0,0: 2D_RECTANGLE 0,0,j%,j%: out% = 1 2D_PEN_WIDTH 2: 2D_PEN_COLOR 0,0,0: 2D_LINE 4,j%-8,j%-4,8 i%=i%+1: PICTURE i%: PARENT i%,fm%: TOP i%,TOP(i%-1): LEFT i%,LEFT(i%-1)+j%+5 WIDTH i%,j%: HEIGHT i%,j% 2D_TARGET_IS i%: 2D_RECTANGLE 0,0,j%,j% 2D_PEN_WIDTH 2: 2D_FILL_OFF: 2D_RECTANGLE 4,6,j%-4,j%-6 i%=i%+1: PICTURE i%: PARENT i%,fm%: TOP i%,TOP(i%-1): LEFT i%,LEFT(i%-1)+j%+5 WIDTH i%,j%: HEIGHT i%,j% 2D_TARGET_IS i%: 2D_RECTANGLE 0,0,j%,j% 2D_PEN_WIDTH 2: 2D_FILL_ON: 2D_FILL_COLOR 128,128,128: 2D_RECTANGLE 4,6,j%-4,j%-6 i%=i%+1: PICTURE i%: PARENT i%,fm%: TOP i%,TOP(i%-1): LEFT i%,LEFT(i%-1)+j%+5 WIDTH i%,j%: HEIGHT i%,j% 2D_TARGET_IS i%: 2D_RECTANGLE 0,0,j%,j% 2D_PEN_WIDTH 2: 2D_FILL_OFF: 2D_CIRCLE j%/2,j%/2,j%/2-3 i%=i%+1: PICTURE i%: PARENT i%,fm%: TOP i%,TOP(i%-1): LEFT i%,LEFT(i%-1)+j%+5 WIDTH i%,j%: HEIGHT i%,j% 2D_TARGET_IS i%: 2D_RECTANGLE 0,0,j%,j% 2D_PEN_WIDTH 2: 2D_FILL_ON: 2D_FILL_COLOR 128,128,128: 2D_CIRCLE j%/2,j%/2,j%/2-3 i%=i%+1: PICTURE i%: PARENT i%,fm%: TOP i%,TOP(i%-1): LEFT i%,LEFT(i%-1)+j%+5 WIDTH i%,j%: HEIGHT i%,j% 2D_TARGET_IS i%: 2D_RECTANGLE 0,0,j%,j% FOR j% = o1% TO i% ON_CLICK j%,Desoutil NEXT j% i%=i%+1: CONTAINER i%: PARENT i%,fm%: TOP i%,TOP(i%-1)-2: LEFT i%,LEFT(i%-1)+40 WIDTH i%,140: HEIGHT i%,30: co%=i% i%=i%+1: BUTTON i%: PARENT i%,co%: TOP i%,8: WIDTH i%,25: HEIGHT i%,20: CAPTION i%,CHR$(231) i%=i%+1: BUTTON i%: PARENT i%,co%: TOP i%,TOP(i%-1): WIDTH i%,WIDTH(i%-1) LEFT i%,LEFT(i%-1)+WIDTH(i%-1): HEIGHT i%,HEIGHT(i%-1): CAPTION i%,CHR$(232) i%=i%+1: BUTTON i%: PARENT i%,co%: TOP i%,TOP(i%-1): WIDTH i%,WIDTH(i%-1) LEFT i%,LEFT(i%-1)+WIDTH(i%-1): HEIGHT i%,HEIGHT(i%-1): CAPTION i%,CHR$(233) i%=i%+1: BUTTON i%: PARENT i%,co%: TOP i%,TOP(i%-1): WIDTH i%,WIDTH(i%-1) LEFT i%,LEFT(i%-1)+WIDTH(i%-1): HEIGHT i%,HEIGHT(i%-1): CAPTION i%,CHR$(234) FOR j%=i%-3 TO i%: FONT_NAME j%,"Wingdings": ON_CLICK j%,Shiftd: NEXT j% i%=i%+1: SPIN i%: PARENT i%,co%: TOP i%,TOP(i%-1)-3: WIDTH i%,42 LEFT i%,LEFT(i%-1)+WIDTH(i%-1): POSITION i%,1 i%=i%+1: ALPHA i%: PARENT i%,fm%: TOP i%,TOP(co%)+35: LEFT i%,10: al%=i% CAPTION i%,"Cliquer le point de départ du trait" i%=i%+1: BUTTON i%: PARENT i%,fm%: TOP i%,TOP(co%)+35: LEFT i%,WIDTH(fm%)-180 CAPTION i%,"Annuler": ON_CLICK i%,Annuld i%=i%+1: BUTTON i%: PARENT i%,fm%: TOP i%,TOP(i%-1): LEFT i%,LEFT(i%-1)+80 CAPTION i%,"Quitter": ON_CLICK i%,Fsubd i%=i%+1: IMAGE i%: im%=i% 2D_TARGET_IS p% w% = WIDTH(p%): h% = HEIGHT(p%): ON_CLICK p%,Posito r% = 0: g% = 0: b% = 0: rf% = 128: gf% = 128: bf% = 128 WHILE fs% = 0: PAUSE 200: END_WHILE DELETE im%: DELETE fm%: EXIT_SUB ' ______________________________________________________________________________ Chcou: cc% = NUMBER_CLICK: ' couleur tracé ou remplissage RETURN ' ______________________________________________________________________________ Ccoud: x% = MOUSE_X_LEFT_DOWN(pa%): y% = MOUSE_Y_LEFT_DOWN(pa%) IF cc% = pc%: ' choix couleur de dtrait r%=COLOR_PIXEL_RED(pa%,x%,y%): g%=COLOR_PIXEL_GREEN(pa%,x%,y%) b%=COLOR_PIXEL_BLUE(pa%,x%,y%): COLOR pc%,r%,g%,b% ELSE IF cc% = pr%: ' choix couleur de remplissage rf%=COLOR_PIXEL_RED(pa%,x%,y%): gf%=COLOR_PIXEL_GREEN(pa%,x%,y%) bf%=COLOR_PIXEL_BLUE(pa%,x%,y%): COLOR pr%,rf%,gf%,bf% END_IF END_IF cc% = 0 RETURN ' ______________________________________________________________________________ Desoutil: i% = NUMBER_CLICK: IF i%>(o1%+4) THEN RETURN FOR j% = o1% TO o1%+4 2D_TARGET_IS j%: 2D_PEN_COLOR 0,0,0: 2D_FILL_OFF: 2D_RECTANGLE 0,0,WIDTH(j%),HEIGHT(j%) NEXT j% IF i% = o1% THEN out% = 1: ' trait IF i% = o1%+1 THEN out% = 2: ' rectangle vide IF i% = o1%+2 THEN out% = 3: ' rectangle plein IF i% = o1%+3 THEN out% = 4: ' cercle vide IF i% = O1%+4 THEN out% = 5: ' cercle plein 2D_TARGET_IS i%: 2D_PEN_COLOR 255,0,0: 2D_RECTANGLE 0,0,WIDTH(i%),HEIGHT(i%) SELECT out% CASE 1: a$ = "Cliquer le point de départ du trait" CASE 2: a$ = "Cliquer un coin du rectangle" CASE 3: a$ = "Cliquer un coin du rectangle" CASE 4: a$ = "Cliquer le centre du cercle" CASE 5: a$ = "Cliquer le centre du cercle" END_SELECT CAPTION al%,a$ RETURN ' ______________________________________________________________________________ Posito: x% = MOUSE_X_LEFT_DOWN(p%): y% = MOUSE_Y_LEFT_DOWN(p%) ' TEXT xi%,STR$(x%): TEXT xi%+1,STR$(y%) 2D_TARGET_IS p%: 2D_IMAGE_COPY im%,0,0,w%,h%: ' sauvegarde 2D_FILL_OFF: 2D_PEN_COLOR 255,0,255: 2D_PEN_WIDTH 2 2D_LINE x%-10,y%,x%+10,y%: 2D_LINE x%,y%-10,x%,y%+10: ' point de départ SELECT out% CASE 1: a$ = "Cliquer le point d'arrivée du trait" CASE 2: a$ = "Cliquer le coin opposé du rectangle" CASE 3: a$ = "Cliquer le coin opposé du rectangle" CASE 4: a$ = "Cliquer un point du cercle" CASE 5: a$ = "Cliquer un point du cercle" END_SELECT CAPTION al%,a$ x1% = x%: y1% = y%: ON_CLICK p%,Desfig TO_FOREGROUND fm% RETURN ' ______________________________________________________________________________ Desfig: x% = MOUSE_X_LEFT_DOWN(p%): y% = MOUSE_Y_LEFT_DOWN(p%) Desfig1: 2D_TARGET_IS p%: 2D_IMAGE_PASTE im%,0,0 2D_PEN_WIDTH POSITION(et%): 2D_PEN_COLOR r%,g%,b%: 2D_FILL_COLOR rf%,gf%,bf% SELECT out% CASE 1: 2D_LINE x1%,y1%,x%,y%: a$="Cliquer le point de départ du trait" CASE 2: 2D_FILL_OFF: 2D_RECTANGLE x1%,y1%,x%,y%: a$="Cliquer un coin du rectangle" CASE 3: 2D_FILL_ON: 2D_RECTANGLE x1%,y1%,x%,y%: a$="Cliquer un coin du rectangle" CASE 4: j%=SQR((y%-y1%)*(y%-y1%)+(x%-x1%)*(x%-x1%)): a$="Cliquer le centre du cercle" 2D_FILL_OFF: 2D_CIRCLE x1%,y1%,j% CASE 5: j%=SQR((y%-y1%)*(y%-y1%)+(x%-x1%)*(x%-x1%)): a$="Cliquer le centre du cercle" 2D_FILL_ON: 2D_CIRCLE x1%,y1%,j% END_SELECT CAPTION al%,a$: ON_CLICK p%,Posito TO_FOREGROUND fm% RETURN ' ______________________________________________________________________________ Shiftd: i% = NUMBER_CLICK: j% = POSITION(co%+5) IF i% = co%+1 THEN x1% = x1%-j%: x% = x%-j% IF i% = co%+2 THEN x1% = x1%+j%: x% = x%+j% IF i% = co%+3 THEN y1% = y1%-j%: y% = y%-j% IF i% = co%+4 THEN y1% = y1%+j%: y% = y%+j% GOSUB Desfig1 RETURN ' ______________________________________________________________________________ Annuld: 2D_TARGET_IS p%: 2D_IMAGE_PASTE im%,0,0 RETURN ' ______________________________________________________________________________ Fsubd: fs% = 1 RETURN END_SUB ' ============================================================================== SUB ImgToPic(p%) ' Insertion d'une image dans le picture p% IF LABEL("Chimg") = 0 THEN LABEL Chimg IF LABEL("Positi") = 0 THEN LABEL Positi IF LABEL("Applim") = 0 THEN LABEL Applim IF LABEL("Applim1") = 0 THEN LABEL Applim1 IF LABEL("Shifti") = 0 THEN LABEL Shifti IF LABEL("Annuli") = 0 THEN LABEL Annuli IF LABEL("Fsubi") = 0 THEN LABEL Fsubi DIM_LOCAL fm%,fs%,fz$,i%,j%,k%,bhf%,bvf%,pc%,x%,y%,r%,g%,b%,ed%,od%,wi%,hi%,v%(8) DIM_LOCAL im%,ims%,xi%,w%,h%,pi%,a$,co% fz$ = "Z:\TmpImg.bmp" fm% = 850 FORM fm%: BORDER_SMALL fm%: WIDTH fm%,400: HEIGHT fm%,160 TOP fm%,(SCREEN_Y-HEIGHT(fm%))/2: LEFT fm%,(SCREEN_X-WIDTH(fm%))/2 FONT_NAME fm%,"Arial": FONT_BOLD fm%: ON_CLOSE fm%,Fsubi COLOR fm%,190,255,255 CAPTION fm%," - INSERTION D' UNE IMAGE -" bhf% = WIDTH(fm%)-WIDTH_CLIENT(fm%): bvf% = HEIGHT(fm%)-HEIGHT_CLIENT(fm%) i%=fm%+1: ALPHA i%: PARENT i%,fm%: TOP i%,5: LEFT i%,5: CAPTION i%,"Image à insérer:" i%=i%+1: EDIT i%: PARENT i%,fm%: TOP i%,TOP(i%-1)-3: LEFT i%,98: WIDTH i%,280: ed%=i% ON_CLICK i%,Chimg i%=i%+1: ALPHA i%: PARENT i%,fm%: TOP i%,TOP(i%-1)+25: LEFT i%,LEFT(i%-1) i%=i%+1: ALPHA i%: PARENT i%,fm%: TOP i%,TOP(i%-1)+20: LEFT i%,10: FONT_ITALIC i% CAPTION i%,"Cliquer dans le dessin le point d'insertion (coin haut/gauche), puis:" i%=i%+1: OPEN_DIALOG i%: FILTER i%,"Images BMP,JPG|*.bmp;*.jpg": od% = i%
i%=i%+1: ALPHA i%: PARENT i%,fm%: TOP i%,TOP(i%-2)+22: LEFT i%,LEFT(i%-2) CAPTION i%,"X= Y=" i%=i%+1: EDIT i%: PARENT i%,fm%: TOP i%,TOP(i%-1)-2: LEFT i%,LEFT(i%-1)+15: WIDTH i%,45 HEIGHT i%,18: xi% = i% i%=i%+1: EDIT i%: PARENT i%,fm%: TOP i%,TOP(i%-1): LEFT i%,LEFT(i%-1)+65: WIDTH i%,WIDTH(i%-1) HEIGHT i%,18
i%=i%+1: BUTTON i%: PARENT i%,fm%: TOP i%,TOP(i%-1)-2: LEFT i%,WIDTH(fm%)/2-55 CAPTION i%,"Insérer": ON_CLICK i%,Applim i%=i%+1: CONTAINER i%: PARENT i%,fm%: TOP i%,TOP(i%-1)-3: LEFT i%,LEFT(i%-1)+90 WIDTH i%,140: HEIGHT i%,30: co%=i% i%=i%+1: BUTTON i%: PARENT i%,co%: TOP i%,8: WIDTH i%,25: HEIGHT i%,20: CAPTION i%,CHR$(231) i%=i%+1: BUTTON i%: PARENT i%,co%: TOP i%,TOP(i%-1): WIDTH i%,WIDTH(i%-1) LEFT i%,LEFT(i%-1)+WIDTH(i%-1): HEIGHT i%,HEIGHT(i%-1): CAPTION i%,CHR$(232) i%=i%+1: BUTTON i%: PARENT i%,co%: TOP i%,TOP(i%-1): WIDTH i%,WIDTH(i%-1) LEFT i%,LEFT(i%-1)+WIDTH(i%-1): HEIGHT i%,HEIGHT(i%-1): CAPTION i%,CHR$(233) i%=i%+1: BUTTON i%: PARENT i%,co%: TOP i%,TOP(i%-1): WIDTH i%,WIDTH(i%-1) LEFT i%,LEFT(i%-1)+WIDTH(i%-1): HEIGHT i%,HEIGHT(i%-1): CAPTION i%,CHR$(234) FOR j%=i%-3 TO i%: FONT_NAME j%,"Wingdings": ON_CLICK j%,Shifti: NEXT j% i%=i%+1: SPIN i%: PARENT i%,co%: TOP i%,TOP(i%-1)-3: WIDTH i%,42 LEFT i%,LEFT(i%-1)+WIDTH(i%-1): POSITION i%,1 i%=i%+1: BUTTON i%: PARENT i%,fm%: TOP i%,TOP(co%)+35: LEFT i%,LEFT(i%-1)+80 CAPTION i%,"Annuler": ON_CLICK i%,Annuli i%=i%+1: BUTTON i%: PARENT i%,fm%: TOP i%,TOP(i%-1): LEFT i%,LEFT(i%-1)+80 CAPTION i%,"Quitter": ON_CLICK i%,Fsubi i%=i%+1: PICTURE i%: HIDE i%: pi%=i% i%=i%+1: IMAGE i%: im%=i% i%=i%+1: IMAGE i%: ims%=i%
2D_TARGET_IS p% w% = WIDTH(p%): h% = HEIGHT(p%): ON_CLICK p%,Positi WHILE fs% = 0: PAUSE 200: END_WHILE DELETE od%: DELETE pi%: DELETE im%: DELETE ims%: DELETE fm%: EXIT_SUB end ' ______________________________________________________________________________ Chimg: a$ = FILE_NAME$(od%) TEXT ed%,a$ FILE_LOAD pi%,a$: FILE_SAVE pi%,fz$: a$ = fz$ FILEBIN_OPEN_READ 1,a$ FILEBIN_POSITION 1, 18: FILEBIN_BLOCK_READ 1,8,v%(0) wi% = v%(0)+256*v%(1)+65536*v%(2)+16777216*v%(3) hi% = v%(4)+256*v%(5)+65536*v%(6)+16777216*v%(7) FILEBIN_CLOSE 1 FILE_LOAD ims%,a$ CAPTION ed%+1," (image = "+STR$(wi%)+" x "+STR$(hi%)+" pixels) " RETURN ' ______________________________________________________________________________ Positi: IF TEXT$(ed%) = "" THEN RETURN: ' pas d'image x% = MOUSE_X_LEFT_DOWN(p%): y% = MOUSE_Y_LEFT_DOWN(p%) TEXT xi%,STR$(x%): TEXT xi%+1,STR$(y%) 2D_TARGET_IS p%: 2D_IMAGE_COPY im%,0,0,w%,h%: ' sauvegarde 2D_FILL_OFF: 2D_PEN_COLOR 255,0,255: 2D_PEN_WIDTH 2 2D_RECTANGLE x%,y%,x%+wi%,y%+hi% TO_FOREGROUND fm% RETURN ' ______________________________________________________________________________ Applim: x% = VAL(TEXT$(xi%)): y% = VAL(TEXT$(xi%+1)) Applim1: 2D_TARGET_IS p%: 2D_IMAGE_PASTE im%,0,0 2D_IMAGE_PASTE ims%,x%,y% TO_FOREGROUND fm% RETURN ' ______________________________________________________________________________ Shifti: i% = NUMBER_CLICK: j% = POSITION(co%+5) IF i% = co%+1 THEN x% = x%-j% IF i% = co%+2 THEN x% = x%+j% IF i% = co%+3 THEN y% = y%-j% IF i% = co%+4 THEN y% = y%+j% GOSUB Applim1 RETURN ' ______________________________________________________________________________ Annuli: 2D_TARGET_IS p%: 2D_IMAGE_PASTE im%,0,0 RETURN ' ______________________________________________________________________________ Fsubi: fs% = 1 RETURN END_SUB ' ============================================================================== SUB TexToPic(p%) ' Tracé de texte à fond transparent sur le picture p% IF LABEL("Ccout") = 0 THEN LABEL Ccout IF LABEL("Cenr") = 0 THEN LABEL Cenr IF LABEL("Majpo") = 0 THEN LABEL Majpo IF LABEL("Majpo1") = 0 THEN LABEL Majpo1 IF LABEL("Majsz") = 0 THEN LABEL Majsz IF LABEL("Positx") = 0 THEN LABEL Positx IF LABEL("Applix") = 0 THEN LABEL Applix ' IF LABEL("Applix1") = 0 THEN LABEL Applix1 IF LABEL("Shiftx") = 0 THEN LABEL Shiftx IF LABEL("Annulx") = 0 THEN LABEL Annulx IF LABEL("Fsubt") = 0 THEN LABEL Fsubt DIM_LOCAL fm%,fs%,fp%,i%,j%,k%,bhf%,bvf%,pc%,x%,y%,r%,g%,b%,me%,im%,fnt$,sz%,fn%,enr% DIM_LOCAL w%,h%,a$,wt%,ht%,hl%,xt%,co% fm% = 950 FORM fm%: BORDER_SMALL fm%: WIDTH fm%,500: HEIGHT fm%,270 TOP fm%,(SCREEN_Y-HEIGHT(fm%))/2: LEFT fm%,(SCREEN_X-WIDTH(fm%))/2 FONT_NAME fm%,"Arial": FONT_BOLD fm%: ON_CLOSE fm%,Fsubt COLOR fm%,190,255,255 CAPTION fm%," - INSERTION DE TEXTE -" bhf% = WIDTH(fm%)-WIDTH_CLIENT(fm%): bvf% = HEIGHT(fm%)-HEIGHT_CLIENT(fm%) i%=fm%+1: ALPHA i%: PARENT i%,fm%: TOP i%,5: LEFT i%,5 CAPTION i%,"Police:" fnt$ = "Arial": sz% = 12: ' police et taille de départ i%=i%+1: EDIT i%: PARENT i%,fm%: TOP i%,2: LEFT i%,50: WIDTH i%,190: TEXT i%,fnt$ fn% = i%: ON_CLICK fn%,Majpo i%=i%+1: SPIN i%: PARENT i%,fm%: TOP i%,TOP(i%-1): LEFT i%,LEFT(i%-1)+WIDTH(i%-1)+2 WIDTH i%,42: MIN i%,4: MAX i%,256: POSITION i%,sz%: ON_CHANGE i%,Majsz i%=i%+1: CHECK i%: PARENT i%,fm%: TOP i%,TOP(fn%)+2: LEFT i%,LEFT(fn%+1)+45: CAPTION i%,"G" i%=i%+1: CHECK i%: PARENT i%,fm%: TOP i%,TOP(i%-1): LEFT i%,LEFT(i%-1)+30: CAPTION i%,"I" i%=i%+1: CHECK i%: PARENT i%,fm%: TOP i%,TOP(i%-1): LEFT i%,LEFT(i%-1)+30: CAPTION i%,"S" FOR j%=i%-2 TO i%: WIDTH j%,25: ON_CLICK j%,Cenr: NEXT j% i%=i%+1: ALPHA i%: PARENT i%,fm%: TOP i%,TOP(i%-1): LEFT i%,LEFT(i%-1)+35 CAPTION i%,"Couleur:" i%=i%+1: PICTURE i%: PARENT i%,fm%: TOP i%,1: HEIGHT i%,22: WIDTH i%,30 LEFT i%,LEFT(i%-1)+50: COLOR i%,0,0,0: pc% = i% i%=i%+1: PICTURE i%: PARENT i%,fm%: TOP i%,TOP(i%-1)+25: LEFT i%,4: HEIGHT i%,20 WIDTH i%,WIDTH(fm%)-bhf%-5: ON_CLICK i%,Ccout k% = WIDTH(i%)/16 2D_TARGET_IS i% FOR j% = 0 TO 15 SELECT j% CASE 0: 2D_FILL_COLOR 0,0,0: ' Noir CASE 1: 2D_FILL_COLOR 0,0,128: ' Bleu CASE 2: 2D_FILL_COLOR 0,128,0: ' Vert CASE 3: 2D_FILL_COLOR 0,128,128: ' Cyan CASE 4: 2D_FILL_COLOR 128,0,0: ' Rouge CASE 5: 2D_FILL_COLOR 128,0,128: ' Magenta CASE 6: 2D_FILL_COLOR 128,64,0: ' Brun CASE 7: 2D_FILL_COLOR 192,192,192: ' Blanc CASE 8: 2D_FILL_COLOR 128,128,128: ' Gris CASE 9: 2D_FILL_COLOR 0,0,255: ' Bleu clair CASE 10: 2D_FILL_COLOR 0,255,0: ' Vert clair CASE 11: 2D_FILL_COLOR 0,255,255: ' Cyan clair CASE 12: 2D_FILL_COLOR 255,0,0: ' Rouge clair CASE 13: 2D_FILL_COLOR 255,0,255: ' Magenta clair CASE 14: 2D_FILL_COLOR 255,255,0: ' Jaune CASE 15: 2D_FILL_COLOR 255,255,255: ' Blanc intense END_SELECT 2D_RECTANGLE j%*k%,0,(j%+1)*k%-1,HEIGHT(i%) NEXT j% i%=i%+1: MEMO i%: PARENT i%,fm%: TOP i%,TOP(i%-1)+25: WIDTH i%,WIDTH_CLIENT(fm%) HEIGHT i%,100: me% = i% FONT_BOLD_OFF me%: FONT_ITALIC_OFF me%: FONT_UNDERLINE_OFF me% FONT_NAME i%,fnt$: FONT_SIZE i%,sz% i%=i%+1: IMAGE i%: im% = i% i%=i%+1: ALPHA i%: PARENT i%,fm%: TOP i%,TOP(me%)+HEIGHT(me%)+5: LEFT i%,50: FONT_ITALIC i% CAPTION i%,"Cliquer dans le dessin le point d'insertion (coin haut/gauche), puis :" i%=i%+1: ALPHA i%: PARENT i%,fm%: TOP i%,TOP(i%-1)+25: LEFT i%,LEFT(i%-1) CAPTION i%,"X= Y=" i%=i%+1: EDIT i%: PARENT i%,fm%: TOP i%,TOP(i%-1)-2: LEFT i%,LEFT(i%-1)+15: WIDTH i%,45 HEIGHT i%,18: xt% = i% i%=i%+1: EDIT i%: PARENT i%,fm%: TOP i%,TOP(i%-1): LEFT i%,LEFT(i%-1)+65: WIDTH i%,WIDTH(i%-1) HEIGHT i%,18 i%=i%+1: BUTTON i%: PARENT i%,fm%: TOP i%,TOP(i%-1)-3: LEFT i%,LEFT(i%-1)+50 CAPTION i%,"Insérer": ON_CLICK i%,Applix i%=i%+1: CONTAINER i%: PARENT i%,fm%: TOP i%,TOP(i%-1)-4: LEFT i%,LEFT(i%-1)+80 WIDTH i%,140: HEIGHT i%,30: co%=i% i%=i%+1: BUTTON i%: PARENT i%,co%: TOP i%,8: WIDTH i%,25: HEIGHT i%,20: CAPTION i%,CHR$(231) i%=i%+1: BUTTON i%: PARENT i%,co%: TOP i%,TOP(i%-1): WIDTH i%,WIDTH(i%-1) LEFT i%,LEFT(i%-1)+WIDTH(i%-1): HEIGHT i%,HEIGHT(i%-1): CAPTION i%,CHR$(232) i%=i%+1: BUTTON i%: PARENT i%,co%: TOP i%,TOP(i%-1): WIDTH i%,WIDTH(i%-1) LEFT i%,LEFT(i%-1)+WIDTH(i%-1): HEIGHT i%,HEIGHT(i%-1): CAPTION i%,CHR$(233) i%=i%+1: BUTTON i%: PARENT i%,co%: TOP i%,TOP(i%-1): WIDTH i%,WIDTH(i%-1) LEFT i%,LEFT(i%-1)+WIDTH(i%-1): HEIGHT i%,HEIGHT(i%-1): CAPTION i%,CHR$(234) FOR j%=i%-3 TO i%: FONT_NAME j%,"Wingdings": ON_CLICK j%,Shiftx: NEXT j% i%=i%+1: SPIN i%: PARENT i%,co%: TOP i%,TOP(i%-1)-3: WIDTH i%,42 LEFT i%,LEFT(i%-1)+WIDTH(i%-1): POSITION i%,1 i%=i%+1: BUTTON i%: PARENT i%,fm%: TOP i%,TOP(co%)+35: LEFT i%,LEFT(co%) CAPTION i%,"Annuler": ON_CLICK i%,Annulx i%=i%+1: BUTTON i%: PARENT i%,fm%: TOP i%,TOP(i%-1): LEFT i%,LEFT(i%-1)+90 CAPTION i%,"Quitter": ON_CLICK i%,Fsubt i%=i%+1: FORM i%: HIDE i%: BORDER_HIDE i%: TOP i%,TOP(fm%)+160: LEFT i%,LEFT(fm%)+50 WIDTH i%,WIDTH(fn%): HEIGHT i%,500: fp% = i% i%=i%+1: LIST i%: PARENT i%,fp%: FULL_SPACE i%: FONT_NAMES_LOAD i%: ON_CLICK i%,Majpo1 FOR j% = COUNT(i%) TO 1 STEP -1 a$ = ITEM_READ$(i%,j%) IF LEFT$(a$,1)="@" OR LEFT$(a$,3)="WP " THEN ITEM_DELETE i%,j% NEXT j%
2D_TARGET_IS p% w% = WIDTH(p%): h% = HEIGHT(p%): ON_CLICK p%,Positx WHILE fs% = 0: PAUSE 200: END_WHILE DELETE im%: DELETE fp%: DELETE fm%: EXIT_SUB ' ______________________________________________________________________________ Ccout: x% = MOUSE_X_LEFT_DOWN(pc%+1): y% = MOUSE_Y_LEFT_DOWN(pc%+1) r%=COLOR_PIXEL_RED(pc%+1,x%,y%): g%=COLOR_PIXEL_GREEN(pc%+1,x%,y%) b%=COLOR_PIXEL_BLUE(pc%+1,x%,y%): COLOR pc%,r%,g%,b% RETURN ' ______________________________________________________________________________ Cenr: FONT_BOLD_OFF me%: FONT_ITALIC_OFF me%: FONT_UNDERLINE_OFF me%: enr% = 0 IF CHECKED(fn%+2) = 1 THEN FONT_BOLD me%: enr% = enr%+1 IF CHECKED(fn%+3) = 1 THEN FONT_ITALIC me%: enr% = enr%+2 IF CHECKED(fn%+4) = 1 THEN FONT_UNDERLINE me%: enr% = enr%+4 RETURN ' ______________________________________________________________________________ Majpo: SHOW fp% RETURN ' ______________________________________________________________________________ Majpo1: fnt$ = ITEM_INDEX$(fp%+1): TEXT fn%,fnt$: FONT_NAME me%,fnt$ HIDE fp% RETURN ' ______________________________________________________________________________ Majsz: sz% = POSITION(fn%+1): FONT_SIZE me%,sz% RETURN ' ______________________________________________________________________________ Positx: IF COUNT(me%) = 0 THEN RETURN: ' pas de texte x% = MOUSE_X_LEFT_DOWN(p%): y% = MOUSE_Y_LEFT_DOWN(p%) TEXT xt%,STR$(x%): TEXT xt%+1,STR$(y%) 2D_TARGET_IS p%: 2D_IMAGE_COPY im%,0,0,w%,h%: ' sauvegarde fnt$ = TEXT$(fn%): sz% = POSITION(fn%+1) FONT_NAME p%,fnt$: FONT_SIZE p%,sz% FONT_BOLD_OFF p%: FONT_ITALIC_OFF p%: FONT_UNDERLINE_OFF p%: enr% = 0 IF CHECKED(fn%+2) = 1 THEN FONT_BOLD p%: enr% = enr%+1 IF CHECKED(fn%+3) = 1 THEN FONT_ITALIC p%: enr% = enr%+2 IF CHECKED(fn%+4) = 1 THEN FONT_UNDERLINE p%: enr% = enr%+4 a$ = ITEM_READ$(me%,1): wt% = TEXT_WIDTH(a$,p%): hl% = TEXT_HEIGHT(a$,p%): ht%=hl% IF COUNT(me%) > 1 FOR i% = 2 TO COUNT(me%) a$=ITEM_READ$(me%,i%): j%=TEXT_WIDTH(a$,p%): IF j%>wt% THEN wt%=j% ht% = ht%+TEXT_HEIGHT(a$,p%) NEXT i% END_IF 2D_FILL_OFF: 2D_PEN_COLOR 255,0,255: 2D_PEN_WIDTH 2 2D_RECTANGLE x%,y%,x%+wt%,y%+ht% TO_FOREGROUND fm% RETURN ' ______________________________________________________________________________ Applix: 2D_TARGET_IS p%: 2D_IMAGE_PASTE im%,0,0 PRINT_TARGET_IS p%: FONT_NAME p%,fnt$: FONT_SIZE p%,sz%: FONT_COLOR p%,r%,g%,b% FONT_BOLD_OFF p%: FONT_ITALIC_OFF p%: FONT_UNDERLINE_OFF p% IF BIN_AND(enr%,1) = 1 THEN FONT_BOLD p% IF BIN_AND(enr%,2) = 2 THEN FONT_ITALIC p% IF BIN_AND(enr%,4) = 4 THEN FONT_UNDERLINE p% 2D_TARGET_IS p%: 2D_FILL_OFF x% = VAL(TEXT$(xt%)): y% = VAL(TEXT$(xt%+1)) FOR i% = 1 TO COUNT(me%) a$ = ITEM_READ$(me%,i%): PRINT_LOCATE x%,y%: PRINT a$ y% = y%+TEXT_HEIGHT(a$,p%) NEXT i% TO_FOREGROUND fm% RETURN ' ______________________________________________________________________________ Shiftx: i% = NUMBER_CLICK: j% = POSITION(co%+5) x% = VAL(TEXT$(xt%)): y% = VAL(TEXT$(xt%+1)) IF i% = co%+1 THEN x% = x%-j% IF i% = co%+2 THEN x% = x%+j% IF i% = co%+3 THEN y% = y%-j% IF i% = co%+4 THEN y% = y%+j% TEXT xt%,STR$(x%): TEXT xt%+1,STR$(y%) GOSUB Applix RETURN ' ______________________________________________________________________________ Annulx: 2D_TARGET_IS p%: 2D_IMAGE_PASTE im%,0,0 RETURN ' ______________________________________________________________________________ Fsubt: fs% = 1 RETURN END_SUB ' ============================================================================== PS Et je me rends compte que je peux maintenant fêter mes 10 ans d'inscription sur le forum Panoramic ! YOUPI ! ( inscrit la même année que Jack... mais après lui quand même ! ) | |
|