Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Vb Flip (Horizontal and Vertical) Function Code
Vb Flip (Horizontal and Vertical) Function Code
Read an image into a byte array for processing:

Private? Declare? Function? GetBitmapBits? Lib? 《gdi32》? (ByVal? hBitmap? As? Dragon? ByVal? dwCount? As? Dragon? lpBits? As? Any)? As? long

Private? Declare? Function? SetBitmapBits? Lib? 《gdi32》? (ByVal? hBitmap? As? Dragon? ByVal? dwCount? As? Dragon? lpBits? As? Any)? As? long

Private? Declare? Function? GetObject? Lib? 《gdi32》? Alias? “GetObjectA”? (ByVal? Hojett? As? Dragon? ByVal? nCount? As? Dragon? lpObject? As? Any)? As? long

Private? Type? bitmap

bmType? As? long

bmWidth? As? long

bmHeight? As? long

bmWidthBytes? As? long

BM plane? As? integer

bmBitsPixel? As? integer

bmBits? As? long

End? type

Sub? ReverseImage(img? As? StdPicture,? Optional? UpDownOrLeftRight? As? Bull? =? False)

With what? img

Dim? BmpInfo? As? bitmap

GetObject? . Handle? Len(BmpInfo),? BmpInfo

Dim? BytesPixel? As? integer

BytesPixel? =? BmpInfo.bmBitsPixel? /? eight

Dim? Bits()? As? byte

Redim? Bits(BmpInfo.bmWidthBytes? -? 1,? BmpInfo.bmHeight? -? 1)

GetBitmapBits? . Handle? BmpInfo.bmWidthBytes? *? BmpInfo.bmHeight,? Bit (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

What if? UpDownOrLeftRight? then

Dim? rR? As? Integer, sR? As? integer

For what? y? =? BmpInfo.bmHeight? -? 1? Where to? 0? One step? - 1

rR? =? BmpInfo.bmHeight? -? 1? -? Y

For what? x? =? 0? Where to? BmpInfo.bmWidthBytes? -? 1

rBits(X,rR)? =? Bit (x, y)

Next? X

Next? Y

other

Dim? rIndex? As? integer

Dim? Sindex? As? integer

For what? y? =? 0? Where to? BmpInfo.bmHeight? -? 1

For what? x? =? BmpInfo.bmWidth? -? 1? Where to? 0? One step? - 1

Sindex? =? x? *? Byte pixel

rIndex? =? (BmpInfo.bmWidth? -? 1? -? x)? *? Byte pixel

For what? p? =? Sindex? Where to? Sindex? +? 2

rBits(rIndex,y)? =? Bit (p,? y)

rIndex? =? rIndex? +? 1

then

Next? X

Next? Y

End? if

Call? SetBitmapBits(。 Handle? BmpInfo.bmWidthBytes? *? BmpInfo.bmHeight,? rBits(0,0))

End? along with

End? submarine