DirectDraw Technology CML Training Course 2001/07/24 Alex Ma.

Slides:



Advertisements
Similar presentations
Lecture 2 Concepts, Terms and Definitions. Display Devices They are divided into a lot of small squares called pixels (“PICture ELements”). Each pixel.
Advertisements

Computer Graphics Tz-Huan Huang National Taiwan University (Slides are based on Prof. Chen’s)
G30™ A 3D graphics accelerator for mobile devices Petri Nordlund CTO, Bitboys Oy.
Foundation Level Course
Using Fireworks.1 Using Fireworks MX 2004 Designing interfaces in Fireworks, using a scenario methodology.
1 DirectDraw and Bitmaps Part 1 CIS 487/587 Bruce R. Maxim UM-Dearborn.
3D Graphics - Current Technologies Open GLOpen GL (Open Graphics Language) –SGI Silicon Graphics Direct 3DDirect 3D –Microsoft Direct X Technology Java3DJava3D.
Use the Macromedia Flash drawing tools Edit drawings Work with objects Work with text Work with layers Unit Lessons.
Macromedia Flash MX 2004 – Design Professional Macromedia Flash MX DRAWING IN.
1 DirectDraw and Bitmaps Part 2 CIS 487/587 Bruce R. Maxim UM-Dearborn.
Pertemuan 20 Character oriented terminal
Ch 1 Intro to Graphics page 1CS 367 First Day Agenda Best course you have ever had (survey) Info Cards Name, , Nickname C / C++ experience, EOS experience.
Introduction to Computer Graphics
1 DirectDraw Basics CIS 487/587 Bruce R. Maxim UM-Dearborn.
Vector vs. Bitmap SciVis V
Graphics and Multimedia. Introduction The language contains many sophisticated drawing capabilities as part of namespace System.Drawing and the other.
V Obtained from a summer workshop in Guildford County July, 2014
1 DirectX CIS 487/587 Bruce R. Maxim UM-Dearborn.
Pygame Dick Steflik.
1 Input/Output. 2 Principles of I/O Hardware Some typical device, network, and data base rates.
Two-Dimensional Games Using DirectDraw Presentation By Greg Buron December 3, 2002.
Tech Talk: DirectDraw Alex Riemann University of Illinois, Urbana-Champaign February 13, 2000.
Computer Programming and Basic Software Engineering 9 Building Graphical User Interface A Brief Introduction to GDI+ S.R.G. Fraser, Pro Visual C++/CLI.
Basics of a Computer Graphics System Introduction to Computer Graphics CSE 470/598 Arizona State University Dianne Hansford.
Računarska grafika GDI+ (Graphics Device Interface Plus)
 Bitmap: A bitmap is a rectangular array of 0s and 1s that serves as a drawing mask for a corresponding rectangular portion of the window.  Applications:
