GDI+图片处理函数问题
PrivateSubForm_Load()InitGDIPlusGdipCreateFromHDCMe.HDC,GraphicsGdipLoadImageFromFile...
Private Sub Form_Load()
InitGDIPlus
GdipCreateFromHDC Me.HDC, Graphics
GdipLoadImageFromFile StrPtr("E:\我的文档\vb\练习\新建文件夹\light.png"), img
GdipGetImageWidth img, img_w
h = GdipGetImageHeight(img, img_h)
'颜色矩阵
mLastStatus = GdipCreateImageAttributes(m_hAttribute)
mColorMatrix.m(0, 0) = 1
mColorMatrix.m(1, 1) = 1
mColorMatrix.m(2, 2) = 1
mColorMatrix.m(3, 3) = 0.5 'Alpha
mColorMatrix.m(4, 4) = 1
mLastStatus = GdipSetImageAttributesColorMatrix(m_hAttribute, ColorAdjustTypeDefault, -1, mColorMatrix, mGrayMatrix, ColorMatrixFlagsDefault)
mLastStatus = GdipDrawImageRectRectI(Graphics, img, _
0, 0, 600, 450, _
0, 0, 600, 450, _
2, m_hAttribute, 0, 0)
'GdipDrawImageRectRectI Graphics, img, 0, 0, 1000, 2000, 0, 0, img_w, img_h, UnitPixel
End Sub
Private Type ColorMatrix
m(0 To 4, 0 To 4) As Single
End Type
Private m_hAttribute As Long
Private m_hGDIPlus As Long
Private m_hGraphic As Long
Private m_hImage As Long
Private m_hImage2 As Long
Private mColorMatrix As ColorMatrix
Private mGrayMatrix As ColorMatrix
Private mLastStatus As GpStatus
运行的时候,出现mColorMatrix, mGrayMatrix这个两个参数byref参数类型不符合,我没找出哪里不符合? 展开
InitGDIPlus
GdipCreateFromHDC Me.HDC, Graphics
GdipLoadImageFromFile StrPtr("E:\我的文档\vb\练习\新建文件夹\light.png"), img
GdipGetImageWidth img, img_w
h = GdipGetImageHeight(img, img_h)
'颜色矩阵
mLastStatus = GdipCreateImageAttributes(m_hAttribute)
mColorMatrix.m(0, 0) = 1
mColorMatrix.m(1, 1) = 1
mColorMatrix.m(2, 2) = 1
mColorMatrix.m(3, 3) = 0.5 'Alpha
mColorMatrix.m(4, 4) = 1
mLastStatus = GdipSetImageAttributesColorMatrix(m_hAttribute, ColorAdjustTypeDefault, -1, mColorMatrix, mGrayMatrix, ColorMatrixFlagsDefault)
mLastStatus = GdipDrawImageRectRectI(Graphics, img, _
0, 0, 600, 450, _
0, 0, 600, 450, _
2, m_hAttribute, 0, 0)
'GdipDrawImageRectRectI Graphics, img, 0, 0, 1000, 2000, 0, 0, img_w, img_h, UnitPixel
End Sub
Private Type ColorMatrix
m(0 To 4, 0 To 4) As Single
End Type
Private m_hAttribute As Long
Private m_hGDIPlus As Long
Private m_hGraphic As Long
Private m_hImage As Long
Private m_hImage2 As Long
Private mColorMatrix As ColorMatrix
Private mGrayMatrix As ColorMatrix
Private mLastStatus As GpStatus
运行的时候,出现mColorMatrix, mGrayMatrix这个两个参数byref参数类型不符合,我没找出哪里不符合? 展开
3个回答
展开全部
Declare Function GdipSetImageAttributesColorMatrix Lib "gdiplus" (ByVal imageattr As Long, ByVal ClrAdjType As ColorAdjustType, ByVal enableFlag As Long, colourMatrix As Any, grayMatrix As Any, ByVal flags As ColorMatrixFlags) As GpStatus
你应该将函数声明为这样
vIstaswx
你应该将函数声明为这样
vIstaswx
展开全部
在吗?请教
我现在做VB的图片透明,设置了GdipSetImageAttributesColorMatrix属性后,画不出图片了。把GdipDrawImageRectRectI中的m_hAttribute,0,0 删掉就能画出来。
我现在做VB的图片透明,设置了GdipSetImageAttributesColorMatrix属性后,画不出图片了。把GdipDrawImageRectRectI中的m_hAttribute,0,0 删掉就能画出来。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
picturebox.CreateGraphics().drawlines()
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询