Click here to Skip to main content
6,633,937 members and growing! (20,627 online)
Email Password   helpLost your password?
Multimedia » DirectX » General     Intermediate

2D Blits in DirectX 9

By Karel Donk

Describes how to do 2D Blits in DirectX 9 with direct surface access between various surface formats (using color conversion).
VC7, VC7.1WinXP, DirectX, VS.NET2003, Dev
Posted:19 Apr 2005
Views:44,107
Bookmarked:13 times
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
16 votes for this article.
Popularity: 2.25 Rating: 1.87 out of 5
8 votes, 50.0%
1

2
1 vote, 6.3%
3
3 votes, 18.8%
4
4 votes, 25.0%
5

Sample Image

Introduction

The sample code provided illustrates how you can do 2D blits in DirectX 9. Starting from DirectX 8, Microsoft removed all 2D code from DirectX. The advice that they gave people wanting to use the 2D features was that those people should use DirectX 7 whenever they wanted to use the 2D functions. Of course, that was not an option if you needed the functionality provided in DirectX 8 and DirectX 9.

So while I was in the technical beta testing team for DirectX 8, I decided to write some sample code which would show how you can get direct access to the D3D surfaces and do 2D blits on them. You would have to write all the 2D functions yourself, but using my code as a starting point, that would be easy to do. In addition, my code also illustrates how to do conversion between the various surface formats introduced in DirectX 8 and 9.

Of course, when direct access to the surfaces is not needed, you would be better off using the standard D3D blitting routines, which are hardware accelerated and as a result are faster than the software 2D blits in my code.

Using the code

A sample project is provided in the downloadable ZIP file which shows how to use the code provided. Please see the readme.txt file also included in the ZIP file, for more information. If you have questions, feel free to email me. For updates or other code samples, visit my homepage.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Karel Donk


Member
Visit my homepage at http://www.miraesoft.com/karel for information about me.
Occupation: Web Developer
Location: Suriname Suriname

Other popular DirectX articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 6 of 6 (Total in Forum: 6) (Refresh)FirstPrevNext
GeneralDoes not follow standards. PinmemberMr.Prakash0:05 6 Aug '06  
GeneralRe: Does not follow standards. PinmemberKarel Donk1:58 6 Aug '06  
GeneralRe: Does not follow standards. PinmvpJohn Simmons / outlaw programmer10:25 16 Nov '07  
GeneralRe: Does not follow standards. PinmemberOriginalJax22:23 13 Apr '07  
GeneralGreat... Pinmembertom_dx16:34 20 Apr '05  
GeneralRe: Great... PinsussKDonk2:03 21 Apr '05  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 19 Apr 2005
Editor: Smitha Vijayan
Copyright 2005 by Karel Donk
Everything else Copyright © CodeProject, 1999-2009
Web21 | Advertise on the Code Project