Mirror Image ?

BlitzMax Forums/BlitzMax Programming/Mirror Image ?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

hi :)

This program seem don't work with the last blitmax version ?
or i'm wrong ?

http://www.blitzbasic.com/codearcs/codearcs.php?code=19


Graphics 640,480

Global ImageFond1=LoadImage("image1.jpg")
Global ImageDest=mirrorImage(ImageFond1)

While Not KeyHit(KEY_ESCAPE)
	Cls
	SetColor 255,255,255
	SetAlpha 1.0
	
	DrawImage ImageFond1,10,10
	DrawImage ImageDest,10,25
	
	Flip 
Wend

Function mirrorImage:TImage(img:TImage)
   Local a:Int
   Local r:Int
   Local g:Int
   Local b:Int
   Local i:Int
   Local j:Int
   Local argb:Int

   Local pixmap:TPixmap = LockImage(img)
   pixmap = ConvertPixmap(pixmap,PF_RGBA8888)
   pixmap = YFlipPixmap(pixmap)

   For i = 0 To PixmapWidth(pixmap)-1
      For j = 0 To PixmapHeight(pixmap)-1
         argb = ReadPixel(pixmap,i,j)
         a:Int = Int(76.0*(1.0-((Float(j)/Float(ImageHeight(img))))))
         If (argb Shr 24) = 0 Then a = 0

         r:Int = (argb Shr 16) & $ff
           g:Int = (argb Shr 8)  & $ff
           b:Int = argb & $ff
         argb = a*$1000000 + r*$10000 + g*$100 + b
         WritePixel pixmap,i,j,argb
      Next
   Next

   Return LoadImage(pixmap)
EndFunction