Click here to Skip to main content
15,898,134 members
Home / Discussions / Graphics
   

Graphics

 
GeneralRe: Fastest way to capture screen? Pin
Daniel Jansson20-Aug-08 3:48
Daniel Jansson20-Aug-08 3:48 
GeneralRe: Fastest way to capture screen? Pin
Mark Salsbery20-Aug-08 5:05
Mark Salsbery20-Aug-08 5:05 
Questionneed suggestion Pin
ulucky19-Aug-08 2:11
ulucky19-Aug-08 2:11 
Questionerror code: S1001 for directx sdk June 2008 Pin
JoshTheMan18-Aug-08 20:22
JoshTheMan18-Aug-08 20:22 
AnswerRe: error code: S1001 for directx sdk June 2008 Pin
Tim Craig19-Aug-08 17:58
Tim Craig19-Aug-08 17:58 
QuestionRe: error code: S1001 for directx sdk June 2008 Pin
Jack_Voltaire10-Sep-08 1:07
Jack_Voltaire10-Sep-08 1:07 
QuestionSetPixel() too slow? Pin
Naturality18-Aug-08 10:49
Naturality18-Aug-08 10:49 
AnswerRe: SetPixel() too slow? Pin
Matthew Butler18-Aug-08 12:35
Matthew Butler18-Aug-08 12:35 
There is an incredibly fast way of doing this... LockBits; the first time I needed to do something like this it took me a while to get the indexing right... but it pays off in the end.

The MSDN page on it...
http://msdn.microsoft.com/en-us/library/5ey6h79d.aspx[^]

A good example...
http://blog.paranoidferret.com/index.php/2007/08/31/csharp-tutorial-convert-a-color-image-to-greyscale/[^]
Bitmap image = (Bitmap)oldimage.Clone();
BitmapData bmpData = image.LockBits(new Rectangle(0, 0, image.Width, image.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
unsafe
{
    byte* ptr = (byte*)bmpData.Scan0.ToPointer();
    for (int Y = 0; Y < image.Height; Y++)
    {
        for (int X = 0; X < image.Width; X++)
        {
            // alter the colours here
            *ptr++ = 0;     // blue
            *ptr++ = 0;     // green
            *ptr++ = 0;     // red
        }
        ptr += bmpData.Stride - image.Width * 3;
    }
}
image.UnlockBits(bmpData);

*ptr++ is the current byte representing a 'sub-pixel' of the current pixel at image position [x, y]: the reason why the pointer is incremented three times.

Hope this helps.

Matthew Butler

GeneralRe: SetPixel() too slow? Pin
Naturality18-Aug-08 13:01
Naturality18-Aug-08 13:01 
GeneralRe: SetPixel() too slow? Pin
Mark Salsbery18-Aug-08 14:38
Mark Salsbery18-Aug-08 14:38 
GeneralRe: SetPixel() too slow? Pin
Naturality19-Aug-08 11:28
Naturality19-Aug-08 11:28 
Questioncan rotation be performed using translation itself? Pin
ashishsagarwal18-Aug-08 6:22
ashishsagarwal18-Aug-08 6:22 
QuestionXNA 3d model formats Pin
MikeMarq17-Aug-08 6:12
MikeMarq17-Aug-08 6:12 
QuestionDirectX9 novice help Pin
Dave_BHGF16-Aug-08 7:43
Dave_BHGF16-Aug-08 7:43 
QuestionProblem with CROSSBAR in DirectShow Pin
bhanu_850913-Aug-08 3:28
bhanu_850913-Aug-08 3:28 
AnswerRe: Problem with CROSSBAR in DirectShow Pin
Tim Craig13-Aug-08 9:27
Tim Craig13-Aug-08 9:27 
AnswerRe: Problem with CROSSBAR in DirectShow Pin
tanvon malik16-Aug-08 23:55
tanvon malik16-Aug-08 23:55 
GeneralRe: Problem with CROSSBAR in DirectShow Pin
bhanu_850922-Aug-08 3:35
bhanu_850922-Aug-08 3:35 
QuestionImage Control Pin
Dean Moe9-Aug-08 3:47
Dean Moe9-Aug-08 3:47 
AnswerRe: Image Control Pin
John_Adams22-Aug-08 9:10
John_Adams22-Aug-08 9:10 
QuestionIcon Creation Pin
The Only Nock7-Aug-08 14:31
The Only Nock7-Aug-08 14:31 
AnswerRe: Icon Creation Pin
Shog97-Aug-08 20:09
sitebuilderShog97-Aug-08 20:09 
GeneralRe: Icon Creation Pin
The Only Nock8-Aug-08 7:25
The Only Nock8-Aug-08 7:25 
GeneralRe: Icon Creation Pin
Shog98-Aug-08 7:28
sitebuilderShog98-Aug-08 7:28 
GeneralRe: Icon Creation Pin
The Only Nock8-Aug-08 8:15
The Only Nock8-Aug-08 8:15 

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.