-3

次の C# コードに相当する VB.net を教えてください。

internal static unsafe void DistortedDraw(byte* sourceBuffer, Bitmap displacementMap, Bitmap destBitmap) {
        int sourceWidth = destBitmap.Width, sourceHeight = destBitmap.Height;
        BitmapData previewData = destBitmap.LockBits(new Rectangle(0, 0, sourceWidth, sourceHeight), ImageLockMode.WriteOnly, destBitmap.PixelFormat);
        int sourceDataStride = previewData.Stride;
        int sourceBPP = destBitmap.PixelFormat.ToString().Contains("16") ? 2 : destBitmap.PixelFormat.ToString().Contains("24") ? 3 : destBitmap.PixelFormat.ToString().Contains("32") ? 4 : 0;

        if (displacementMap == null) {
            unsafe {
                byte* previewScan0 = (byte*)previewData.Scan0;
                byte* sourceScan0 = (byte*)sourceBuffer;
                for (int y = 0, yofs = 0, invyofs = (sourceHeight - 1 - y) * sourceDataStride; y < sourceHeight; y++, yofs += sourceDataStride, invyofs -= sourceDataStride) {
                    for (int x = 0; x < sourceDataStride; x += 4) {
                        *(int*)(previewScan0 + yofs + x) = *(int*)(sourceScan0 + invyofs + x);
                    }
                }
            }
        } 
        destBitmap.UnlockBits(previewData);
    }

ありがとう。

4

1 に答える 1