IRdBitmap Interface Reference

Inherits IRsDataObject.

Inherited by CRdBitmap, and CRdBitmap.

List of all members.

Public Member Functions

HRESULT Clear (void)
HRESULT Create ([in] RtDWORD nWidth,[in] RtDWORD nHeight,[in] RtPixelFormat PixelFormat)
HRESULT ConvertFormat ([in] RtPixelFormat pFormat)
HRESULT GetHeader ([out] RtDWORD *pdwWidth,[out] RtDWORD *pdwHeight,[out] RtPixelFormat *pFormat)
HRESULT GetFormatDesc ([out] RtPixelFormatDesc *pDesc)
HRESULT GetSizeX ([out, retval] RtDWORD *pOut)
HRESULT GetSizeY ([out, retval] RtDWORD *pOut)
HRESULT GetFormatString ([out, retval] BSTR *pOut)
HRESULT GetFormat ([out, retval] RtPixelFormat *pOut)
HRESULT GetFormatNumberFromString ([in] BSTR bsFormat,[out, retval] RtPixelFormat *pOut)
HRESULT GetFormatStringFromNumber ([in] RtPixelFormat Format,[out, retval] BSTR *pOut)
HRESULT GetPixel ([in] RtDWORD dwPositionX,[in] RtDWORD dwPositionY,[in] IRdColor *pOutValue)
HRESULT SetPixel ([in] RtDWORD dwPositionX,[in] RtDWORD dwPositionY,[in] IRdColor *pInValue)
HRESULT GetPixelCOLORREF ([in] RtDWORD dwPositionX,[in] RtDWORD dwPositionY,[in] COLORREF *pOutValue)
HRESULT GetPixelBuffer ([in] RtFlags dwFlags,[out] void **pBuffer)
HRESULT CommitPixelBuffer ([in] void *pBuffer)
HRESULT LockBitmap ()
HRESULT UnlockBitmap ()
HRESULT CreateDDBitmap ([in] HDC hDC,[out, retval] HBITMAP *pHBitmap)
HRESULT CreateDDBitmapResized ([in] HDC hDC,[in] int sizeX,[in] int sizeY,[out, retval] HBITMAP *pHBitmap)
HRESULT LoadFromFile ([in] BSTR FileName)
HRESULT LoadFromResources ([in] HINSTANCE hInstance,[in]RtUlong dwResourceId)
HRESULT GetFileName ([out, retval] BSTR *pFileName)
HRESULT SetIsFromFile ([in] RtBool bIsFromFile,[in] BSTR bstrFileName)
HRESULT SetHBitmap ([in] HBITMAP hBitmap)
HRESULT SaveToFile ([in] RtBitmapFileFormat Format,[in] BSTR FileName)
HRESULT SaveToFileEx ([in] RtBitmapFileFormat Format,[in] BSTR FileName)
HRESULT Resize ([in] RtDWORD dwWidth,[in] RtDWORD dwHeight)
HRESULT SetAdvancedFeature ([in] GUID FeatureID,[in] DWORD FeatureModifier,[in] VARIANT FeatureData)
HRESULT GetAdvancedFeature ([in] GUID FeatureID,[out] DWORD *FeatureModifier,[out] VARIANT *FeatureData)
HRESULT IsAdvancedFeatureSupported ([in] GUID FeatureID)
HRESULT GetSupportedFormatCount ([out, retval] DWORD *dwFormatCount)
HRESULT GetSupportedFormat ([in] DWORD dwFormat,[out] BSTR *bsMasks,[out] BSTR *bsFormatName)
HRESULT IsEqual ([in] IRdBitmap *pBitmap,[out, retval] BOOL *bEqualityResult)
HRESULT ImageSizeFromFile ([in]BSTR FileName,[out] DWORD *width,[out] DWORD *height)
HRESULT GetDownsampledFlag ([out, retval] RtBool *pVal)
HRESULT SetDownsampledFlag ([in] RtBool newVal)
HRESULT SaveAsFileToStream ([in] IStream *pStream,[in] RtBitmapFileFormat format,[in] RtBool bSaveSizeToStream,[out, retval] RtDWORD *pdwSize)
HRESULT LoadAsFileFromStream ([in] IStream *pStream,[in] RtDWORD dwSize)
HRESULT CreateDIBitmap32 ([in] HDC hDC,[out, retval] HBITMAP *pHBitmap)
HRESULT GrayscaleBitmap ([in] int iGrayPercent,[in] RtBool bPixelTransparent)
HRESULT DrawBitmap ([in] HDC hDC,[in] int left,[in] int top,[in] RtBool bPixelTransparent)
HRESULT GetAlphaBlendBitmap ([in] HDC hDC,[in] int left,[in] int top,[in] RtBool bPixelTransparent,[out, retval] HBITMAP *pHBitmap)
HRESULT GetBitmapSize ([out] SIZE *pSize)
HRESULT DrawBitmap32 ([in] HDC hDC,[in] int left,[in] int top,[in] RtBYTE bConsAlphaBlend,[in] RtBool bKeepVisible)


