On Jun 27, 2005, at 6:39 PM, Joel Reymont wrote:
I don't want to do this beforehand to save space so any efficient code
you can send will be appreciated!
You can loop through all of the pixels:
Function FlipHorizontal(source As Picture) As Picture
Dim dest As Picture
Dim rs, rd, rms, rmd As RGBSurface
Dim x, xMax, y, yMax As Integer
If source Is Nil Then Return Nil
If source.Depth < 16 Then
// have to fix the picture so that there is an RGBSurface
// so temporarily use dest to hold the new source
dest = NewPicture(source.Width, source.Height, 32)
dest.Graphics.DrawPicture(source, 0, 0)
source = dest
End If
dest = NewPicture(source.Width, source.Height, 32)
rs = source.RGBSurface
rd = dest.RGBSurface
rms = source.Mask.RGBSurface // RGBSurface for the Mask
rmd = dest.Mask.RGBSurface // RGBSurface for the Mask
xMax = source.Width - 1
yMax = source.Height - 1
// now we flip the pixels
For y = 0 To yMax
For x = 0 To xMax
rd.Pixel(xMax - x, y) = rs.Pixel(x, y)
rmd.Pixel(xMax - x, y) = rms.Pixel(x, y)
Next
Next
Return dest
End Function
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|