Vector vs. Bitmap
Tennis for Two, 1958, by William Higinbotham, Brookhaven National Lab CSE 380 – Computer Game Programming Graphics Device Management.
1-1 OBJ Copyright 2003, Paradigm Publishing Inc. Dr. Joseph Otto Silvia Castaneda Christopher deCastro CSULA Macromedia Flash MX Introduction.
Buffers Textures and more Rendering Paul Taylor & Barry La Trobe University 2009.
Computer Graphics Bitmaps & Sprites CO2409 Computer Graphics Week 3.
1 Introduction to Computer Graphics SEN Introduction to OpenGL Graphics Applications.
GDI+ 1. Objectives 2 GDI+ class  Create and render Graphic  Display information on the computer screen, printer 3.
1 Windows GDI Programming CIS 487/587 Bruce R. Maxim UM-Dearborn.
Chapter 14 Working with Graphics. 2Practical PC 5 th Edition Chapter 14 Getting Started In this Chapter, you will learn: − About different graphics you.
INT 840E Computer graphics Introduction & Graphic’s Architecture.
CS- 375 Graphics and Human Computer Interaction Lecture 1: 12/4/1435 Fundamental Techniques in Graphics Lecturer: Kawther Abas.
Introduction to Flash Animation CS 318. Topics Introduction to Flash and animation The Flash development environment Creating Flash animations  Layers.
By Courtney Field Creative digital graphics. Types of graphics and examples There are a number of different types of graphics file formats. Each type.
Illustrator I I450 Technology Seminar. Bitmap vs. Vector Photoshop = Bitmap Illustrator = Vector Bitmap images are resolution dependent Vector images.
High Performance Java Swing Animation David Wallace Croft Presented to the Plano Java Users Group Plano, TX Copyright 2004 David Wallace Croft.
Presentation Outline Introduction Painting and Repainting GDI.
Lecture 7: Intro to Computer Graphics. Remember…… DIGITAL - Digital means discrete. DIGITAL - Digital means discrete. Digital representation is comprised.
CHAPTER 3 (P.49-53) Importing modules + pygame intro.
Getting Started with Adobe Illustrator CS6. Objectives Define illustration software Start Adobe Illustrator CS6 and change preference settings View the.
By: Catyana Brown Information Technology in a Global Society: Multimedia.
1 Layer up to keep warm… A short tutorial on the usage of layers.
Introduction to Game Programming Pertemuan 11 Matakuliah: T0944-Game Design and Programming Tahun: 2010.
GAM666 – Introduction To Game Programming ● DirectDraw, the 2D component of DirectX, uses the term “surface” to mean an area of memory in which pixel data.
LAYERS AND OBJECT PROPERTIES. Topics OBJECT PROPERTIES LAYERS OBJECTS AND LAYERS Creating and Naming Layers Making a Layer Current Sorting Layers Controlling.
Resources & Bitmaps Adding clip art to your application.
Introduction to OpenGL
RASTERIZING SHAPES IN PHOTOSHOP RASTERIZE: A process in Photoshop of converting a vector image into a bitmap (or raster) image VECTOR: A vector image is.
Learning Programming Windows API Morpheus Feb-28, 2008.
Guilford County SciVis V104.03
Display Driver Architecture in Windows CE.NET. Agenda Display Driver Basics Display Driver Basics  GPE Driver Model  GPE Methods  Emul Library  Acceleration.
Chapter 7 Introduction to High-Level Language Programming.
Chapter 14 Working with Graphics
Binary Notation and Intro to Computer Graphics
Vector vs. Bitmap.
Flash Interface, Commands and Functions
Graphics and Multimedia
Managed DirectX Joe Gavin.
Importing modules + pygame intro
Bitmaps in Windows API.
Chapter Lessons Use the Macromedia Flash drawing tools
Windows Programming Lecture 13
HW for Computer Graphics
Getting Started with Adobe Illustrator CS6
Desktop Window Manager
Presentation transcript:

DirectDraw Technology CML Training Course 2001/07/24 Alex Ma

Outline DirectDraw Introduction DirectDraw Functionality –Setup –Surface –Rendering –Blitting –Flipping –Overlay

DirectDraw Introduction

Whats DirectDraw For Basic of the DirectX graphics Provide several simple methods to manipulate the display system

Before DirectDraw Windows Graphics Device Interface (GDI) –Font, pen, brush, basic shapes –Bitmap and more raster functions –Device independent Display Driver Interface (DDI)

Before DirectDraw

With DirectDraw Hardware Abstraction Layer (HAL) –Corresponds to the display system –Exercises hardware supports Hardware Emulation Layer (HEL) –Software emulation or hardware independent methods for specific functionalities

With DirectDraw

Direct access to the display hardware device with HAL/HEL supports DirectDraw is not much device- independent as GDI does HEL cant emulate everything

DirectDraw Functionality

Setup Enumerate DirectDraw devices BOOL WINAPI EnumDDrawDevice(GUID FAR *lpGUID, LPSTR lpDriverDescription,LPSTR lpDriverName, LPVOID lpContext) DirectDrawEnumerate(EnumDDrawDevice, (LPVOID)GetDlgItem(hWnd, IDC_DEVICE)) ;