Detailed Description

IRdBitmap.

Member Function Documentation

HRESULT IRdBitmap::Clear ( void   ) 

Clear all data in the bitmap.

  • Create has to be called to use the bitmap.

HRESULT IRdBitmap::Create ( [in] RtDWORD  nWidth,
[in] RtDWORD  nHeight,
[in] RtPixelFormat  PixelFormat 
)

Creates the internal buffers of the bitmap and prepares the bitmap for use.

Parameters:
nWidth [in] Specifies desired width of the bitmap.
nHeight [in] Specifies height of the bitmap.
PixelFormat [in] Specifies the pixel format of the bitmap.
Returns:
Standard HRESULT processing can be applied to the result.
Return values:
E_INVALIDARG for invalid dimensions or format.
E_OUTOFMEMORY if bitmap does not fit into the memory.

HRESULT IRdBitmap::ConvertFormat ( [in] RtPixelFormat  pFormat  ) 

Convert bitmap from one format to another.

Parameters:
pFormat [in] Specifies the new format of the bitmap.
Return values:
E_FAIL is returned if bitmap is empty.
E_INVALIDARG is returned if new format type is not valid.
E_OUTOFMEMORY is returned if new bitmap does not fit into the memory.
Returns:
Standard HRESULT processing can be applied to the result.

HRESULT IRdBitmap::GetHeader ( [out] RtDWORD *  pdwWidth,
[out] RtDWORD *  pdwHeight,
[out] RtPixelFormat *  pFormat 
)

Return the header information of the bitmap.

Parameters:
pdwWidth [out] Is filled with the width of the bitmap.
  • Specify NULL if you do not require this information.
pdwHeight [out] Is filled with the height of the bitmap.
  • Specify NULL if you do not require this information.
pFormat [out] Is filled with the format of the bitmap.
  • Specify NULL if you do not require this information.
Returns:
Standard HRESULT processing can be applied to the result.

HRESULT IRdBitmap::GetFormatDesc ( [out] RtPixelFormatDesc pDesc  ) 

Return the pixel format description.

Parameters:
pDesc [out] Is filled with the format description of the bitmap.
Returns:
Standard HRESULT processing can be applied to the result.

HRESULT IRdBitmap::GetSizeX ( [out, retval] RtDWORD *  pOut  ) 

Get the horizontal size.

Returns:
pOut [out, retval] Is filled with the horizontal size of the bitmap.

Standard HRESULT processing can be applied to the result.

HRESULT IRdBitmap::GetSizeY ( [out, retval] RtDWORD *  pOut  ) 

Get the vertical size.

Returns:
pOut [out, retval] Is filled with the vertical size of the bitmap.

Standard HRESULT processing can be applied to the result.

HRESULT IRdBitmap::GetFormatString ( [out, retval] BSTR *  pOut  ) 

Get the pixel format in a string.

Returns:
pOut [out, retval] Is filled with the format of the bitmap in a string descriptor for usage in scripts.

Standard HRESULT processing can be applied to the result.

HRESULT IRdBitmap::GetFormat ( [out, retval] RtPixelFormat *  pOut  ) 

Get the pixel format.

Returns:
pOut [out, retval] Is filled with the format of the bitmap.

Standard HRESULT processing can be applied to the result.

HRESULT IRdBitmap::GetFormatNumberFromString ( [in] BSTR  bsFormat,
[out, retval] RtPixelFormat *  pOut 
)

Convert string format to the enumeration number.

