Package com.ms.com.directX |
![]() Previous |
![]() Microsoft Packages |
![]() Index |
![]() Next |
Applications use the methods of the dDraw class to create DirectDraw objects and work with system-level variables.
public class dDraw implements IdDraw { public void InternalSetObject(IUnknown lpdd); public IUnknown InternalGetObject(); public ddClipper CreateClipper(int flags, IUnknown punk); public ddPalette CreatePalette(int flags, byte[] pe, IUnknown punk); public ddPalette CreatePalette(int flags, PaletteEntry[] pe, IUnknown punk); public ddSurface CreateSurface(ddSurfaceDesc dd, IUnknown punk); public ddSurface GetGDISurface(); public ddSurface DuplicateSurface(ddSurface ddIn); public ddPalette LoadPaletteFromBitmap(String bName); public void Compact(); public void EnumDisplayModes(int d, ddSurfaceDesc s, IUnknown args, IEnumModesCallback fn); public void EnumSurfaces(int d, ddSurfaceDesc s, IUnknown args, IEnumSurfacesCallback fn); public void FlipToGDISurface(); public void GetCaps(ddCaps DriverCaps, ddCaps HELcaps); public void GetDisplayMode(ddSurfaceDesc surface); public int GetNumFourCCCodes(); public int GetFourCCCodes(int[] size); public int GetMonitorFrequency(); public int GetScanLine(); public int GetVerticalBlankStatus(); public void RestoreDisplayMode(); public void SetCooperativeLevel(int hdl, int flags); public void SetDisplayMode(int w, int h, int bpp, int ref, int mode); public void WaitForVerticalBlank(int flags, int handle); public int GetAvailableTotalMem(); public int GetFreeMem(); public d3d Create3D(); public int SystemBpp(); public int TickCount(); }
The methods can be organized into the following groups:
Allocating memory | Compact |
Creating objects | CreateClipper |
CreatePalette | |
CreateSurface | |
LoadPaletteFromBitmap | |
Device capabilities | GetCaps |
Display modes | EnumDisplayModes |
GetDisplayMode | |
GetMonitorFrequency | |
RestoreDisplayMode | |
SetDisplayMode | |
Display status | GetScanLine |
GetVerticalBlankStatus | |
Miscellaneous | GetAvailableTotalMem |
GetFreeMem | |
GetFourCCCodes | |
WaitForVerticalBlank | |
Create3D | |
SystemBpp | |
TickCount | |
Setting behavior | SetCooperativeLevel |
Surfaces | DuplicateSurface |
EnumSurfaces | |
FlipToGDISurface | |
GetGDISurface |
public void Compact();At present this method is only a stub; it has not yet been implemented.
Return Value:
No return value.
Remarks:
This method moves all of the pieces of surface memory on the display card to a contiguous block to make the largest single amount of free memory available. This call fails if any operations are in progress.
The application calling this method must have its cooperative level set to exclusive.
public ddClipper CreateClipper(int flags, IUnknown punk);Creates a ddClipper object.
Return Value:
Returns the ddClipper object if successful; null otherwise.
Parameter Description flags This parameter is currently not used and must be set to 0. punk Reserved; must be null. Remarks:
The ddClipper object can be attached to a ddSurface and used during Blt, BltBatch, and UpdateOverlay operations.
See Also: GetClipper, SetClipper
public ddPalette CreatePalette(int flags, byte[] pe, IUnknown punk);Creates a ddPalette object for this DirectDraw object.
Return Value:
Returns the ddPalette object if successful; null otherwise.
Parameter Description flags One or more values of DDPCAPS_ type. pe Array variable that contains the data describing the initial value for each palette entry. punk Reserved; must be null.
public ddPalette CreatePalette(int flags, PaletteEntry[] pe, IUnknown punk);Creates a ddPalette object for this DirectDraw object.
Return Value:
Returns the ddPalette object if successful; null otherwise.
Parameter Description flags One or more values of DDPCAPS_ type. pe Array variable that contains a PaletteEntry object describing each palette entry. punk Reserved; must be null.
public ddSurface CreateSurface(ddSurfaceDesc dd, IUnknown punk);Creates a ddSurface object for this DirectDraw object.
Return Value:
Returns the ddSurface object if successful; null otherwise.
Parameter Description dd The ddSurfaceDesc object that describes the requested surface. punk Reserved; must be null.
public ddSurface DuplicateSurface(ddSurface ddIn);Duplicates a ddSurface object.
Return Value:
Returns the ddSurface object if successful; null otherwise.
Parameter Description ddIn The ddSurface object to be duplicated. Remarks:
This method creates a new ddSurface object that represents the same surface memory as an existing ddSurface object. This duplicate can be used just like the original object. The surface memory is released after the last object referencing it is released. A primary surface, 3D surface, or implicitly created surface cannot be duplicated.
public void EnumDisplayModes(int d, ddSurfaceDesc s, IUnknown args, IEnumModesCallback fn);Enumerates all of the display modes the hardware exposes through the DirectDraw object that are compatible with a provided surface description. If null is passed for the surface description, all exposed modes are enumerated.
Return Value:
No return value.
Parameter Description d Can be DDEDM_REFRESHRATES. s A ddSurfaceDesc object that will be checked against available modes. If the value of this parameter is null, all modes are enumerated. args Application-defined data that will be passed to each enumeration member. fn Callback interface that contains the callback function that the enumeration procedure will call every time a match is found. Remarks:
This method enumerates the BackBufferCount field of the ddSurfaceDesc structure. If you use the SetDisplayMode method to set the refresh rate of a new mode, you must use EnumDisplayModes to enumerate the BackBufferCount field.
See Also: GetDisplayMode, SetDisplayMode, RestoreDisplayMode
public void EnumSurfaces(int d, ddSurfaceDesc s, IUnknown args, IEnumSurfacesCallback fn);Enumerates all of the existing or possible surfaces that meet the search criterion specified.
Return Value:
No return value.
Parameter Description d One value of DDENUMSURFACES_ type. s A ddSurfaceDesc object that defines the surface of interest. args Application-defined data that will be passed to each enumeration member. fn A IEnumSurfacesCallback interface that contains the callback function the enumeration procedure will call every time a match is found. Remarks:
If the DDENUMSURFACES_CANBECREATED flag is set, this method attempts to temporarily create a surface that meets the criterion.
public void FlipToGDISurface();Makes the surface that GDI writes to the primary surface.
Return Value:
No return value.
Remarks:
This method can be called at the end of a page-flipping application to ensure that the display memory that GDI is writing to is visible to the user.
See Also: GetGDISurface
public int GetAvailableTotalMem();Retrieves the total amount of display memory available.
Return Value:
Returns the amount of memory.
Remarks:
A particular display adapter card may make no distinction between two different memory types. For example, the adapter might use the same portion of display memory to store z-buffers and textures. So, allocating one type of surface (for example, a z-buffer) can affect the amount of display memory available for another type of surface (for example, textures). Therefore, it is best to first allocate an application's fixed resources (such as front and back buffers, and z-buffers) before determining how much memory is available for dynamic use (such as texture mapping).
public int GetFreeMem();Retrieves the amount of display memory currently free.
Return Value:
Returns the amount of memory.
Remarks:
This method provides only a snapshot of the current display-memory state. The amount of free display memory is subject to change as surfaces are created and released. Therefore, you should use the free memory value only as an approximation.
public void GetCaps(ddCaps DriverCaps, ddCaps HELcaps);Fills in the capabilities of the device driver for the hardware and the hardware emulation layer (HEL).
Return Value:
No return value.
Parameter Description DriverCaps A ddCaps object that receives the capabilities of the hardware, as reported by the device driver. HELCaps A ddCaps object that receives the capabilities of the HEL.
public void GetDisplayMode(ddSurfaceDesc surface);Retrieves the current display mode.
Return Value:
No return value.
Parameter Description surface A ddSurfaceDesc object that receives a description of the surface. Remarks:
An application should not save the information returned by this method to restore the display mode on clean-up. The application should use the RestoreDisplayMode method to restore the mode on clean-up, thereby avoiding mode-setting conflicts that could arise in a multiprocess environment.
See Also: SetDisplayMode, RestoreDisplayMode, EnumDisplayModes
public int GetFourCCCodes(int[] size);Retrieves the FourCC codes supported by the DirectDraw object. This method can also retrieve the number of codes supported.
Return Value:
Returns the number of codes.
Parameter Description size Array variable that receives the FourCC codes supported by this DirectDraw object.
public ddSurface GetGDISurface();Retrieves the ddSurface object that currently represents the surface memory that GDI is treating as the primary surface.
Return Value:
Returns the ddSurface object if successful; null otherwise.
See Also: FlipToGDISurface
public int GetMonitorFrequency();Retrieves the frequency of the monitor being driven by the DirectDraw object. The frequency value is returned in Hz multiplied by 100. For example, 60Hz is returned as 6000.
Return Value:
Returns the frequency.
public int GetScanLine();Retrieves the scanline that is currently being drawn on the monitor.
Return Value:
Returns the scanline.
See Also: GetVerticalBlankStatus, WaitForVerticalBlank
public int GetVerticalBlankStatus();Retrieves the status of the vertical blank.
Return Value:
Returns TRUE if a vertical blank is occurring, and FALSE otherwise.
Remarks:
To synchronize with the vertical blank, use the WaitForVerticalBlank method.
See Also: GetScanLine, WaitForVerticalBlank
public ddPalette LoadPaletteFromBitmap(String bName);Loads a palette.
Return Value:
Returns the ddPalette object if successful; null otherwise.
Parameter Description bName Name of the bitmap that contains the palette to load.
public void RestoreDisplayMode();Resets the mode of the display device hardware for the primary surface to what it was before the SetDisplayMode method was called. Exclusive-level access is required to use this method.
Return Value:
No return value.
See Also: SetDisplayMode, EnumDisplayModes, SetCooperativeLevel
public void SetCooperativeLevel(int hdl, int flags);Determines the top-level behavior of the application.
Return Value:
No return value.
Parameter Description hdl Window handle used for the application. flags One or more values of DDSCL_ type. See Also: SetDisplayMode, Compact, EnumDisplayModes
public void SetDisplayMode(int w, int h, int bpp, int ref, int mode);Sets the mode of the display-device hardware.
Return Value:
No return value.
Parameter Description w and h Width and height of the new mode. bpp Bits per pixel of the new mode. ref Refresh rate of the new mode. mode Reserved; must be 0. Remarks:
The SetCooperativeLevel method must be used to set exclusive-level access before the mode can be changed. If other applications have created a ddSurface object on the primary surface and the mode is changed, those applications' primary surface objects return DDERR_SURFACELOST until they are restored.
See Also: RestoreDisplayMode, GetDisplayMode, EnumDisplayModes, SetCooperativeLevel
public void WaitForVerticalBlank(int flags, int handle);Helps the application synchronize itself with the vertical-blank interval.
Return Value:
No return value.
Parameter Description flags One value of DDWAITVB_ type, specifying how long to wait for the vertical blank. handle Handle of the event to be triggered when the vertical blank begins. See Also: GetVerticalBlankStatus, GetScanLine
public d3d Create3D();Creates a Direct3D object.
Return Value:
Returns the d3d object if successful; null otherwise.
public int SystemBpp();Returns the current system bits-per-pixel value.
Return Value:
Returns the bits-per-pixel.
public int TickCount();Returns the current tick count.
Return Value:
Returns the count.