Click here to Skip to main content
15,881,803 members
Home / Discussions / C#
   

C#

 
GeneralRe: Fast graphics in C# Pin
Ista26-Aug-03 4:46
Ista26-Aug-03 4:46 
GeneralRe: Fast graphics in C# Pin
Philip Fitzsimons26-Aug-03 2:28
Philip Fitzsimons26-Aug-03 2:28 
GeneralRe: Fast graphics in C# Pin
Stephane David26-Aug-03 3:55
Stephane David26-Aug-03 3:55 
GeneralRe: Fast graphics in C# Pin
Philip Fitzsimons26-Aug-03 4:25
Philip Fitzsimons26-Aug-03 4:25 
GeneralRe: Fast graphics in C# Pin
Philip Fitzsimons26-Aug-03 4:43
Philip Fitzsimons26-Aug-03 4:43 
GeneralRe: Fast graphics in C# Pin
Stephane David26-Aug-03 5:06
Stephane David26-Aug-03 5:06 
GeneralRe: Fast graphics in C# Pin
Philip Fitzsimons26-Aug-03 5:46
Philip Fitzsimons26-Aug-03 5:46 
GeneralRe: Fast graphics in C# Pin
Stephane David26-Aug-03 11:04
Stephane David26-Aug-03 11:04 
Before I did this

graphics.DrawImage(backgroundSprite.Canvas.PictureFile,destinationRectangle,backgroundSprite.SourceRect,GraphicsUnit.Pixel);

and I had in memory one file with 9x9 tiles. I selected the tile from the source rectangle, and copied it in my PictureBox.

Now I have that :

graphics.DrawImage(backgroundCanvasArray[BackgroundCanvas].TilesArray[line,column],offsetX,offsetY);

and I have an array of tile 9x9.

Initialization is a bit longer, as I have to break my 9x9 tiles images into 81 images in an array.

But then, for the rendering I simply draw the tiles directly at the offset, without specifying a source and destination rectangle.

Result : rendering time for a 20x20 tiles world has dropped from 950 ms to 30 ms.

What took time was the resampling of the image to fit the new size, EVEN IF IT WAS THE SAME SIZE.

Now it works well enough
GeneralRe: Fast graphics in C# Pin
Philip Fitzsimons26-Aug-03 23:11
Philip Fitzsimons26-Aug-03 23:11 
GeneralRe: Fast graphics in C# Pin
Ista26-Aug-03 4:45
Ista26-Aug-03 4:45 
GeneralRe: Fast graphics in C# Pin
J. Dunlap26-Aug-03 11:37
J. Dunlap26-Aug-03 11:37 
Generalgrid control Pin
Member 52474025-Aug-03 19:39
Member 52474025-Aug-03 19:39 
GeneralSplitting a string Pin
Member 50926225-Aug-03 18:52
Member 50926225-Aug-03 18:52 
GeneralRe: Splitting a string Pin
Nick Parker25-Aug-03 19:18
protectorNick Parker25-Aug-03 19:18 
GeneralRe: Splitting a string Pin
Member 50926225-Aug-03 19:35
Member 50926225-Aug-03 19:35 
GeneralRe: Splitting a string Pin
A.Wegierski25-Aug-03 19:29
A.Wegierski25-Aug-03 19:29 
GeneralRe: Splitting a string Pin
Member 50926225-Aug-03 19:33
Member 50926225-Aug-03 19:33 
GeneralRe: Splitting a string Pin
A.Wegierski25-Aug-03 19:39
A.Wegierski25-Aug-03 19:39 
GeneralRe: Splitting a string Pin
Philip Fitzsimons26-Aug-03 2:29
Philip Fitzsimons26-Aug-03 2:29 
GeneralRe: Splitting a string Pin
Donald_a26-Aug-03 6:26
Donald_a26-Aug-03 6:26 
GeneralGet a grahics object from a Bitmap Pin
Ista25-Aug-03 17:22
Ista25-Aug-03 17:22 
GeneralRe: Get a grahics object from a Bitmap Pin
Nick Parker25-Aug-03 17:37
protectorNick Parker25-Aug-03 17:37 
GeneralRe: Get a grahics object from a Bitmap Pin
Ista25-Aug-03 17:41
Ista25-Aug-03 17:41 
GeneralRe: Get a grahics object from a Bitmap Pin
Nick Parker25-Aug-03 17:46
protectorNick Parker25-Aug-03 17:46 
GeneralRe: Get a grahics object from a Bitmap Pin
Ista25-Aug-03 17:47
Ista25-Aug-03 17:47 

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.