Parameters:
bsFormat [in] Specifies the pixel format in the string.
Returns:
pOut [out, retval] Is filled with the format of the bitmap that can be used in Create method.

Standard HRESULT processing can be applied to the result.

Return values:
E_INVALIDARG is returned for invalid format.

HRESULT IRdBitmap::GetFormatStringFromNumber ( [in] RtPixelFormat  Format,
[out, retval] BSTR *  pOut 
)

Get the pixel format string from a number.

Parameters:
Format [in] Specifies the pixel format in a number form.
Returns:
pOut [out, retval] Is filled with the format of the bitmap in the string form.

Standard HRESULT processing can be applied to the result.

Return values:
E_INVALIDARG is returned for invalid format.

HRESULT IRdBitmap::GetPixel ( [in] RtDWORD  dwPositionX,
[in] RtDWORD  dwPositionY,
[in] IRdColor pOutValue 
)

Return pixel color at given position.

Parameters:
dwPositionX [in] Specifies the horizontal position of a pixel.
dwPositionY [in] Specifies the vertical position of a pixel.
pOutValue [in] Passed Color object is filled with color.
Returns:
Standard HRESULT processing can be applied to the result.
Return values:
E_INVALIDARG is returned for position out of bounds.
E_FAIL is returned also for unknown format and when lock failed.

HRESULT IRdBitmap::SetPixel ( [in] RtDWORD  dwPositionX,
[in] RtDWORD  dwPositionY,
[in] IRdColor pInValue 
)

Set pixel color at given position.

Parameters:
dwPositionX [in] Specifies the horizontal position of a pixel.
dwPositionY [in] Specifies the vertical position of a pixel.
pInValue [in] Specifies new color of the pixel.
Returns:
Standard HRESULT processing can be applied to the result.
Return values:
E_INVALIDARG is returned for position out of bounds.
E_FAIL is returned also for unknown format and when lock failed.

HRESULT IRdBitmap::GetPixelCOLORREF ( [in] RtDWORD  dwPositionX,
[in] RtDWORD  dwPositionY,
[in] COLORREF *  pOutValue 
)

Get/Return pixel at given position in the COLORREF format.

Parameters:
dwPositionX [in] Specifies the horizontal position of a pixel.
dwPositionY [in] Specifies the vertical position of a pixel.
pOutValue [in] Passed Color object is filled with color.
Returns:
Standard HRESULT processing can be applied to the result.
Return values:
E_INVALIDARG is returned for position out of bounds.
E_FAIL is returned also for unknown format and when lock failed.

HRESULT IRdBitmap::GetPixelBuffer ( [in] RtFlags  dwFlags,
[out] void **  pBuffer 
)

This method returns pointer to the pixel buffer of the bitmap.

  • Caller cannot modify contents of the buffer if he does not specify BFLG_WILLOVERWRITE in a flag.
  • Caller has to return the buffer to the bitmap using CommitPixelBuffer.
  • Buffer alignment is top-left to bottom - this means that top-left pixel is considered to be [0][0] and therefore is at the buffer start.
  • Use CRsBitmapBufLock for safe pairing of locks and unlocks.
Parameters:
dwFlags [in] specifies the flags of the lock - can be any combination of RtBitmapBufferFlags members.
pBuffer [out] is filled with the pointer to the data buffer.
Returns:
Standard HRESULT processing can be applied to the result.
Return values:
E_FAIL is returned for uninitialized bitmap or when lock is not possible.

HRESULT IRdBitmap::CommitPixelBuffer ( [in] void *  pBuffer  ) 

This method returns the locked buffer back to bitmap.

  • Buffer pointer becomes invalid.
  • Use CRsBitmapBufLock for safe pairing of lock and unlock.
Parameters:
pBuffer [in] specifies the buffer returned by GetPixelBuffer.
Returns:
Standard HRESULT processing can be applied to the result.
Return values:
E_FAIL is returned for uninitialized/unlocked bitmap or when unlock is not possible.

HRESULT IRdBitmap::LockBitmap (  ) 

Lock the bitmap:

  • Access to methods from other threads will not be possible until UnlockBitmap is called.
Warning:
Use CRsBitmapLock from Utils for safe lock and unlock.
Returns:
Standard HRESULT processing can be applied to the result.

HRESULT IRdBitmap::UnlockBitmap (  ) 

Unlock the bitmap after previous call to LockBitmap.

