Código de función de giro de imagen VB (horizontal y vertical)
¿Privado?Declarar?Función?GetBitmapBits?Lib?"gdi32"?(ByVal?hBitmap?As?Long, ByVal?dwCount?As?Long, lpBits ?¿Como?Cualquiera)?Como?Long
¿Privado?Declarar?Función?SetBitmapBits?Lib?"gdi32"?(ByVal?hBitmap?As?Long,?ByVal?dwCount?As?Long,?lpBits ?¿Como?¿Cualquiera)?¿Como?Long
¿Privado?¿Declarar?Función?GetObject?Lib?¿Un alias para "gdi32"? GetObjectA"?(ByVal?hObject?As?Long,?ByVal?nCount?As?Long,?lpObject?As?Any)?As?Long
¿Privado?Tipo?Bitmap
bmType?As?Long
bmWidth?As?Long
bmHeight?As?Long
bmWidthBytes?As?Long
bmPlanos ?As?Integer
bmBitsPixel?As?Integer
bmBits?As?Long
End?Type
Sub?ReverseImage(img ?Como?StdPicture,?Optional?UpDownOrLeftRight?As?Boolean?=?False)
Con?img
Dim?BmpInfo?As?Bitmap
GetObject .Handle,?Len(BmpInfo),?BmpInfo
Dim?BytesPixel?As?Integer
BytesPixel?=?BmpInfo.bmBitsPixel?/?8
Dim?Bits()?As?Byte
ReDim?Bits(BmpInfo.bmWidthBytes?-?1,?BmpInfo.bmHeight?-??1)
GetBitmapBits.Handle,? BmpInfo.bmWidthBytes?*?BmpInfo.bmHeight,?Bits(0,?0)
Dim?rBits()?As?Byte
ReDim?rBits(BmpInfo.bmWidthBytes?- ?1, BmpInfo.bmHeight?-?1)
Dim?Y?As?Integer, ?X?As?Integer
Dim?p?As?Integer
Si?UpDownOrLeftRight?Entonces
Dim?rR? es un número entero y sR es un número entero
For?Y?=?BmpInfo.bmHeight?-?1?to ?0 ?Paso?-1
rR?=?BmpInfo.bmHeight?-?1?-?Y
Para?X?=?0?to?BmpInfo.bmWidthBytes? -?
p>rBits(X,?rR)?=?Bits(X,?Y)
¿Siguiente?X
Siguiente?Y
Si no
Dim?rIndex?As?Integer
Dim.sIndex?As?Integer
For?Y?=?0?To?BmpInfo.bmHeight?-?1
Para?X?=?BmpInfo.bmWidth?-?1?A?0?Step?-1
sIndex?=?X?*?BytesPixel
rIndex?=?(BmpInfo.bmWidth?-?1?-?X)?*?BytesPixel
Para?p?=?sIndex?To?sIndex?2
rBits(rIndex,?Y)? =?Bits(p,?Y)
rIndex?=?rIndex ?1
Siguiente
Siguiente?X
¿Siguiente?Si
Llamar a SetBitmapBits(.Handle,?BmpInfo.bmWidthBytes?*?BmpInfo.bmHeight,?rBits(0,?0))
¿Fin?