Tableau et 2DDrawing

Vous débutez et vous avez besoin d'aide ? N'hésitez pas à poser vos questions
Ekim
Messages : 215
Inscription : dim. 24/juin/2018 1:20

Tableau et 2DDrawing

Message par Ekim »

Bonjours à tous

J'ai un souci du style raisonnement logique :oops:

je souhaiterais tout simplement décaler de quelques pixels vers la droite une image se trouvant dans un tableau

mais mon code ne fonctionne pas comme il le devrait pourtant, j'ai beau raisonner simplement durant 3 jours sur ce problème mais rien n'y fait

Code : Tout sélectionner



UseJPEGImageDecoder()
UsePNGImageDecoder()

pic$ = OpenFileRequester("Image indexe",pic$,"",0)

imgx=1000 
imgy=600 

TailleMax = imgx*imgy


Dim TabPic(imgx,imgy)


If OpenWindow(0, 0, 0, imgx+50, imgy+50, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
	
	If LoadImage(0,pic$)
		ResizeImage(0,imgx,imgy,#PB_Image_Smooth)
		
		If CreateImage(1,imgx,imgy,32)
			StartDrawing(ImageOutput(1))
				DrawImage(ImageID(0),0,0)
				
				For x=0 To imgx-1
					For y=0 To imgy-1
						Color1 = Point(x,y)
						TabPic(x,y) = Color1 
					Next y
				Next x
			StopDrawing() 
		EndIf

		;Partie interessante

		If CreateImage(2,imgx,imgy,32)
			StartDrawing(ImageOutput(2))
				
				For x1=30 To imgx-1 ;x1 à 30 pour décaler 
					For y1=0 To imgy-1
						
						Clr2 = TabPic(x1,y1)
						
						Plot(x1,y1,Clr2)
					Next y1
				Next x1
			StopDrawing() 
			
			ImageGadget(0, 0, 0, imgx, imgy, ImageID(2),#PB_Image_Raised)
			
		EndIf
	EndIf
	
	Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
EndIf


j'ai fait passer x1 à 30 pour décaler mais sa ne fonctionne pas, au lieu de ça, sa rogne limage et c'est dommage car ce n'est pas logique((

j'attends vos points de vue avec impatience car pour le coup je serais vraiment étonné que vous réussissiez :wink:
Starwolf20
Messages : 10
Inscription : mar. 01/sept./2009 18:39

Re: Tableau et 2DDrawing

Message par Starwolf20 »

peut être comme ca ?

Code : Tout sélectionner

      ;Partie interessante

      If CreateImage(2,imgx,imgy,32)
         StartDrawing(ImageOutput(2))
            Decalage=100
            For x1=0 To imgx-1-decalage ;x1 à 100 pour décaler
               For y1=0 To imgy-1
                  
                  Clr2 = TabPic(x1+decalage,y1)
                  
                  Plot(x1,y1,Clr2)
               Next y1
            Next x1
         StopDrawing()
         
         ImageGadget(0, 0, 0, imgx, imgy, ImageID(2),#PB_Image_Raised)
         
      EndIf
Ekim
Messages : 215
Inscription : dim. 24/juin/2018 1:20

Re: Tableau et 2DDrawing

Message par Ekim »

Excellent, en fait c'était encore plus simple, j'ai honte :oops:
Merci @Starwolf20
:wink:
Répondre