Page 2 sur 2

Re: Ar-S FX - Manipulation d'images

Publié : mar. 26/mars/2013 18:37
par Ar-S
Je pensais simplement que Redim était obligatoire :!:
Mais alors à quoi sert ReDIM 8O ?
Son intérêt est d'uniquement réduire un tableau (si besoin) alors ?

Re: Ar-S FX - Manipulation d'images

Publié : mar. 26/mars/2013 18:44
par Ar-S
je teste une version avec tableau à 2 dim.

Certains effets ne passent plus, je pige pas pourquoi.
P.S : ajout de l'effet Mixer les pixel (pour obtenir un 'bruit')

Code : Tout sélectionner

; Ar-S FX Lib 1.1 - Multi Effets sur image par Ar-S // 2013
UsePNGImageDecoder()
UsePNGImageEncoder()

Enumeration 10
      #IMG_ORIGINALE     ; Image originale
      #IMAGE_FX               ; Image cible
      #IMAGE_FX_90         ; pour l'image retournée qui nécessitera une taille différente de l'originale
EndEnumeration

#Image_Flip_X               = 1
#Image_Flip_Y               = 2
#Image_Rotate_90L      = 3
#Image_Rotate_90R     = 4
#Image_2colors             = 5
#Image_Gray                 = 6
#Image_Mirror_L            = 7
#Image_Mirror_R           = 8
#Image_Rotate_180      = 9
#Image_MixPixel           = 10

Declare   StockPixelTab(IMG)
Declare MixPixel()
Declare ARS_FX(IMG, FX)

Lwin = 741 : Hwin = 480
Global Canvas_MAX_L = Lwin - 101
Global Canvas_MAX_H = Hwin

Global Dim TabPixel(1,1)
Global Dim TabMix(1,1)

