• GDI+_绘制QQ头像


    Public Sub I_touxiang(ByVal file As String, ByVal Graphics As Long, Width As Long, Height As Long, Optional SavePath As String)
    '做这个是因为昨天晚上雅铭居士的论坛登录器的有需要。一个利用GDI +制作的QQ头像效果
    'By 2019.2.16 22:00 InkHin
    Dim Bitmap As Long, bmW As Long, bmH As Long
    Dim Brush As Long
    Dim Path As Long
    Dim newImg As Long, newGraphics As Long
    
    Call GdipCreateBitmapFromFile(StrPtr(file), Bitmap)  '获取Bitmap
    Call GdipGetImageWidth(Bitmap, bmW)  '得到Bitmap的尺寸
    Call GdipGetImageHeight(Bitmap, bmH)
    Call GdipCreateTexture2I(Bitmap, WrapModeTile, 0, 0, bmW, bmH, Brush) '
    Call GdipCreateBitmapFromScan0(bmW, bmH, 0, PixelFormat32bppARGB, ByVal 0, newImg) '
    Call GdipGetImageGraphicsContext(newImg, newGraphics) '
    Call GdipGraphicsClear(newGraphics, &HFFFFFF) '
    Call GdipSetSmoothingMode(Graphics, SmoothingModeAntiAlias)  '反锯齿
    Call GdipCreatePath(FillModeAlternate, Path) '
    Call GdipAddPathArcI(Path, 0, 0, bmW, bmH, 0, 360) '
    Call GdipFillPath(newGraphics, Brush, Path) '
    Call GdipDrawImageRectI(Graphics, newImg, 0, 0, Width, Height)
    If Not IsMissing(SavePath) Then
    If SaveImageToPNG(newImg, SavePath) <> 0 Then MsgBox "保存失败。"
    End If
    '一堆删除 Call GdipDeleteGraphics(Graphics) Call GdipDisposeImage(Bitmap) Call GdipDeleteGraphics(newGraphics) Call GdipDisposeImage(newImg) Call GdipDeletePath(Path) Call GdipDeleteBrush(Brush) End Sub
  • 相关阅读:
    HDU1429:胜利大逃亡(续)
    HDU1728:逃离迷宫
    HDU1253:胜利大逃亡
    HDU1180:诡异的楼梯
    HDU1175:连连看(搜索)
    HDU1072:Nightmare
    HDU1074:Doing Homework
    Codeforces Round #259 (Div. 1)A(公式)
    HDU1430;魔板(BFS+康托展开)
    Codeforces785D
  • 原文地址:https://www.cnblogs.com/lingqingxue/p/10390949.html
Copyright © 2020-2023  润新知