神奇的小程序

无聊, 就写了这个程序。

Imports System.Drawing

Module Module1

    Const Src = "hello.bmp", Bg = "xing.bmp", Des = "love.bmp"

    Dim SrcImg As Bitmap = Bitmap.FromFile(Src),
        BgImg As Bitmap = Bitmap.FromFile(Bg),
        DesImg As New Bitmap(SrcImg.Width, SrcImg.Height)

    Sub Main()
        For y = 0 To SrcImg.Height - 1
            For x = 0 To SrcImg.Width - 1
                Dim c = SrcImg.GetPixel(x, y)
                Dim d = BgImg.GetPixel(x, y)
                If c = Color.FromArgb(255, 0, 0, 0) Then
                    If d <> Color.FromArgb(255, 255, 255, 255) Then
                        DesImg.SetPixel(x, y, Color.DarkRed)
                    Else
                        DesImg.SetPixel(x, y, Color.DarkCyan)
                    End If
                Else
                    DesImg.SetPixel(x, y, Color.White)
                End If
                'Debug.Print(c.ToString)
            Next
        Next

        Dim g = Graphics.FromImage(DesImg)
        g.DrawString("by Wandai  twd2.me", New Font("微软雅黑", 8), Brushes.Brown, 25, 0)
        g.DrawString("!", New Font("微软雅黑", 8), Brushes.Brown, 40, 149)

        DesImg.Save(Des)
        Console.WriteLine("done.")
        Console.ReadKey()
    End Sub

End Module

这里是输出的图片:

不解释。

发表评论?

2 条评论。

  1. 我是很胖很胖的掌柜

    :oops: 好!

发表评论

注意 - 你可以用以下 HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

:wink: :twisted: :roll: :oops: :mrgreen: :lol: :idea: :evil: :cry: :arrow: :?: :-| :-x :-o :-P :-D :-? :) :( :!: 8-O 8)

本文链接:https://twd2.me/archives/2116QrCode