10年0个月前IP:陕西
827858
3楼
Public Shared Function LoadString(ByRef Context As String, ByRef Brush As System.Drawing.Brush, ByVal Size As Integer, ByVal FontName As String, _
                                          Optional ByVal BorderWidth As Integer = 1, Optional ByVal Width As Integer = 1600, Optional ByVal Height As Integer = 64) As DxImage
            Dim Image As System.Drawing.Bitmap = New System.Drawing.Bitmap(Width, Height)
            Dim GDI As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(Image)
            Dim FontFamily As System.Drawing.FontFamily = New System.Drawing.FontFamily(FontName)
            Dim Font As System.Drawing.Font = New System.Drawing.Font(FontFamily, Size, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
            GDI.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias
            GDI.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High

            For o = 0 To Math.PI * 2 Step Math.PI / 16
                For i = 1 To BorderWidth Step 1
                    GDI.DrawString(Context, Font, System.Drawing.Brushes.Black, i * Math.Cos(o), i * Math.Sin(o))
                Next i
            Next o

            GDI.DrawString(Context, Font, Brush, 0, 0)

            Dim SoftHandle As Integer = DX.MakeARGB8ColorSoftImage(Image.Width, Image.Height)
            Dim TmpColor As New System.Drawing.Color()
            For i = 0 To Image.Width - 1 Step 1
                For j = 0 To Image.Height - 1 Step 1
                    TmpColor = Image.GetPixel(i, j)
                    DX.DrawPixelSoftImage(SoftHandle, i, j, TmpColor.R, TmpColor.G, TmpColor.B, TmpColor.A)
                Next j
            Next i

            'Dim Data As System.Drawing.Imaging.BitmapData = New System.Drawing.Imaging.BitmapData()
            'Data = Image.LockBits(New System.Drawing.Rectangle(0, 0, Image.Width, Image.Height), System.Drawing.Imaging.ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
            Dim TmpImage As DxImage = New DxImage(DX.CreateGraphFromSoftImage(SoftHandle), Image.Width, Image.Height)
            'Image.UnlockBits(Data)
            DX.DeleteSoftImage(SoftHandle)
            GDI.Dispose() : Image.Dispose() : Font.Dispose() : FontFamily.Dispose()
            Return TmpImage
        End Function

感觉贴图加载代码和我这边思路类似,都是以内存为中介 我之前是用的。。硬盘。。。

评论
文号 / 827858

十步芳草
名片发私信
学术分 0
总主题 16 帖总回复 250 楼拥有证书:进士 机友 笔友
注册于 2013/03/09 20:15:00最后登录 2023/09/08 15:08:10
主体类型:个人
所属领域:无
认证方式:手机号
IP归属地:0

个人简介

暂未填写
笔记
{{note.content}}
{{n.user.username}}
{{fromNow(n.toc)}} {{n.status === noteStatus.disabled ? "已屏蔽" : ""}} {{n.status === noteStatus.unknown ? "正在审核" : ""}} {{n.status === noteStatus.deleted ? '已删除' : ''}}
  • 编辑
  • 删除
  • {{n.status === 'disabled' ? "解除屏蔽" : "屏蔽" }}
我也是有底线的