Global Diff = 54

 ; ********Exemple********** 
 ; ********************* PROGRAMME ********************** 
  
  LoadImage(#IMG_ORIGINALE,GetCurrentDirectory()+"pb.png")
  
  CreateImage(#IMAGE_FX, ImageWidth(#IMG_ORIGINALE), ImageHeight(#IMG_ORIGINALE))
  CreateImage(#IMAGE_FX_90, ImageHeight(#IMG_ORIGINALE), ImageWidth(#IMG_ORIGINALE))    
      
  StockPixelTab(#IMG_ORIGINALE)
  
  
 hwnd = OpenWindow(0, #PB_Any, #PB_Any, Lwin, Hwin, "Image FX Lib by Ar-S // 2013", #PB_Window_MinimizeGadget|#PB_Window_TitleBar|#PB_Window_ScreenCentered)

  StickyWindow(0,1)
  Clic = 0 
  Clac = 0
  
      CanvasGadget(1, 101, 1,  Canvas_MAX_L, Canvas_MAX_H , #PB_Canvas_DrawFocus|#PB_Canvas_ClipMouse)
      StartDrawing(CanvasOutput(1))
            DrawingMode(#PB_2DDrawing_AlphaBlend)
            Box(0,0, Canvas_MAX_L, Canvas_MAX_H, $FFFFFF)
            DrawingMode(#PB_2DDrawing_Transparent)
            DrawText(5,5, "Vide", $0)
      StopDrawing()
      
 ButtonGadget(2,1,1,100,29,"Image originale")
 ButtonGadget(3,1,30,100,29,"Niveau de Gris")
 ButtonGadget(4,1,60,100,29,"2 Couleurs ") 
 
 TrackBarGadget(5, 45, 90, 20, 100, 0, 255, #PB_TrackBar_Vertical)
 
 ButtonGadget(6,1,200,100,29,"Rotation 180° ") 
 ButtonGadget(7,1,230,100,29,"Sym Verticale ") 
 ButtonGadget(8,1,260,100,29,"Sym Horizontale ") 
 ButtonGadget(9,1,290,100,29,"90° gauche") 
 ButtonGadget(10,1,320,100,29,"Miroir Droite") 
 ButtonGadget(11,1,350,100,29,"Mixer les pixels") 
 
 SetGadgetState(5, Diff)

 
; ************ EVENT et BOUCLE ********************** 
 
  Repeat
    
    Select WaitWindowEvent()
    
          Case #PB_Event_Gadget

                Select EventGadget()

                        Case 2 ; Voir Image originale

                                    StartDrawing(CanvasOutput(1))
                                          DrawingMode(#PB_2DDrawing_AlphaBlend)
                                          DrawImage(ImageID(#IMG_ORIGINALE),0,0)
                                          DrawingMode(#PB_2DDrawing_Transparent)
                                          DrawText(5,5, "Image originale", $0)
                                    StopDrawing()
                                    

                         
                        Case 3  ; Voir Image GRIS

                              ARS_FX(#IMAGE_FX, #Image_Gray)
                                                            
                              StartDrawing(CanvasOutput(1))
                                    DrawingMode(#PB_2DDrawing_AlphaBlend)
                                     DrawImage(ImageID(#IMAGE_FX),0,0)
                                     DrawingMode(#PB_2DDrawing_Transparent)
                                    DrawText(5,5, "Image Gray", $0)
                              StopDrawing()
                              
                              
                         Case 4 ; Voir image 2 COL
                              
                              start = ElapsedMilliseconds()
                               ARS_FX(#IMAGE_FX, #Image_2colors)
                              endms = ElapsedMilliseconds() - start
                              
                              Debug   endms                    
                                                            
                              StartDrawing(CanvasOutput(1))
                                    DrawingMode(#PB_2DDrawing_AlphaBlend)
                                     DrawImage(ImageID(#IMAGE_FX),0,0)
                                     DrawingMode(#PB_2DDrawing_Transparent)
                                    DrawText(5,5, "Image 2 col : Diff = "+Str(Diff), $0)
                              StopDrawing()
;                       
                      Case 5 ; Réglage de l'intensité (valeur de Diff) via la trackbar en mode 2 couleurs
                              
                              Diff = GetGadgetState(5)
                              
                               ARS_FX(#IMAGE_FX, #Image_2colors)
                              StartDrawing(CanvasOutput(1))
                                    DrawingMode(#PB_2DDrawing_AlphaBlend)
                                     DrawImage(ImageID(#IMAGE_FX),0,0)
                                     DrawingMode(#PB_2DDrawing_Transparent)
                                    DrawText(5,5, "Image 2 col : Diff = "+Str(Diff), $0)
                              StopDrawing()
                      
                        
                         Case 6 ; Rotation 180 °
                         
                               ARS_FX(#IMAGE_FX, #Image_Rotate_180)
                              
                              StartDrawing(CanvasOutput(1))
                                    DrawingMode(#PB_2DDrawing_AlphaBlend)
                                     DrawImage(ImageID(#IMAGE_FX),0,0)
                                     DrawingMode(#PB_2DDrawing_Transparent)
                                    DrawText(105,ImageHeight(#IMAGE_FX)-30, "Rotation 180°", $0)
                              StopDrawing()
                         
                         Case 7 ; Symétrie Verticale
                         
                              ARS_FX(#IMAGE_FX, #Image_Flip_Y)
                              
                              StartDrawing(CanvasOutput(1))
                                    DrawingMode(#PB_2DDrawing_AlphaBlend)
                                     DrawImage(ImageID(#IMAGE_FX),0,0)
                                     DrawingMode(#PB_2DDrawing_Transparent)
                                    DrawText(5,ImageHeight(#IMAGE_FX)-30, "Symétrie Verticale", $0)
                              StopDrawing()
                              
                         Case 8  ; Symétrie Horizontale
                         
                              ARS_FX(#IMAGE_FX, #Image_Flip_X)
                              
                              StartDrawing(CanvasOutput(1))
                                    DrawingMode(#PB_2DDrawing_AlphaBlend)
                                     DrawImage(ImageID(#IMAGE_FX),0,0)
                                     DrawingMode(#PB_2DDrawing_Transparent)
                                    DrawText(105,5, "Symétrie Horizontale", $0)
                                    
                              StopDrawing()     
                              
                        Case 9  ; Rotation 90° de l'image 
                              
                              If clic = 0    
                                                 
                              ARS_FX(#IMAGE_FX_90, #Image_Rotate_90L)
                              clic +1
                              SetGadgetText(9, "90° Droite")
                              
                               Else
                               
                               ARS_FX(#IMAGE_FX_90, #Image_Rotate_90R)  
                              clic = 0
                               SetGadgetText(9, "90° Gauche")
                               EndIf
                               
                               
                              StartDrawing(CanvasOutput(1))
                                    Box (0,0,GadgetWidth(1), GadgetHeight(1),$FFFFFF)
                                    DrawingMode(#PB_2DDrawing_AlphaBlend)
                                    DrawImage(ImageID(#IMAGE_FX_90),0,0)
                                    DrawingMode(#PB_2DDrawing_Transparent)
                                    DrawText(105,5, "Rotation 90°", $0)
                              StopDrawing() 
                              
                              
                         Case 10  ; Mirroring
                              
                               If Clac = 0    
                               
                                    
                               ARS_FX(#IMAGE_FX, #Image_Mirror_L)
                               Clac +1
                              MirTXT.s = " Droite"   
                              SetGadgetText(10, "Miroir Gauche") 
                              
                              Else
                              
                              ARS_FX(#IMAGE_FX, #Image_Mirror_R)
                              Clac = 0
                                 
                              MirTXT.s = " Gauche"       
                              SetGadgetText(10, "Miroir Droite") 
                              EndIf

                              StartDrawing(CanvasOutput(1))
                                    DrawingMode(#PB_2DDrawing_AlphaBlend)
                                     DrawImage(ImageID(#IMAGE_FX),0,0)
                                     DrawingMode(#PB_2DDrawing_Transparent)
                                    DrawText(105,5, "Miroir" +MirTXT, $0)
                              StopDrawing()     
                          
                          
                        Case 11  ; Mixer les Pixels  
                                   
                               MixPixel()
                               ARS_FX(#IMAGE_FX, #Image_MixPixel)
                                   
                               StartDrawing(CanvasOutput(1))
                                    DrawingMode(#PB_2DDrawing_AlphaBlend)
                                     DrawImage(ImageID(#IMAGE_FX),0,0)
                                     DrawingMode(#PB_2DDrawing_Transparent)
                                    DrawText(5,ImageHeight(#IMAGE_FX)-30, "Mixer les pixels", $0)
                              StopDrawing()
                                   
                                   
                                   
                              
                  EndSelect            
 
            Case #PB_Event_CloseWindow
                  Select EventWindow()
                        Case 0
                        quite=1
                  EndSelect
        
        
    EndSelect
    
        
  Until quite=1
  

      For i = #IMG_ORIGINALE To #IMAGE_FX_90 
            If IsImage(i)
                   FreeImage(i)
            EndIf
      Next
End
     
     
     
     
     
     
     
; ************ PROCEDURES **********************     
     
     
Procedure StockPixelTab(IMG)
Protected Couleur

DimX = ImageWidth(IMG)
DimY = ImageHeight(IMG)

Dim TabPixel(DimX, DimY)
Dim TabMix( DimX,DimY )

StartDrawing(ImageOutput(IMG))

For y = 0 To DimY-1
      For x = 0 To DimX-1
      
                  TabPixel(x,y) = Point (x,y)
                      
      Next x
Next y      

StopDrawing()

EndProcedure

Procedure MixPixel()

Dim TabMix (ArraySize (TabPixel(),1 ), ArraySize (TabPixel(),2) )
CopyArray(TabPixel(), TabMix())
RandomizeArray(TabMix())

EndProcedure


Procedure ARS_FX(IMG, FX)
; Effets multiples sur image.

Protected Image_Grab

If IsImage(IMG) = 0
      ProcedureReturn 0
EndIf      


StartDrawing(ImageOutput(IMG))
DrawImage(ImageID(IMG),0,0)

Select FX

      Case #Image_2colors
            
            For y = 0 To ImageHeight(IMG)-1
                  For x = 0 To ImageWidth(IMG)-1
                              
                              Couleur = TabPixel(x,y)
                              R = Red(Couleur)
                              G = Green(Couleur)
                              B = Blue(Couleur)
                              Gray = (R+G+B)/3
                              
                              If Gray >=  Diff
                                    Gray = 255
                              Else
                                    ;Gray = (R+G+B)/3            ; Blanc jusqu'à niveau de gris
                                    Gray = 10                           ; Blanc jusqu'à (presque) noire
                              EndIf
            
                                                       
                              NewCOLOR = RGBA(Gray,Gray,Gray,255)  
                              
                              Plot (x, y , NewCOLOR)               
            
                  Next x
            Next y      
      
      Case #Image_Flip_X
       
            For y = 0 To ImageHeight(IMG)-1
                  For x = ImageWidth(IMG)-1 To 0 Step -1 
            
                              Plot (x, y , TabPixel(x,y))

                  Next x
            Next y 
      
      Case #Image_Flip_Y
      
            For y = ImageHeight(IMG)-1 To 0 Step -1
                  For x = 0 To ImageWidth(IMG)-1 

                               Plot (x, y , TabPixel(x,y))
            
                  Next x
            Next y 
      
      
      Case #Image_Gray
      
            For y = 0 To ImageHeight(IMG)-1
                  For x = 0 To ImageWidth(IMG)-1
                      
                        R = Red(TabPixel(x,y))
                        G = Green(TabPixel(x,y))
                        B = Blue(TabPixel(x,y))
                        Gray = (R+G+B) / 3
                        Plot (x, y , RGBA(Gray, Gray, Gray, 255))

                  Next x
            Next y      
      
      Case #Image_Mirror_R
            
            Image_Grab = GrabImage(#IMG_ORIGINALE, #PB_Any, 0, 0, ImageWidth(IMG) / 2, ImageHeight(IMG))

                  Box (0,0,ImageWidth(IMG), ImageHeight(IMG))
                  DrawImage(ImageID(Image_Grab),0,0)

                  For y = 0 To ImageHeight(IMG)-1
                        For x = ImageWidth(IMG)-1 To 0 Step -1 
            
                               Plot (x, y , TabPixel(x,y))

                        Next x
                  Next y 
    
                  DrawImage(ImageID(Image_Grab),0,0)
                  FreeImage(Image_Grab)
                  
            
      Case #Image_Mirror_L
      
            Image_Grab = GrabImage(#IMG_ORIGINALE, #PB_Any, ImageWidth(IMG) /2, 0, ImageWidth(IMG) / 2, ImageHeight(IMG))
            Box (0,0,ImageWidth(IMG), ImageHeight(IMG))
            DrawImage(ImageID(Image_Grab),ImageWidth(IMG) /2 ,0)
      
            For y = 0 To ImageHeight(IMG)-1
                  For x = ImageWidth(IMG)-1 To 0 Step -1 
            
                              Plot (x, y , TabPixel(x,y))

                  Next x
            Next y 
      
            DrawImage(ImageID(Image_Grab),ImageWidth(IMG) /2 ,0)
            FreeImage(Image_Grab)
       
       Case #Image_Rotate_180

             For y = ImageHeight(IMG)-1 To 0 Step -1
                  For x = ImageWidth(IMG)-1 To 0 Step -1
                              
                              Plot (x, y , TabPixel(x,y))

                  Next x
            Next y        
            
            
       Case #Image_Rotate_90L        

      For x = 0 To ImageWidth(IMG)-1
            For y =  ImageHeight(IMG)-1 To 0 Step -1

                              Plot (x, y , TabPixel(y,x))

            Next y
      Next x
       
       
       Case #Image_Rotate_90R

       For x = ImageWidth(IMG)-1 To 0 Step -1
            For y =  0 To ImageHeight(IMG)-1

                               Plot (x, y , TabPixel(y,x))
                    
            Next y
      Next x
       
      Case #Image_MixPixel
            For y = 0 To ImageHeight(IMG)-1
                  For x = ImageWidth(IMG)-1 To 0 Step -1 
            
                         Plot (x, y , TabMix(x,y))                    
            
                  Next x
            Next y 
            FreeArray(TabMix())
             
      Default 
      
            StopDrawing()
            ProcedureReturn 0
      
EndSelect
      
 StopDrawing()

ProcedureReturn 1

EndProcedure


Re: Ar-S FX - Manipulation d'images

Publié : mar. 26/mars/2013 19:01
par Backup
puisqu tu as mis tes tableaux en global

dans ta procedure passe les aussi en global

Dim TabPixel(DimX, DimY)
Dim TabMix( DimX,DimY )

sinon ceux de la procedure sont different de celui qui est en dehors ..

a moins de faire dans ta procedure :

Shared Dim TabPixel(DimX, DimY)
Shared Dim TabMix( DimX,DimY )

c'est comme pour les variable , une Variable Global 'A' en dehors de la procedure n'est pas la meme que 'A' local a la procedure ...(du moins il me semble )

[reedit]

non ,(j'ai eu du monde a la maison , j'etais pas concentré :lol: )

en fait si c'est déclaré Global tout devrai etre accessible en dehor et en dedans d'une procedure ..
ne tiens pas compte de ce que j'ai ecris :oops:

Re: Ar-S FX - Manipulation d'images

Publié : mer. 27/mars/2013 10:39
par Ar-S
Oui c'est ce qui me semblait, du coup je suis toujours uvec un tab à 2 dim et mes effets qui ne marchent plus au complet... super :?

Re: Ar-S FX - Manipulation d'images

Publié : mer. 27/mars/2013 11:36
par Backup
Ligne 43 , il n'y a rien qui te choque ?

là :

Code : Tout sélectionner

 CreateImage(#IMAGE_FX, ImageWidth(#IMG_ORIGINALE), ImageHeight(#IMG_ORIGINALE))
  CreateImage(#IMAGE_FX_90, ImageHeight(#IMG_ORIGINALE), ImageWidth(#IMG_ORIGINALE))    
au fait , ici , il n'y a rien qui te choque ?

Code : Tout sélectionner

			Case #Image_Flip_X
			
			For y = 0 To ImageHeight(IMG)-1
				For x = ImageWidth(IMG)-1 To 0 Step -1
					
					Plot (x, y , TabPixel(x,y))
	
					
				Next x
			Next y
:lol:
tu fais quoi la ? hein ? :mrgreen:

Re: Ar-S FX - Manipulation d'images

Publié : mer. 27/mars/2013 12:11
par Ar-S
Dobro a écrit :Ligne 43 , il n'y a rien qui te choque ?

là :

Code : Tout sélectionner

 CreateImage(#IMAGE_FX, ImageWidth(#IMG_ORIGINALE), ImageHeight(#IMG_ORIGINALE))
  CreateImage(#IMAGE_FX_90, ImageHeight(#IMG_ORIGINALE), ImageWidth(#IMG_ORIGINALE))    
Non rien qui me choque ici, vu que je vais retourner l'image à 90° il faut bien que je prépare une image ou largeur et hauteur seront inversées... 8)

Dobro a écrit : au fait , ici , il n'y a rien qui te choque ?

Code : Tout sélectionner

			Case #Image_Flip_X
			
			For y = 0 To ImageHeight(IMG)-1
				For x = ImageWidth(IMG)-1 To 0 Step -1
					
					Plot (x, y , TabPixel(x,y))
	
					
				Next x
			Next y
:lol:
tu fais quoi la ? hein ? :mrgreen:
Bah je ne vois pas non plus, vu que je prends mes pixels x de la fin vers le début pour l'effet miroir.

Re: Ar-S FX - Manipulation d'images

Publié : mer. 27/mars/2013 12:12
par Backup
Ar-S a écrit :
Dobro a écrit :Ligne 43 , il n'y a rien qui te choque ?

là :

Code : Tout sélectionner

 CreateImage(#IMAGE_FX, ImageWidth(#IMG_ORIGINALE), ImageHeight(#IMG_ORIGINALE))
  CreateImage(#IMAGE_FX_90, ImageHeight(#IMG_ORIGINALE), ImageWidth(#IMG_ORIGINALE))    
Non rien qui me choque ici, vu que je vais retourner l'image à 90° 8)

Dobro a écrit : au fait , ici , il n'y a rien qui te choque ?

Code : Tout sélectionner

			Case #Image_Flip_X
			
			For y = 0 To ImageHeight(IMG)-1
				For x = ImageWidth(IMG)-1 To 0 Step -1
					
					Plot (x, y , TabPixel(x,y))
	
					
				Next x
			Next y
:lol:
tu fais quoi la ? hein ? :mrgreen:
Bah je ne vois pas non plus, vu que je prends mes pixels x de la fin vers le début pour l'effet miroir.

c'est pas plutot ça ?

Code : Tout sélectionner

Case #Image_Flip_X
			
			For y = 0 To ImageHeight(IMG)-1
				For x = 0 to ImageWidth(IMG)-1  ;ImageWidth(IMG)-1 To 0 Step -1					
					Plot ((ImageWidth(IMG)-1)-x, y , TabPixel(x,y))					
				Next x
			Next y
ta methode concistait a dessiner de la droite vers la gauche , et a poser les meme pixel au mem endroit
simplement au lieu de dessiner ton image de la gauche vers la droite , tu inversais .. mais l'image restait la meme !

il faut prendre les pixel de droite ET LES POSER a Gauche ;)
:roll: :lol: :lol:

pour le Vertical :

Code : Tout sélectionner

Case #Image_Flip_Y
			
			For y = 0 to ImageHeight(IMG)-1
				For x = 0 To ImageWidth(IMG)-1
					
					Plot (x, (ImageHeight(IMG)-1)-y , TabPixel(x,y))
					
				Next x
			Next y

Re: Ar-S FX - Manipulation d'images

Publié : mer. 27/mars/2013 12:22
par Ar-S
En faisant

Code : Tout sélectionner

           
For y = 0 To ImageHeight(IMG)-1
        For x = ImageWidth(IMG)-1 To 0 Step -1 
                  Plot ((ImageWidth(IMG)-1)-x, y , TabPixel(x,y))    
        Next x
Next y
ça marche aussi. je m'étais effectivement embrouillé dans mes coords merci.
Je vais regarder les autres, le problème doit être similaire.
Par contre tu es bien d'accord que mon createimage L x H => H x L est logique ?

----edit----
Arf tu as répondu avant la fin de ma réponse :)

---edit 2----

nikel je peaufine et mets à jour le code en 1er topic ensuite

Re: Ar-S FX 1.1 - Manipulation d'images

Publié : mer. 27/mars/2013 12:42
par Ar-S
code fonctionnel topic 1 :D

Re: Ar-S FX 1.1 - Manipulation d'images

Publié : mer. 27/mars/2013 14:11
par MLD
@ Ar-S

Comme tu me semble un peu patiné avec les tableaux, voici une petite routine que j'utilise régulièrement pour tier de manière ultra rapide un tableau avec le nombre de colonne de ton choix :lol:
Amuse toi bien :wink:

Code : Tout sélectionner

Global maxtab = 5000

Dim tabpos(5000,5000)
;------ test
For x=1 To 5000
tabpos(x,2) = x
Next 

For x=1 To 1500
tabpos(x,1) =  x +15
Next 

For x=1501 To 3000
tabpos(x,1) =  x +22
Next 
For x=3001 To 5000
tabpos(x,1) =  x +11
Next 
;------------fin test
I = maxtab  / 2
While I > 0
t = maxtab  - I
Repeat
p = 0
  For n = 1 To t
   tr1.l = tabpos(1,n)
   tr2.l = tabpos(1,(n +I))
   If tr1.l < tr2.l ; pour trier dans l'autre sens faite >
    swp1.l = tabpos(1, n)
    tabpos(1, n) = tabpos(1,(n) + I )
    tabpos(1,(n) + I) = swp1.l
    swp2.l = tabpos(2, n); pour ajouté une colonne ajoutez ce code en remplaçant les 2 par des 3 ect
    tabpos(2,n) = tabpos(2,(n) + I);*************
    tabpos(2,(n) + I) = swp2.l; fin pour une colonne sup
    p = n
   EndIf
  Next 
t = p - I 
Until  p = 0
I = I / 2
Wend 
;----résultat
For y =1 To maxtab 
Debug Str(tabpos(y,2)) + "  " +  Str(tabpos(y,1))
Next


Re: Ar-S FX 1.1 - Manipulation d'images

Publié : dim. 31/mars/2013 8:41
par ICE
Plz try this one too (PB wrapper for GBX):
http://www.morty-productions.de/icesoft ... icalDLL%29

Image

Re: Ar-S FX 1.1 - Manipulation d'images

Publié : dim. 31/mars/2013 11:38
par Ar-S
Il y a des effets sympas, j'aime shift et Oil.
n'hésite pas à partager leurs sources.

some cool FX, i like Shift and oil. ;)
Don't hesitate to share these sources codes :)

Re: Ar-S FX 1.1 - Manipulation d'images

Publié : lun. 01/avr./2013 12:33
par G-Rom
pour manipuler des pixels dans un tableau a une dimension :

Code : Tout sélectionner

width.l  = 0
height.l = 0
Dim image.c(0)


Macro resize_image(w,h)
  ReDim image( (w*4) * (h*4) )
  width   = w
  height  = h
EndMacro

Macro set_pixel(x,y,color)
  PokeL(@image( ((x*4) * width + (y*4))),color)
EndMacro

Macro get_pixel(x,y)
  PeekL( @image( ((x*4) * width + (y*4))) )
EndMacro


resize_image(1,1)
set_pixel(0,0, RGBA(255,128,64,32))
color = get_pixel(0,0)

Debug Red(color)
Debug Green(color)
Debug Blue(color)
Debug Alpha(color)

Re: Ar-S FX 1.1 - Manipulation d'images

Publié : lun. 01/avr./2013 13:23
par Backup
niveau vitesse c'est vraiment plus rapide ?

j'avais hésité lorsque tu m'en a parlé sur le Topic de "Barbouille"
d'autant que la vitesse n'etait pas une priorité , on est deja obligé de ralentir pour voir le dessin se faire :lol:

Re: Ar-S FX 1.1 - Manipulation d'images

Publié : lun. 01/avr./2013 15:55
par falsam
@ICE : Thanks for sharing but GBX_include.pbi is not compatible with version 5.10 of PureBasic. We need to change the declaration of pointers.