0

我想知道如何添加倒置渐变反射,类似于:

iPhone 反射

我会首先理论上将位图倒置。然后,在 Photoshop 中,我会为图像添加一个 alpha 蒙版,从上到下的黑色/白色渐变。

如何在 VB.NET 中添加 alpha 蒙版/渐变组合?我似乎找不到任何功能来做到这一点。

4

1 回答 1

0

这是一种使用方法Bitmaps

Dim bm_src1 As Bitmap = CType(pb1.Image.Clone, Bitmap)
Dim bm_out As New Bitmap(bm_src1.Width, bm_src1.Height)
Using gr As Graphics = Graphics.FromImage(bm_out)
  'Flip image
  gr.TranslateTransform(CSng(bm_src1.Width / 2), CSng(bm_src1.Height / 2))
  gr.RotateTransform(180)
  gr.TranslateTransform(-CSng(bm_src1.Width / 2), -CSng(bm_src1.Height / 2))
  ' Give the images alpha gradients.
  Dim alpha As Integer
  For x As Integer = 0 To bm_src1.Width - 1
    For y As Integer = 0 To bm_src1.Height - 1
      alpha = (255 * y) \ bm_src1.Height
      Dim clr As Color = bm_src1.GetPixel(x, y)
      clr = Color.FromArgb(alpha, clr.R, clr.G, clr.B)
      bm_src1.SetPixel(x, y, clr)
    Next
  Next
  ' Draw the images onto the result.
  gr.DrawImage(bm_src1, 0, 0)
End Using
' Display the result.
pbResult.Image = bm_out 'picturebox output
于 2013-05-03T18:25:01.960 回答