nevcry |
2013-08-07 09:52 |
aplayer:如APlayerSDK文档中提到的: 614 - Picture RGBA buffer str W set picture data by RGBA buffer, format: "address;width;height" 即, "adress" 参数为指向一个包含RGBA 内存缓冲图像的地址的十进制串, width 为该内存缓冲图的宽度, height 为高度, 例如缓冲区地址为 0x21000000, 宽度为 400, 高度为 300 的图像缓冲区缓冲写成: "553648128;400;300", 其中"553648128" 即 0x21000000 的十进制串. ....... 
请教管理员,因为我图形图像不是很了解.. 下面是我找到的 利用Gdi 实现的文字输出.. 如图: [attachment=72]
代码如下:
Public Function DrawText(ByVal text As String) As Boolean If text = "" Then Exit Function LastText = text Dim tempBI As BITMAPINFO Dim tempBlend As BLENDFUNCTION Dim lngHeight As Long, lngWidth As Long Dim curWinLong As Long Dim graphics As Long Dim winSize As Size Dim srcPoint As POINTAPI Me.Cls SelectObject mDC, oldBitmap DeleteObject mainBitmap DeleteObject oldBitmap DeleteDC mDC GdipDeleteFontFamily fontFam GdipDeleteStringFormat strFormat GdipDeletePath strPath GdipDeleteBrush Brush GdipDeletePen pen GdipDeleteGraphics graphics '释放graphics占用的内存 '清除上次使用的内存 With tempBI.bmiHeader .biSize = Len(tempBI.bmiHeader) .biBitCount = 32 .biHeight = Me.ScaleHeight .biWidth = Me.ScaleWidth .biPlanes = 1 .biSizeImage = .biWidth * .biHeight * (.biBitCount / 8) End With mDC = CreateCompatibleDC(Me.hdc) mainBitmap = CreateDIBSection(mDC, tempBI, DIB_RGB_COLORS, ByVal 0, 0, 0) oldBitmap = SelectObject(mDC, mainBitmap) Call GdipCreateFromHDC(mDC, graphics) GdipSetSmoothingMode graphics, SmoothingModeHighQuality GdipCreateFontFamilyFromName StrPtr(GFont.FontName), 0, fontFam GdipCreateStringFormat 0, 0, strFormat GdipSetStringFormatAlign strFormat, StringAlignmentCenter Dim rectf1 As RECTF rectf1.Height = 10 rectf1.Width = 240 rectf1.Top = 1 rectf1.Left = 1 '填充坐标 '&HFFA5DAF7, &HC8468DCC,&HFF010101 '----------------------------------------------------- Call GdipCreateLineBrushFromRect(rectf1, &HC0000000, &HC0000000, LinearGradientModeBackwardDiagonal, WrapModeTileFlipXY, Brush) '创建一个填充笔刷 '创建一个描边的笔刷 rclayout.Left = 2 rclayout.Top = 2 rclayout.Right = Screen.Width / 15 rclayout.Bottom = 0 GdipCreatePath FillModeAlternate, strPath Call GdipAddPathStringI(strPath, StrPtr(text), -1, fontFam, FontStyle.FontStyleBold, GFont.FontSize, rclayout, strFormat) GdipFillPath graphics, Brush, strPath GdipDrawPath graphics, pen, strPath '------------------------------------------------------ Call GdipCreateLineBrushFromRect(rectf1, GFont.ForeColor1, GFont.ForeColor2, LinearGradientModeBackwardDiagonal, WrapModeTileFlipXY, Brush) '创建一个填充笔刷 GdipCreatePen1 &HC0000000, GFont.FontWidth, UnitDocument, pen '创建一个描边的笔刷 rclayout.Left = 0 rclayout.Top = 0 rclayout.Right = Screen.Width / 15 rclayout.Bottom = 0 GdipCreatePath FillModeAlternate, strPath Call GdipAddPathStringI(strPath, StrPtr(text), -1, fontFam, FontStyle.FontStyleBold, GFont.FontSize, rclayout, strFormat) GdipFillPath graphics, Brush, strPath GdipDrawPath graphics, pen, strPath '-------------------------------------------------------------- curWinLong = GetWindowLong(Me.hwnd, GWL_EXSTYLE) SetWindowLong Me.hwnd, GWL_EXSTYLE, curWinLong Or WS_EX_LAYERED srcPoint.x = 0 srcPoint.y = 0 winSize.cx = Me.ScaleWidth winSize.cy = Me.ScaleHeight With blendFunc32bpp .AlphaFormat = AC_SRC_ALPHA .BlendFlags = 0 .BlendOp = AC_SRC_OVER .SourceConstantAlpha = 255 End With Call GdipDeleteGraphics(graphics) Call UpdateLayeredWindow(Me.hwnd, Me.hdc, ByVal 0&, winSize, mDC, srcPoint, 0, blendFunc32bpp, ULW_ALPHA) End Function
不知道如何修改,以内存图像的形式加载到aplayer中..望管理员指教,谢谢... |
|