Points of Required Attention™
Please chime in on a proposed restructuring of the ROM hacking sections.
Views: 88,501,776
Main | FAQ | Uploader | IRC chat | Radio | Memberlist | Active users | Latest posts | Calendar | Stats | Online users | Search 04-29-24 05:09 PM
Guest: Register | Login

0 users currently in Computing | 2 guests

Main - Computing - C#/.NET Rendering Image New thread | New reply


Xeon
Posted on 03-13-07 02:14 PM (rev. 2 of 03-13-07 02:17 PM) Link | Quote | ID: 14705


Red Paratroopa
Level: 31

Posts: 26/174
EXP: 181621
Next: 3742

Since: 03-09-07

Last post: 6023 days
Last view: 3225 days
Alright, well I'm currently using GDI/PInvoke/StretchDIBits in order to render my image. And the current method I'm using is pretty fast, and I'm not having any issues with it so far. But what I'm wondering is if there is a Managed solution to what I'm trying to accomplish, which is to basically to set all the pixels before hand and just render them to the screen in one operation. I'm thinking that the only good solution is to just keep using the unmanaged code, since i've found that most managed solutions are almost always going to be slower then unmanaged.

What I currently got
            Win32.BITMAPINFO bi = new Win32.BITMAPINFO();


bi.bmiHeader.biWidth = 256;
bi.bmiHeader.biHeight = -96;
bi.bmiHeader.biSize = 40;
bi.bmiHeader.biBitCount = 16;
bi.bmiHeader.biPlanes = 1;

Random r = new Random();

ushort[,] data = new ushort[96, 256];
lock (r)
{
for (int i = 0; i < 96; i++)
{
for (int j = 0; j < 256; j++)
{
data[i, j] = (ushort)r.Next(0, 0xFFFF);
}
}
}

for (int i = 0; i < 60; i++)
{
Win32.StretchDIBits(pic1Hdc, 0, 0, 256, 96, 0, 0, 256, 96,
data, ref bi, 0, Win32.TernaryRasterOperations.SRCCOPY);
}

Console.WriteLine("Rendered 60 times!");

MathOnNapkins
Posted on 03-26-07 08:26 PM (rev. 2 of 03-27-07 04:40 AM) Link | Quote | ID: 19525


Super Koopa
Level: 62

Posts: 55/842
EXP: 1936011
Next: 48675

Since: 02-19-07
From: durff

Last post: 4491 days
Last view: 4014 days
I've got an idea but I'll have to do a little more research first. It depends on whether you can do memory mapped files in C# or not.

http://www.bobpowell.net/lockingbits.htm <- best lead I've come up with so far.

____________________
Zelda Hacking Forum
hobbies: delectatio morosa

Main - Computing - C#/.NET Rendering Image New thread | New reply

Acmlmboard 2.1+4δ (2023-01-15)
© 2005-2023 Acmlm, blackhole89, Xkeeper et al.

Page rendered in 0.017 seconds. (321KB of memory used)
MySQL - queries: 42, rows: 52/53, time: 0.014 seconds.