Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15743

DrawBytesToPictureBox,how to show Picture from Byte Array without GdiPlus?

$
0
0
A lot of people said GdiPlus.dll Only use CPU to calculate, can't make graphics card accelerate
Code:

Public Sub DrawBytesToPictureBox(ByRef PictureData() As Byte, ByRef picBox As PictureBox) 'support PNG format
 
    Dim GpInput As GdiplusStartupInput
    Dim token As Long, GdiDC As Long, StreamObject As Long, img As Long
 
    GpInput.GdiplusVersion = 1
    GdiplusStartup token, GpInput

    GdipCreateFromHDC picBox.hdc, GdiDC
    CreateStreamOnHGlobal PictureData(0), 0, StreamObject
    GdipLoadImageFromStream StreamObject, img
    GdipDrawImage GdiDC, img, 0, 0

    GdipDisposeImage img
    GdipDeleteGraphics GdiDC
    GdiplusShutdown token

End Sub


Viewing all articles
Browse latest Browse all 15743

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>