Warning:
Use CRsBitmapLock from Utils for safe lock and unlock.
Returns:
Standard HRESULT processing can be applied to the result.

HRESULT IRdBitmap::CreateDDBitmap ( [in] HDC  hDC,
[out, retval] HBITMAP *  pHBitmap 
)

This method creates a new device dependent bitmap (DDB) and fills it with color data.

Parameters:
hDC [in] specifies the device context.
Returns:
pHBitmap [out, retval] is filled with new DDB.

Standard HRESULT processing can be applied to the result.

HRESULT IRdBitmap::CreateDDBitmapResized ( [in] HDC  hDC,
[in] int  sizeX,
[in] int  sizeY,
[out, retval] HBITMAP *  pHBitmap 
)

This method creates a new device dependent bitmap (DDB) of given size and fills it with color data.

Parameters:
hDC [in] specifies the device context.
sizeX [in] specifies desired width of the bitmap.
sizeY [in] specifies desired height of the bitmap.
Returns:
pHBitmap [out, retval] is filled with new DDB.

Standard HRESULT processing can be applied to the result.

HRESULT IRdBitmap::LoadFromFile ( [in] BSTR  FileName  ) 

This method is used to load an image from file.

  • Previous bitmap contents are discarded.
Parameters:
FileName [in] specifies the file name (including optional path) for load.
Returns:
Standard HRESULT processing can be applied to the result.

E_INVALIDARG for unsupported format.

HRESULT IRdBitmap::LoadFromResources ( [in] HINSTANCE  hInstance,
[in] RtUlong  dwResourceId 
)

This method is used to load image from a dll resource.

  • Previous bitmap contents are discarded.
Parameters:
hInstance [in] .
dwResourceId [in] .
Returns:
Standard HRESULT processing can be applied to the result.

E_INVALIDARG for unsupported format.

HRESULT IRdBitmap::GetFileName ( [out, retval] BSTR *  pFileName  ) 

Get filename of the bitmap, if it was loaded from file.

Returns:
pFileName [out, retval] Is filled with the name of the file.

Standard HRESULT processing can be applied to the result.

Return values:
S_OK if file was loaded from file
S_FALSE if file was not loaded from file.

HRESULT IRdBitmap::SetIsFromFile ( [in] RtBool  bIsFromFile,
[in] BSTR  bstrFileName 
)

Set IsFromFile flag and filename of the bitmap:

  • Useful if/when you modified the bitmap but still want to keep track of origin filename.
Parameters:
bIsFromFile [in] Specifies if bitmap was loaded from file (TRUE) or not (FALSE).
bstrFileName [in] Specifies the filename of the bitmap.
Returns:
Standard HRESULT processing can be applied to the result.

HRESULT IRdBitmap::SetHBitmap ( [in] HBITMAP  hBitmap  ) 

This method is used to load image from a HBITMAP handle.

  • Previous bitmap contents are discarded.
Parameters:
hBitmap [in] specifies the valid bitmap handle used as a source for data.
Returns:
Standard HRESULT processing can be applied to the result.

HRESULT IRdBitmap::SaveToFile ( [in] RtBitmapFileFormat  Format,
[in] BSTR  FileName 
)

This method is used to save image to a file.

Parameters:
Format [in] Specifies the format of a bitmap.
FileName [in] Specifies the target filename of a bitmap.
Returns:
Standard HRESULT processing can be applied to the result.

HRESULT IRdBitmap::SaveToFileEx ( [in] RtBitmapFileFormat  Format,
[in] BSTR  FileName 
)

This method is used to save image to a file using external image library (alpha channel supported).

Parameters:
Format [in] Specifies the format of a bitmap.
FileName [in] Specifies the target filename of a bitmap.
Returns:
Standard HRESULT processing can be applied to the result.

HRESULT IRdBitmap::Resize ( [in] RtDWORD  dwWidth,
[in] RtDWORD  dwHeight 
)

This method is used to resize the bitmap.

Parameters:
dwWidth [in] Specifies new width of the bitmap.
dwHeight [in] Specifies new height of the bitmap.
Returns:
Standard HRESULT processing can be applied to the result.

HRESULT IRdBitmap::SetAdvancedFeature ( [in] GUID  FeatureID,
[in] DWORD  FeatureModifier,
[in] VARIANT  FeatureData 
)

