Click here to Skip to main content
15,892,809 members
Home / Discussions / Graphics
   

Graphics

 
AnswerRe: Zooming bitmap like Paint Pin
Randor 20-Nov-08 4:39
professional Randor 20-Nov-08 4:39 
QuestionHow to create gif file from bmp using GDI+ Pin
sandeepkavade19-Nov-08 18:56
sandeepkavade19-Nov-08 18:56 
QuestionHow to manage data from Directshow filter? Pin
Van Ly Doc Hanh19-Nov-08 7:11
Van Ly Doc Hanh19-Nov-08 7:11 
AnswerRe: How to manage data from Directshow filter? Pin
Mark Salsbery21-Nov-08 6:01
Mark Salsbery21-Nov-08 6:01 
QuestionFaster drawing in C# application than GDI+ Pin
User 1278216-Nov-08 17:52
User 1278216-Nov-08 17:52 
AnswerRe: Faster drawing in C# application than GDI+ Pin
MikeMarq17-Nov-08 8:11
MikeMarq17-Nov-08 8:11 
GeneralRe: Faster drawing in C# application than GDI+ Pin
User 1278220-Nov-08 15:36
User 1278220-Nov-08 15:36 
GeneralRe: Faster drawing in C# application than GDI+ Pin
MikeMarq22-Nov-08 7:48
MikeMarq22-Nov-08 7:48 
Aaron Stubbendieck wrote:
I keep meaning to learn DX and I'd appreciate taking a look at what you've got to get me started.


What I wrote doesn't use directx but it is still lightning fast and could be optimited further. Basically I needed it for some image recognition/ai stuff I wanted to display for debugging purposes. The dotnet functions were way too slow on my old laptop.

I will post the code from my graphics module in the next post. If you would like to see it used in an example project I wrote that uses the module please let me know your email and I will send you a zip of my project.

Here's how it works:

1) ReadStream takes a filestream as an argument and reads the pixel and header data into pixelarray and header. If you are not planning to modify an existing bitmap just make an empty one of the dimensions you need to serve this purpose.
2) GetPixel & SetPixel are pretty strait forward. They read or write data into the pixelarray but the results of this are not immediately displayed (there's a reason for this).
3) WriteStream takes the data in the 2 dimensional array and produces a bitmap memorystream.
4) WriteToPictureBox is like WriteStream but it will display the results in a picturebox you specify.

WriteStream & WriteToPictureBox should not be called until after you write all the data because this is by far the slowest of the functions. So if you are drawing a graph call Setpixel for all of the dots and when you are done call WriteToPictureBox to display it. Don't call it after every SetPixel.

This is probably one of the reasons that my code is so fast. It avoids certain repeated calculation that the dotnet methods probably have to use since some of them refresh after every draw.

Please note the example only works for 24 bit bitmaps you will have to modify the code if you want to use other ones. Also pixelarray data starts at position 1x1, I skipped the 0 indexes of the array because I prefer base 1 arrays and I wrote this code for myself originally.
GeneralHere's some code Pin
MikeMarq22-Nov-08 7:51
MikeMarq22-Nov-08 7:51 
AnswerRe: Faster drawing in C# application than GDI+ Pin
Alan Balkany18-Nov-08 3:56
Alan Balkany18-Nov-08 3:56 
GeneralRe: Faster drawing in C# application than GDI+ Pin
User 1278220-Nov-08 15:33
User 1278220-Nov-08 15:33 
GeneralRe: Faster drawing in C# application than GDI+ Pin
Luc Pattyn22-Nov-08 9:42
sitebuilderLuc Pattyn22-Nov-08 9:42 
AnswerRe: Faster drawing in C# application than GDI+ Pin
ARon_10-Feb-09 8:19
ARon_10-Feb-09 8:19 
QuestionDirect3DCreate9 question Pin
Pedram Behroozi15-Nov-08 8:38
Pedram Behroozi15-Nov-08 8:38 
AnswerRe: Direct3DCreate9 question Pin
Baltoro16-Nov-08 10:40
Baltoro16-Nov-08 10:40 
GeneralRe: Direct3DCreate9 question Pin
Pedram Behroozi16-Nov-08 11:22
Pedram Behroozi16-Nov-08 11:22 
GeneralRe: Direct3DCreate9 question Pin
Baltoro20-Nov-08 14:01
Baltoro20-Nov-08 14:01 
GeneralRe: Direct3DCreate9 question Pin
Pedram Behroozi20-Nov-08 22:02
Pedram Behroozi20-Nov-08 22:02 
GeneralRe: Direct3DCreate9 question Pin
Mark Churchill13-Jan-09 18:51
Mark Churchill13-Jan-09 18:51 
QuestionExport to Bitmap. Pin
vinay_K10-Nov-08 1:54
vinay_K10-Nov-08 1:54 
Question[please help]why i cannot render my pic?thks! Pin
kaviniswell7-Nov-08 16:19
kaviniswell7-Nov-08 16:19 
AnswerRe: [please help]why i cannot render my pic?thks! Pin
Baltoro8-Nov-08 9:39
Baltoro8-Nov-08 9:39 
GeneralRe: [please help]why i cannot render my pic?thks! Pin
kaviniswell12-Nov-08 19:30
kaviniswell12-Nov-08 19:30 
AnswerRe: [please help]why i cannot render my pic?thks! Pin
Mark Salsbery9-Nov-08 6:55
Mark Salsbery9-Nov-08 6:55 
QuestionHow to create water ripple in directx? Pin
Md. Ali Naser Khan5-Nov-08 23:00
Md. Ali Naser Khan5-Nov-08 23:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.