Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB .NET GDI+
HI, guys I heard that converting bitmaps to 32bppPArgb is a great boost for GDI+,
I was wondering if I'm doing this thing right, this is my code:
 
CREATING THE TEXTURE:
'set the default program dir:
        strDefDir = My.Computer.FileSystem.CurrentDirectory & "\"
'load texture:
        bmpTexture = Image.FromFile(strDefDir & "tex.bmp")
 
'convert texture to32bppPArgb:
        Dim bmpTemp As New Bitmap(256, 256, Imaging.PixelFormat.Format32bppPArgb)
        Dim gTemp As Graphics = Graphics.FromImage(bmpTemp)
        gTemp.DrawImageUnscaled(bmpTexture, 0, 0)
        bmpTexture = bmpTemp
        gTemp.Dispose()
       
 
DRAWING THE TEXTURE:
Private Sub frmGraphicsDevice_Paint(sender As Object, e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
        e.Graphics.CompositingQuality = Drawing2D.CompositingQuality.HighSpeed
        e.Graphics.DrawImage(bmpTexture, ptrDrawPoint)
  End Sub
 
Thank You!
Posted 29-Dec-12 3:52am
O.G.I.3.2K
Edited 29-Dec-12 4:38am
v2

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Looks OK. But it's not really that great a 'boost', esp if your image was 24 bit to start with ( the other 8 bits are not used ).
 
Unless you're using a Commodore 64, or using GDI+ for things it's not good for ( i.e. games ), this won't really speed things up much.
  Permalink  
Comments
O.G.I. at 29-Dec-12 19:49pm
   
I'm making a very simple game, where there is only 5 to 15 sprites, and the playground is something like 2000 x 2000 pixels. The images I'm using for the playground texture are 16 bit bitmaps, so is it better to use something like 16bppRgb565 for image format because of the 16 bits lost, or 32bppPArgb will give me better performance?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Mathew Soji 330
1 BillWoodruff 260
2 Sergey Alexandrovich Kryukov 240
3 OriginalGriff 216
4 Afzaal Ahmad Zeeshan 208
0 OriginalGriff 6,168
1 Sergey Alexandrovich Kryukov 5,853
2 DamithSL 5,028
3 Manas Bhardwaj 4,539
4 Maciej Los 3,845


Advertise | Privacy | Mobile
Web04 | 2.8.1411019.1 | Last Updated 29 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100