This method sets properties of extensible advanced features of the bitmap.

  • This provides extensible mechanism for features.
  • Implementation should return E_NOTIMPL for unsupported feature.
FeatureID [in] Specifies the ID of the feature. FeatureModifier [in] Specifies feature specific modifier to use. FeatureData [in] Specifies feature specific data to use.

Returns:
Standard HRESULT processing can be applied to the result.
Return values:
E_NOTIMPL is returned for unsupported FeatureID.

HRESULT IRdBitmap::GetAdvancedFeature ( [in] GUID  FeatureID,
[out] DWORD *  FeatureModifier,
[out] VARIANT *  FeatureData 
)

This method gets properties of extensible advanced features of the bitmap.

  • This provides extensible mechanism for features.
  • Implementation should return E_NOTIMPL for unsupported feature
FeatureID [in] Specifies the ID of the feature. FeatureModifier [out] Is filled with feature specific modifier. FeatureData [out] Is filled with feature specific data.

Returns:
Standard HRESULT processing can be applied to the result.
Return values:
E_NOTIMPL is returned for unsupported FeatureID.

HRESULT IRdBitmap::IsAdvancedFeatureSupported ( [in] GUID  FeatureID  ) 

This method can be used to determine if advanced feature is supported for bitmap:

  • S_OK is returned for supported feature.
  • S_FALSE for unsupported feature.
  • No other success codes are allowed and error codes are reserved for method failure.
FeatureID [in] Specifies the ID of the feature.

Returns:
Standard HRESULT processing can be applied to the result.
Return values:
S_OK is returned for supported feature.
S_FALSE is returned for unsupported feature.

HRESULT IRdBitmap::GetSupportedFormatCount ( [out, retval] DWORD *  dwFormatCount  ) 

Return the number of supported loadable formats for enumeration through GetSupportedFormat.

Returns:
dwFormatCount [out, retval] Is filled with number of loadable formats.

Standard HRESULT processing can be applied to the result.

HRESULT IRdBitmap::GetSupportedFormat ( [in] DWORD  dwFormat,
[out] BSTR *  bsMasks,
[out] BSTR *  bsFormatName 
)

Return the information about supported format.

Parameters:
dwFormat [in] Specifies the format index.
bsMasks [out] Is filled with the possible file masks separated by ; (i.e. *.gif or *.jpg;*.jpeg).
bsFormatName [out] Is filled with the name of the format.
Returns:
Standard HRESULT processing can be applied to the result.
Return values:
E_INVALIDARG is returned for invalid index.

HRESULT IRdBitmap::IsEqual ( [in] IRdBitmap pBitmap,
[out, retval] BOOL *  bEqualityResult 
)

Checks bitmap for equality with other bitmap.

  • Return S_OK if bitmaps are equal.
  • Return S_FALSE if they are not equal.
Parameters:
pBitmap [in] Specifies the other bitmap in the test.
Returns:
bEqualityResult [out, retval] Optional BOOL parameter is provided for script usage:
  • If not NULL it is filled with TRUE for equal bitmaps and FALSE for unequal.

Standard HRESULT processing can be applied to the result.

Return values:
S_OK for equal bitmaps.
S_FALSE for non equal bitmaps.
E_XXX error code should be also considered as non-equality result.

HRESULT IRdBitmap::ImageSizeFromFile ( [in] BSTR  FileName,
[out] DWORD *  width,
[out] DWORD *  height 
)

Return Width and Height of the file on disk (if supported).

Parameters:
FileName [in] Specifies the name (and path) of a file to return size.
width [out] Is filled with the width of the bitmap in file.
height [out] Is filled with the height of the bitmap in file.
Returns:
Standard HRESULT processing can be applied to the result.
Return values:
S_OK if image file was found and size was returned.

HRESULT IRdBitmap::GetDownsampledFlag ( [out, retval] RtBool *  pVal  ) 

Get down-sampled flag.

Returns:
pVal [out, retval] Is filled with true if texture has been down-sampled after load from file.

Standard HRESULT processing can be applied to the result.

HRESULT IRdBitmap::SetDownsampledFlag ( [in] RtBool  newVal  ) 

Set down-sampled flag.

Parameters:
newVal [in] Specifies the value of down-sampling.
Returns:
Standard HRESULT processing can be applied to the result.