Setup Create DirectDraw object LPDIRECTDRAWpDDraw ; DirectDrawCreate(&pDDraw) ;

Setup Set cooperative level pDDraw->SetCooperativeLevel(hWnd, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE | DDSCL_NOWINDOWCHANGES) ;

Setup Enumerate video display mode BOOL WINAPI EnumDisplayModes(LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID lpContext) pDDraw3->EnumDisplayModes(0, NULL, (LPVOID)GetDlgItem(hWnd, IDC_MODES), (LPDDENUMMODESCALLBACK)EnumDisplayModes) ;

Setup Set video display mode pDDraw->SetDisplayMode(Width,Height,PixelFormat) ;

Surface A memory buffer managed as a rectangle Surface type –Primary (display) –Off-screen –Overlay –Z-buffer and more

Surface DirectDraw surface descriptor typedef DDSURFACEDESC { LPVIODlpSurface DWORDdwHeight DWORDdwWidth LONGlPitch DDPIXELFORMATddpfPixelFormat … } ;

Surface Create surface LPDIRECTDRAWSURFACEpDDrawSurface ; DDSURFACEDESCddsd ; pDDraw3->CreateSurface(&ddsd, pDDrawSurface) ;

Surface Primary surface always exists, so do not assign size or format when calling CreateSurface to get primary surface pointer Use a large surface instead of several small surfaces for better memory management

Rendering Direct memory access // Fill the screen with white color WORD *vmem = (WORD *)ddsd.lpSurface for(DWORD y=0; y<ddsd.dwHeight; y++) { for(DWORD x=0; x<ddsd.dwWidth; x++) vmem[x] = 0xffff ; vmem += ddsd.lPitch/sizeof(WORD) ; }

Rendering Using GDI pDDrawSurface->GetDC(&hDC) ; // GDI functionality tests TextOut(hDC, 320, 0, msg, strlen(msg)) ; Ellipse(hDC, 300, 125, 400, 250) ; pDDrawSurface->ReleaseDC(hDC) ;

Rendering Access control pDDrawSurface->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL) ; // Rendering pDDrawSurface->UnLock(NULL) ;

Blitting Bit block transfer (Blit)

Blitting Using blitting pDDrawSurface->Blt(&destRect, pDDrawSource, &srcRect, DDBLT_WAIT, NULL) ; pDDrawSurface->BltFast(200, 240, pDDrawSource, NULL, DDBLTFAST_WAIT) ;

Blitting BltFast is a little bit fast than Blt when using HEL. If have hardware support, then there is no difference between them

Blitting Special effects –Filling –Transparency –Scaling –Mirroring –Rotation Use DDBLTFX structure to control

Blitting Example - mirroring DDBLTFXddbltfx ; memset(&ddbltfx, 0, sizeof(DDBLTFX)) ; ddbltfx.dwSize = sizeof(DDBLTFX) ; ddbltfx.dwDDFX = DDBLTFX_MIRRORLEFTRIGHT | DDBLTFX_MIRRORUPDOWN ; pDDrawSurface->Blt(NULL, pDDrawSource, NULL, DDBLT_DDFX, &ddbltfx) ;

Flipping Tearing problem

Flipping Using flipping pPrimarySurface->GetAttachedSurface(&pBackSurface) ; // Rendering on the back surface pBackSurface->Blt(&destRect, pDDrawSource, &srcRect, DDBLT_WAIT, NULL) ; pPrimarySurface->Flip(DDFLIP_WAIT) ;

Overlay Display a surface without changing the image data in the primary surface

Overlay Using overlay pDDraw3->CreateSurface(&ddsd, &pOverlaySurface) ; // Rendering pOverlaySurface->UpdateOverlay(&srcRect, pPrimarySurface, &destRect, DDOVER_SHOW) ;

Overlay Show/Hide overlay pOverlaySurface->UpdateOverlay(&srcRect, pPrimarySurface, &destRect, DDOVER_SHOW) ; pOverlaySurface->UpdateOverlay(NULL, pPrimarySurface, NULL, DDOVER_HIDE) ;

Discuss and Q&A Time