Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Animate Palette
Message
From
09/08/2000 01:42:50
 
 
General information
Forum:
Visual C++
Category:
Other
Title:
Miscellaneous
Thread ID:
00402135
Message ID:
00402657
Views:
10
Thank you,

I'll teach much more.

Jiri


>You don't want much :-) seriously though, this is a huge subject and the following DirectX sample leaves out a LARGE amounts of detail. I would suggest you buy a copy of DirectX for Dummies by Andre Le'Mothe from Amazon. Great book and will teach you a lot about DirectX and Windows. This is an example of pixel plotting and has been removed from a larger project, so lots of setup detail is missing:-
>
>
>int PlotPixel(LPDIRECTDRAWSURFACE pDDS, int x, int y, int r, int g, int b, int BPP)
>{
> DDSURFACEDESC ddsd;
> unsigned int pixel;
> int offset;
> unsigned char * szSurface;
> HRESULT hr;
> int pixelwidth;
>
> ddsd.dwSize = sizeof(ddsd);
>
> pixel = EncodeRGB(r, g, b);
>
> hr = pDDS->Lock( NULL, &ddsd, DDLOCK_WAIT | DDLOCK_SURFACEMEMORYPTR, NULL );
>
> if (FAILED(hr))
> return -1;
>
> szSurface = (unsigned char*)ddsd.lpSurface;
>
> switch(BPP)
> {
> case 16: pixelwidth = 2; break;
> case 24: pixelwidth = 3; break;
> case 32: pixelwidth = 4; break;
> default: pixelwidth = 1;
> }
>
> offset = (y * ddsd.lPitch + x * pixelwidth);
> memcpy( szSurface + offset, &pixel, pixelwidth );
>
> hr = pDDS->Unlock( NULL );
>
> if (FAILED(hr))
> return -2;
>
> return 0;
>}
Previous
Reply
Map
View

Click here to load this message in the networking platform