HRESULT IRdBitmap::SaveAsFileToStream ( [in] IStream *  pStream,
[in] RtBitmapFileFormat  format,
[in] RtBool  bSaveSizeToStream,
[out, retval] RtDWORD *  pdwSize 
)

Save the bitmap as file into stream.

Parameters:
pStream [in] Destination Stream to which the bitmap will be saved.
format [in] File format in which the bitmap will be saved.
bSaveSizeToStream [in] If , then the saved bitmap size will be written as first (type of DWORD) and only then the bitmap itself will be saved.
Returns:
pdwSize [out, retval] Number of saved data.

Standard HRESULT processing can be applied to the result.

HRESULT IRdBitmap::LoadAsFileFromStream ( [in] IStream *  pStream,
[in] RtDWORD  dwSize 
)

Load the bitmap as file from stream.

Parameters:
pStream [in] Source stream.
dwSize [in] Size of the bitmap in the stream.
  • If you specify 0, then the size is read from the stream.
Returns:
Standard HRESULT processing can be applied to the result.

HRESULT IRdBitmap::CreateDIBitmap32 ( [in] HDC  hDC,
[out, retval] HBITMAP *  pHBitmap 
)

This method creates device independent bitmap 32bit (DIB) and fills it with color data.

Parameters:
hDC [in] specifies the device context.
Returns:
pHBitmap [out, retval] Is filled with new DIB.

Standard HRESULT processing can be applied to the result.

HRESULT IRdBitmap::GrayscaleBitmap ( [in] int  iGrayPercent,
[in] RtBool  bPixelTransparent 
)

This method change bitmap data to gray scale bitmap if iGrayPercent is 100 or change saturation of bitmap.

Parameters:
iGrayPercent [in] Degree of desaturation.
bPixelTransparent [in] If true leave the first pixel of bitmap (and others of the same color) unchanged.
Returns:
Standard HRESULT processing can be applied to the result.

HRESULT IRdBitmap::DrawBitmap ( [in] HDC  hDC,
[in] int  left,
[in] int  top,
[in] RtBool  bPixelTransparent 
)

This method sends the bitmap data to the hDC (device context).

Parameters:
hDC [in] Specifies the device context.
left [in] Specifies the horizontal location, in device units, at which to draw the image.
top [in] Specifies the vertical location, in device units, at which to draw the image.
bPixelTransparent [in] If true leave the first pixel of bitmap (and others of the same color) unchanged.
Returns:
Standard HRESULT processing can be applied to the result.

HRESULT IRdBitmap::GetAlphaBlendBitmap ( [in] HDC  hDC,
[in] int  left,
[in] int  top,
[in] RtBool  bPixelTransparent,
[out, retval] HBITMAP *  pHBitmap 
)

This method return alpha blend bitmap.

Parameters:
hDC [in] Specifies the device context.
left [in] Specifies the horizontal location, in device units, at which to draw the image.
top [in] Specifies the vertical location, in device units, at which to draw the image.
bPixelTransparent [in] If true leave the first pixel of bitmap (and others of the same color) unchanged.
Returns:
pHBitmap [out, retval] Is filled with alpha blend bitmap.

Standard HRESULT processing can be applied to the result.

HRESULT IRdBitmap::GetBitmapSize ( [out] SIZE *  pSize  ) 

This method returns dimension of the bitmap.

Parameters:
pSize [out] Is filled with the size of the bitmap.
Returns:
Standard HRESULT processing can be applied to the result.

HRESULT IRdBitmap::DrawBitmap32 ( [in] HDC  hDC,
[in] int  left,
[in] int  top,
[in] RtBYTE  bConsAlphaBlend,
[in] RtBool  bKeepVisible 
)

This method sends the bitmap data to the hDC (device context).

Parameters:
hDC [in] Specifies the device context.
left [in] Specifies the horizontal location, in device units, at which to draw the image.
top [in] Specifies the vertical location, in device units, at which to draw the image.
bConstantAlpha [in] Specifies the value of additional constant alpha value during drawing the image, if value is 255, origin bitmap alpha channel is used, otherwise is rescale by this value.
Returns:
Standard HRESULT processing can be applied to the result.


Generated on Wed May 20 21:31:58 2009 for trueSpace7.6 SDK by  doxygen 1.5.5