Public Member Functions | |
| HRESULT | Clear (void) |
| HRESULT | Create ([in] RtDWORD nWidth,[in] RtDWORD nHeight,[in] RtPixelFormat PixelFormat) |
| HRESULT | CreateEx ([in] RtDWORD nWidth,[in] RtDWORD nHeight,[in] BSTR bsFormat) |
| HRESULT | ConvertFormat ([in] RtPixelFormat pFormat) |
| HRESULT | GetHeader ([out] RtDWORD *pdwWidth,[out] RtDWORD *pdwHeight,[out] RtPixelFormat *pFormat) |
| 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] IDispatch *pOutValue) |
| HRESULT | SetPixel ([in] RtDWORD dwPositionX,[in] RtDWORD dwPositionY,[in] IDispatch *pInValue) |
| HRESULT | GetPixelCOLORREF ([in] RtDWORD dwPositionX,[in] RtDWORD dwPositionY,[out, retval] COLORREF *pOutValue) |
| HRESULT | LockBitmap () |
| HRESULT | UnlockBitmap () |
| HRESULT | LoadFromFile ([in] BSTR FileName) |
| HRESULT | GetFileName ([out, retval] BSTR *pFileName) |
| HRESULT | SetIsFromFile ([in] RtBool bIsFromFile,[in] BSTR bstrFileName) |
| HRESULT | SaveToFile ([in] RtBitmapFileFormat Format,[in] BSTR FileName) |
| HRESULT | Resize ([in] RtDWORD dwWidth,[in] RtDWORD dwHeight) |
| HRESULT | GetSupportedFormatCount ([out, retval] DWORD *dwFormatCount) |
| HRESULT | GetSupportedFormatMasks ([in] DWORD dwFormat,[out, retval] BSTR *bsMasks) |
| HRESULT | GetSupportedFormatName ([in] DWORD dwFormat,[out, retval] BSTR *bsFormatName) |
| HRESULT | IsEqual ([in] IDispatch *pBitmap,[out, retval] BOOL *bEqualityResult) |
| HRESULT | GetImageSizeFromFile ([in] BSTR FileName,[out, retval] VARIANT *pvRetInfo) |
| HRESULT | GetDownsampledFlag ([out, retval] RtBool *pVal) |
| HRESULT | SetDownsampledFlag ([in] RtBool newVal) |
| HRESULT | SaveToFileEx ([in] RtBitmapFileFormat Format,[in] BSTR FileName) |
| HRESULT | Clear (void) |
| HRESULT | Create ([in] RtDWORD nWidth,[in] RtDWORD nHeight,[in] RtPixelFormat PixelFormat) |
| HRESULT | CreateEx ([in] RtDWORD nWidth,[in] RtDWORD nHeight,[in] BSTR bsFormat) |
| HRESULT | ConvertFormat ([in] RtPixelFormat pFormat) |
| HRESULT | GetHeader ([out] RtDWORD *pdwWidth,[out] RtDWORD *pdwHeight,[out] RtPixelFormat *pFormat) |
| 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] IDispatch *pOutValue) |
| HRESULT | SetPixel ([in] RtDWORD dwPositionX,[in] RtDWORD dwPositionY,[in] IDispatch *pInValue) |
| HRESULT | GetPixelCOLORREF ([in] RtDWORD dwPositionX,[in] RtDWORD dwPositionY,[out, retval] COLORREF *pOutValue) |
| HRESULT | LockBitmap () |
| HRESULT | UnlockBitmap () |
| HRESULT | LoadFromFile ([in] BSTR FileName) |
| HRESULT | GetFileName ([out, retval] BSTR *pFileName) |
| HRESULT | SetIsFromFile ([in] RtBool bIsFromFile,[in] BSTR bstrFileName) |
| HRESULT | SaveToFile ([in] RtBitmapFileFormat Format,[in] BSTR FileName) |
| HRESULT | Resize ([in] RtDWORD dwWidth,[in] RtDWORD dwHeight) |
| HRESULT | GetSupportedFormatCount ([out, retval] DWORD *dwFormatCount) |
| HRESULT | GetSupportedFormatMasks ([in] DWORD dwFormat,[out, retval] BSTR *bsMasks) |
| HRESULT | GetSupportedFormatName ([in] DWORD dwFormat,[out, retval] BSTR *bsFormatName) |
| HRESULT | IsEqual ([in] IDispatch *pBitmap,[out, retval] BOOL *bEqualityResult) |
| HRESULT | GetImageSizeFromFile ([in] BSTR FileName,[out, retval] VARIANT *pvRetInfo) |
| HRESULT | GetDownsampledFlag ([out, retval] RtBool *pVal) |
| HRESULT | SetDownsampledFlag ([in] RtBool newVal) |
| HRESULT | SaveToFileEx ([in] RtBitmapFileFormat Format,[in] BSTR FileName) |
| HRESULT IRdBitmapDisp::Clear | ( | void | ) |
Clear all data in the bitmap. Create has to be called to use the bitmap.
bitMap is an attribute created on Script Editor Attributes tab.
bitMap is of type "Common Data Package/Bitmap Data".
bitMap.Clear();
| HRESULT IRdBitmapDisp::Create | ( | [in] RtDWORD | nWidth, | |
| [in] RtDWORD | nHeight, | |||
| [in] RtPixelFormat | PixelFormat | |||
| ) |
Creates the internal buffers of the bitmap and prepares the bitmap for the use.
| nWidth | [in] Specifies desired width of the bitmap. | |
| nHeight | [in] Specifies height of the bitmap. | |
| PixelFormat | [in] Specifies the pixel format of the bitmap. |
| E_INVALIDARG | for invalid dimensions or format. | |
| E_OUTOFMEMORY | if bitmap does not fit into the memory. |
bitMap.Create(width, height, format); // format as number
| HRESULT IRdBitmapDisp::CreateEx | ( | [in] RtDWORD | nWidth, | |
| [in] RtDWORD | nHeight, | |||
| [in] BSTR | bsFormat | |||
| ) |
Creates the internal buffers of the bitmap and prepares the bitmap for the use.
| nWidth | [in] Specifies desired width of the bitmap. | |
| nHeight | [in] Specifies height of the bitmap. | |
| bsFormat | [in] Specifies the pixel format of the bitmap in string form. |
| E_INVALIDARG | for invalid dimensions or format | |
| E_OUTOFMEMORY | if bitmap does not fit into the memory |
var outBitMap = System.CreateDO('Common Data Package/Bitmap Data'); outBitMap.CreateEx( sizeX, sizeY, 'A8R8G8B8' ); //standard 32bit unsigned ARGB
| HRESULT IRdBitmapDisp::ConvertFormat | ( | [in] RtPixelFormat | pFormat | ) |
Convert bitmap from one format to another.
| pFormat | [in] Specifies the new format of the bitmap. |
| 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. |
bitMap.ConvertFormat(2);
| HRESULT IRdBitmapDisp::GetHeader | ( | [out] RtDWORD * | pdwWidth, | |
| [out] RtDWORD * | pdwHeight, | |||
| [out] RtPixelFormat * | pFormat | |||
| ) |
Return the header information of the bitmap.
| 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. |
var a = bitMap.GetHeader(width, height, format);
| HRESULT IRdBitmapDisp::GetSizeX | ( | [out, retval] RtDWORD * | pOut | ) |
Get the horizontal size.
Standard HRESULT processing can be applied to the result.
var sizeX = bitMap.GetSizeX();
| HRESULT IRdBitmapDisp::GetSizeY | ( | [out, retval] RtDWORD * | pOut | ) |
Get the vertical size
Standard HRESULT processing can be applied to the result.
var sizeY = bitMap.GetSizeY();
| HRESULT IRdBitmapDisp::GetFormatString | ( | [out, retval] BSTR * | pOut | ) |
Get the pixel format in a string value.
Standard HRESULT processing can be applied to the result.
var bmpFstr = bitMap.GetFormatString();
| HRESULT IRdBitmapDisp::GetFormat | ( | [out, retval] RtPixelFormat * | pOut | ) |
Get the pixel format of the bitmap in numeric form:
Standard HRESULT processing can be applied to the result.
var bmpFormat = bitMap.GetFormat();
| HRESULT IRdBitmapDisp::GetFormatNumberFromString | ( | [in] BSTR | bsFormat, | |
| [out, retval] RtPixelFormat * | pOut | |||
| ) |
Convert string format to the enumeration number.
| bsFormat | [in] Specifies the pixel format in the string. |
Standard HRESULT processing can be applied to the result.
| E_INVALIDARG | is returned for invalid format. |
var bmpFFStr = bitMap.GetFormatNumberFromString(bmpFstr);
| HRESULT IRdBitmapDisp::GetFormatStringFromNumber | ( | [in] RtPixelFormat | Format, | |
| [out, retval] BSTR * | pOut | |||
| ) |
Get the pixel format string from a number.
| Format | [in] Specifies the pixel format in a number form. |
Standard HRESULT processing can be applied to the result.
| E_INVALIDARG | is returned for invalid format. |
var bmpFstrNum = bitMap.GetFormatStringFromNumber(bmpFFStr);
| HRESULT IRdBitmapDisp::GetPixel | ( | [in] RtDWORD | dwPositionX, | |
| [in] RtDWORD | dwPositionY, | |||
| [in] IDispatch * | pOutValue | |||
| ) |
Return pixel color at given position.
| 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. |
| E_INVALIDARG | is returned for position out of bounds. | |
| E_FAIL | is returned also for unknown format and when lock failed. |
var pColor = System.CreateDO('Common Data Package/Color Data');
var sizeX = bitMap.GetSizeX();
var sizeY = bitMap.GetSizeY();
bitMap.GetPixel(sizeX-1,sizeY-1,pColor);
var alpha = pColor.GetAlpha();
var red = pColor.GetRed();
var green = pColor.GetGreen();
var blue = pColor.GetBlue();
| HRESULT IRdBitmapDisp::SetPixel | ( | [in] RtDWORD | dwPositionX, | |
| [in] RtDWORD | dwPositionY, | |||
| [in] IDispatch * | pInValue | |||
| ) |
Set pixel color at given position.
| 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. |
| E_INVALIDARG | is returned for position out of bounds. | |
| E_FAIL | is returned also for unknown format and when lock failed. |
var pColor = System.CreateDO('Common Data Package/Color Data');
pColor.SetAlpha(Math.Random());
pColor.SetRed(Math.Random());
pColor.SetGreen(Math.Random());
pColor.SetBlue(Math.Random());
bitMap.SetPixel(x,y,pColor);
| HRESULT IRdBitmapDisp::GetPixelCOLORREF | ( | [in] RtDWORD | dwPositionX, | |
| [in] RtDWORD | dwPositionY, | |||
| [out, retval] COLORREF * | pOutValue | |||
| ) |
Return pixel at given position in the COLORREF format.
| dwPositionX | [in] Specifies the horizontal position of a pixel. | |
| dwPositionY | [in] Specifies the vertical position of a pixel. |
Standard HRESULT processing can be applied to the result.
| E_INVALIDARG | is returned for position out of bounds. | |
| E_FAIL | is returned also for unknown format and when lock failed. |
var color = bitMap.GetPixelCOLORREF(x,y);
| HRESULT IRdBitmapDisp::LockBitmap | ( | ) |
Lock the bitmap - access to methods from other threads will not be possible until UnlockBitmap is called.
bitMap.LockBitmap();
| HRESULT IRdBitmapDisp::UnlockBitmap | ( | ) |
Unlock the bitmap after previous call to LockBitmap.
bitMap.UnlockBitmap();
| HRESULT IRdBitmapDisp::LoadFromFile | ( | [in] BSTR | FileName | ) |
This method is used to load image from a file. Previous bitmap contents are discarded.
| FileName | [in] Specifies the file name (including optional path) for load. |
E_INVALIDARG for unsupported format.
var FileName = params.ConValue('FileName'); var ImageLoaded = System.CreateDO("Common Data Package/Bitmap Data"); ImageLoaded.LoadFromFile(FileName); params.ConValue("ImageLoaded") = ImageLoaded;
| HRESULT IRdBitmapDisp::GetFileName | ( | [out, retval] BSTR * | pFileName | ) |
Get filename of the bitmap if it was loaded from file.
Standard HRESULT processing can be applied to the result.
| S_OK | if file was loaded from file. | |
| S_FALSE | if file was not loaded from file. |
System.Alert(ImageLoaded.GetFileName());
| HRESULT IRdBitmapDisp::SetIsFromFile | ( | [in] RtBool | bIsFromFile, | |
| [in] BSTR | bstrFileName | |||
| ) |
Set IsFromFile flag and filename of the bitmap (useful when you modified the bitmap but still want to keep track of origin filename).
| bIsFromFile | [in] Specifies if bitmap was loaded from file (TRUE) or not (FALSE). | |
| bstrFileName | [in] Specifies the filename of the bitmap. |
ImageLoaded.SetIsFromFile(true, ImageLoaded.GetFileName());
| HRESULT IRdBitmapDisp::SaveToFile | ( | [in] RtBitmapFileFormat | Format, | |
| [in] BSTR | FileName | |||
| ) |
This method is used to save image to a file.
| Format | [in] Specifies the format of a bitmap. | |
| FileName | [in] Specifies the target filename of a bitmap. |
newFileName = ImageLoaded.GetFileName();
ImageLoaded.SetIsFromFile(true, ImageLoaded.GetFileName());
ImageLoaded.SaveToFile(ImageLoaded.GetFormat(), newFileName);
| HRESULT IRdBitmapDisp::Resize | ( | [in] RtDWORD | dwWidth, | |
| [in] RtDWORD | dwHeight | |||
| ) |
This method is used to resize the bitmap.
| dwWidth | [in] Specifies new width of the bitmap. | |
| dwHeight | [in] Specifies new height of the bitmap. |
var sizeX = ImageLoaded.GetSizeX();
var sizeY = ImageLoaded.GetSizeY();
ImageLoaded.Resize(sizeX + 64, sizeY + 64);
System.Alert(ImageLoaded.GetSizeX() + " " + ImageLoaded.GetSizeY());
| HRESULT IRdBitmapDisp::GetSupportedFormatCount | ( | [out, retval] DWORD * | dwFormatCount | ) |
Return the number of supported loadable formats for enumeration through GetSupportedFormatMasks and GetSupportedFormatName.
Standard HRESULT processing can be applied to the result.
ImageLoaded.GetSupportedFormatCount();
| HRESULT IRdBitmapDisp::GetSupportedFormatMasks | ( | [in] DWORD | dwFormat, | |
| [out, retval] BSTR * | bsMasks | |||
| ) |
Return the information about supported formats.
| dwFormat | [in] Specifies the format index. |
Standard HRESULT processing can be applied to the result.
| E_INVALIDARG | is returned for invalid index. |
var stringA = ImageLoaded.GetSupportedFormatMasks(ImageLoaded.GetFormat());
| HRESULT IRdBitmapDisp::GetSupportedFormatName | ( | [in] DWORD | dwFormat, | |
| [out, retval] BSTR * | bsFormatName | |||
| ) |
Return the information about supported format.
| dwFormat | [in] Specifies the format index. |
Standard HRESULT processing can be applied to the result.
| E_INVALIDARG | is returned for invalid index. |
var info = ImageLoaded.GetSupportedFormatName(1); // index to list of supported formats
| HRESULT IRdBitmapDisp::IsEqual | ( | [in] IDispatch * | pBitmap, | |
| [out, retval] BOOL * | bEqualityResult | |||
| ) |
Checks bitmap for equality with other bitmap.
Return S_OK if bitmaps are equal and return S_FALSE if they are not equal.
| pBitmap | [in] Specifies the other bitmap in the test. |
Standard HRESULT processing can be applied to the result.
| S_OK | for equal bitmaps. | |
| S_FALSE | for non equal bitmaps. | |
| E_XXX | error code should be also considered as non-equality result. |
var bitMap = params.ConValue('bitMap'); var bitMap1 = params.ConValue('bitMap1'); var variableA = bitMap.IsEqual(bitMap1); params.ConValue('variableA') = variableA; // returns 1 for true and 0 for false
| HRESULT IRdBitmapDisp::GetImageSizeFromFile | ( | [in] BSTR | FileName, | |
| [out, retval] VARIANT * | pvRetInfo | |||
| ) |
Return Width and Height of the file on disk (if supported)
| FileName | [in] Specifies the name (and path) of a file to return size of. |
Standard HRESULT processing can be applied to the result.
| S_OK | if image file was found and size was returned. |
BmpSize = ThisBitmap.GetImageSizeFromFile('.\TestBitmap.png'); width = BmpSize.Param("width"); height = BmpSize.Param("height");
| HRESULT IRdBitmapDisp::GetDownsampledFlag | ( | [out, retval] RtBool * | pVal | ) |
Get downsampled flag.
Standard HRESULT processing can be applied to the result.
outBitMap.SetDownsampledFlag(1);
var flag = outBitMap.GetDownsampledFlag();
System.Alert(flag);
| HRESULT IRdBitmapDisp::SetDownsampledFlag | ( | [in] RtBool | newVal | ) |
Set down-sampled flag.
| newVal | [in] Specifies the value of down-sampling. |
ImageLoaded.SetDownsampledFlag(1); // number represents downsample value
| HRESULT IRdBitmapDisp::SaveToFileEx | ( | [in] RtBitmapFileFormat | Format, | |
| [in] BSTR | FileName | |||
| ) |
This method is used to save image to a file using external image library (including alpha channel if format supports it.
| Format | [in] Specifies the format of a bitmap. | |
| FileName | [in] Specifies the target filename of a bitmap. |
| HRESULT IRdBitmapDisp::Clear | ( | void | ) |
Clear all data in the bitmap. Create has to be called to use the bitmap.
bitMap is an attribute created on Script Editor Attributes tab.
bitMap is of type "Common Data Package/Bitmap Data".
bitMap.Clear();
| HRESULT IRdBitmapDisp::Create | ( | [in] RtDWORD | nWidth, | |
| [in] RtDWORD | nHeight, | |||
| [in] RtPixelFormat | PixelFormat | |||
| ) |
Creates the internal buffers of the bitmap and prepares the bitmap for the use.
| nWidth | specifies desired width of the bitmap. | |
| nHeight | specifies height of the bitmap. | |
| PixelFormat | specifies the pixel format of the bitmap. |
| E_INVALIDARG | for invalid dimensions or format. | |
| E_OUTOFMEMORY | if bitmap does not fit into the memory. |
bitMap.Create(width, height, format); // format as number
| HRESULT IRdBitmapDisp::CreateEx | ( | [in] RtDWORD | nWidth, | |
| [in] RtDWORD | nHeight, | |||
| [in] BSTR | bsFormat | |||
| ) |
Creates the internal buffers of the bitmap and prepares the bitmap for the use.
| nWidth | specifies desired width of the bitmap. | |
| nHeight | specifies height of the bitmap. | |
| bsFormat | specifies the pixel format of the bitmap in string form. |
| E_INVALIDARG | for invalid dimensions or format | |
| E_OUTOFMEMORY | if bitmap does not fit into the memory |
var outBitMap = System.CreateDO('Common Data Package/Bitmap Data'); outBitMap.CreateEx( sizeX, sizeY, 'A8R8G8B8' ); //standard 32bit unsigned ARGB
| HRESULT IRdBitmapDisp::ConvertFormat | ( | [in] RtPixelFormat | pFormat | ) |
Convert bitmap from one format to another.
| pFormat | specifies the new format of the bitmap. |
| 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 |
bitMap.ConvertFormat(2);
| HRESULT IRdBitmapDisp::GetHeader | ( | [out] RtDWORD * | pdwWidth, | |
| [out] RtDWORD * | pdwHeight, | |||
| [out] RtPixelFormat * | pFormat | |||
| ) |
Return the header information of the bitmap.
| pdwWidth | is filled with the width of the bitmap. Specify NULL if you do not require this information. | |
| pdwHeight | is filled with the height of the bitmap. Specify NULL if you do not require this information. | |
| pFormat | is filled with the format of the bitmap. Specify NULL if you do not require this information. |
var a = bitMap.GetHeader(width, height, format);
| HRESULT IRdBitmapDisp::GetSizeX | ( | [out, retval] RtDWORD * | pOut | ) |
Get the horizontal size.
| pOut | is filled with the horizontal size of the bitmap. |
var sizeX = bitMap.GetSizeX();
| HRESULT IRdBitmapDisp::GetSizeY | ( | [out, retval] RtDWORD * | pOut | ) |
Get the vertical size
| pOut | is filled with the vertical size of the bitmap. |
var sizeY = bitMap.GetSizeY();
| HRESULT IRdBitmapDisp::GetFormatString | ( | [out, retval] BSTR * | pOut | ) |
Get the pixel format in a string
| pOut | is filled with the format of the bitmap in a string descriptor for usage in scripts. |
var bmpFstr = bitMap.GetFormatString();
| HRESULT IRdBitmapDisp::GetFormat | ( | [out, retval] RtPixelFormat * | pOut | ) |
Get the pixel format
| pOut | is filled with the format of the bitmap. |
var bmpFormat = bitMap.GetFormat();
| HRESULT IRdBitmapDisp::GetFormatNumberFromString | ( | [in] BSTR | bsFormat, | |
| [out, retval] RtPixelFormat * | pOut | |||
| ) |
Convert string format to the enumeration number
| bsFormat | specifies the pixel format in the string. | |
| pOut | is filled with the format of the bitmap that can be used in Create method. |
| E_INVALIDARG | is returned for invalid format. |
var bmpFFStr = bitMap.GetFormatNumberFromString(bmpFstr);
| HRESULT IRdBitmapDisp::GetFormatStringFromNumber | ( | [in] RtPixelFormat | Format, | |
| [out, retval] BSTR * | pOut | |||
| ) |
Get the pixel format string from a number.
| Format | specifies the pixel format in a number form. | |
| pOut | is filled with the format of the bitmap in the string form. |
| E_INVALIDARG | is returned for invalid format. |
var bmpFstrNum = bitMap.GetFormatStringFromNumber(bmpFFStr);
| HRESULT IRdBitmapDisp::GetPixel | ( | [in] RtDWORD | dwPositionX, | |
| [in] RtDWORD | dwPositionY, | |||
| [in] IDispatch * | pOutValue | |||
| ) |
Return pixel color at given position.
| dwPositionX | specifies the horizontal position of a pixel | |
| dwPositionY | specifies the vertical position of a pixel | |
| pOutValue | passed Color object is filled with color. |
| E_INVALIDARG | is returned for position out of bounds. | |
| E_FAIL | is returned also for unknown format and when lock failed. |
var pColor = System.CreateDO('Common Data Package/Color Data');
var sizeX = bitMap.GetSizeX();
var sizeY = bitMap.GetSizeY();
bitMap.GetPixel(sizeX-1,sizeY-1,pColor);
var alpha = pColor.GetAlpha();
var red = pColor.GetRed();
var green = pColor.GetGreen();
var blue = pColor.GetBlue();
| HRESULT IRdBitmapDisp::SetPixel | ( | [in] RtDWORD | dwPositionX, | |
| [in] RtDWORD | dwPositionY, | |||
| [in] IDispatch * | pInValue | |||
| ) |
Set pixel color at given position
| dwPositionX | specifies the horizontal position of a pixel | |
| dwPositionY | specifies the vertical position of a pixel | |
| pInValue | specifies new color of the pixel. |
| E_INVALIDARG | is returned for position out of bounds. | |
| E_FAIL | is returned also for unknown format and when lock failed. |
var pColor = System.CreateDO('Common Data Package/Color Data');
pColor.SetAlpha(Math.Random());
pColor.SetRed(Math.Random());
pColor.SetGreen(Math.Random());
pColor.SetBlue(Math.Random());
bitMap.SetPixel(x,y,pColor);
| HRESULT IRdBitmapDisp::GetPixelCOLORREF | ( | [in] RtDWORD | dwPositionX, | |
| [in] RtDWORD | dwPositionY, | |||
| [out, retval] COLORREF * | pOutValue | |||
| ) |
Return pixel at given position in the COLORREF format.
| dwPositionX | specifies the horizontal position of a pixel | |
| dwPositionY | specifies the vertical position of a pixel | |
| pOutValue | passed Color object is filled with color. |
| E_INVALIDARG | is returned for position out of bounds. | |
| E_FAIL | is returned also for unknown format and when lock failed. |
var color = bitMap.GetPixelCOLORREF(x,y);
| HRESULT IRdBitmapDisp::LockBitmap | ( | ) |
Lock the bitmap - access to methods from other threads will not be possible until UnlockBitmap is called.
bitMap.LockBitmap();
| HRESULT IRdBitmapDisp::UnlockBitmap | ( | ) |
Unlock the bitmap after previous call to LockBitmap.
bitMap.UnlockBitmap();
| HRESULT IRdBitmapDisp::LoadFromFile | ( | [in] BSTR | FileName | ) |
This method is used to load image from a file. Previous bitmap contents are discarded.
| FileName | specifies the file name (including optional path) for load. |
E_INVALIDARG for unsupported format.
var FileName = params.ConValue('FileName'); var ImageLoaded = System.CreateDO("Common Data Package/Bitmap Data"); ImageLoaded.LoadFromFile(FileName); params.ConValue("ImageLoaded") = ImageLoaded;
| HRESULT IRdBitmapDisp::GetFileName | ( | [out, retval] BSTR * | pFileName | ) |
Get filename of the bitmap if it was loaded from file.
| pFileName | is filled with the name of the file. |
| S_OK | if file was loaded from file | |
| S_FALSE | if file was not loaded from file. |
System.Alert(ImageLoaded.GetFileName());
| HRESULT IRdBitmapDisp::SetIsFromFile | ( | [in] RtBool | bIsFromFile, | |
| [in] BSTR | bstrFileName | |||
| ) |
Set IsFromFile flag and filename of the bitmap (useful when you modified the bitmap but still want to keep track of origin filename)
| bIsFromFile | specifies if bitmap was loaded from file (TRUE) or not (FALSE) | |
| bstrFileName | specifies the filename of the bitmap. |
ImageLoaded.SetIsFromFile(true, ImageLoaded.GetFileName());
| HRESULT IRdBitmapDisp::SaveToFile | ( | [in] RtBitmapFileFormat | Format, | |
| [in] BSTR | FileName | |||
| ) |
This method is used to save image to a file.
| Format | specifies the format of a bitmap. | |
| FileName | specifies the target filename of a bitmap. |
newFileName = ImageLoaded.GetFileName();
ImageLoaded.SetIsFromFile(true, ImageLoaded.GetFileName());
ImageLoaded.SaveToFile(ImageLoaded.GetFormat(), newFileName);
| HRESULT IRdBitmapDisp::Resize | ( | [in] RtDWORD | dwWidth, | |
| [in] RtDWORD | dwHeight | |||
| ) |
This method is used to resize the bitmap.
| dwWidth | specifies new width of the bitmap. | |
| dwHeight | specifies new height of the bitmap. |
var sizeX = ImageLoaded.GetSizeX();
var sizeY = ImageLoaded.GetSizeY();
ImageLoaded.Resize(sizeX + 64, sizeY + 64);
System.Alert(ImageLoaded.GetSizeX() + " " + ImageLoaded.GetSizeY());
| HRESULT IRdBitmapDisp::GetSupportedFormatCount | ( | [out, retval] DWORD * | dwFormatCount | ) |
Return the number of supported loadable formats for enumeration through GetSupportedFormatMasks and GetSupportedFormatName
| dwFormatCount | is filled with number of loadable formats. |
ImageLoaded.GetSupportedFormatCount();
| HRESULT IRdBitmapDisp::GetSupportedFormatMasks | ( | [in] DWORD | dwFormat, | |
| [out, retval] BSTR * | bsMasks | |||
| ) |
Return the information about supported format
| dwFormat | specifies the format index. | |
| bsMasks | is filled with the possible file masks separated by ; (i.e. *.gif or *.jpg;*.jpeg) |
| E_INVALIDARG | is returned for invalid index. |
var stringA = ImageLoaded.GetSupportedFormatMasks(ImageLoaded.GetFormat());
| HRESULT IRdBitmapDisp::GetSupportedFormatName | ( | [in] DWORD | dwFormat, | |
| [out, retval] BSTR * | bsFormatName | |||
| ) |
Return the information about supported format
| dwFormat | specifies the format index. | |
| bsFormatName | is filled with the name of the format |
| E_INVALIDARG | is returned for invalid index. |
var info = ImageLoaded.GetSupportedFormatName(1); // index to list of supported formats
| HRESULT IRdBitmapDisp::IsEqual | ( | [in] IDispatch * | pBitmap, | |
| [out, retval] BOOL * | bEqualityResult | |||
| ) |
Checks bitmap for equality with other bitmap. Return S_OK if bitmaps are equal and return S_FALSE if they are not equal.
| pBitmap | specifies the other bitmap in the test. | |
| bEqualityResult | Optional BOOL parameter is provided for script usage - if not NULL it is filled with TRUE for equal bitmaps and FALSE for unequal. |
| S_OK | for equal bitmaps. | |
| S_FALSE | for non equal bitmaps. | |
| E_XXX | error code should be also considered as non-equality result. |
var bitMap = params.ConValue('bitMap'); var bitMap1 = params.ConValue('bitMap1'); var variableA = bitMap.IsEqual(bitMap1); params.ConValue('variableA') = variableA; // returns 1 for true and 0 for false
| HRESULT IRdBitmapDisp::GetImageSizeFromFile | ( | [in] BSTR | FileName, | |
| [out, retval] VARIANT * | pvRetInfo | |||
| ) |
Return Width and Height of the file on disk (if supported)
| FileName | specifies the name (and path) of a file to return size | |
| pvRetInfo | Returns IRsReturn object filled with the width and height of the bitmap in file
|
| S_OK | if image file was found and size was returned. |
BmpSize = ThisBitmap.GetImageSizeFromFile('.\TestBitmap.png'); width = BmpSize.Param("width"); height = BmpSize.Param("height");
| HRESULT IRdBitmapDisp::GetDownsampledFlag | ( | [out, retval] RtBool * | pVal | ) |
Get downsampled flag
| pVal | is filled with true if texture has been down-sampled after load from file. |
outBitMap.SetDownsampledFlag(1);
var flag = outBitMap.GetDownsampledFlag();
System.Alert(flag);
| HRESULT IRdBitmapDisp::SetDownsampledFlag | ( | [in] RtBool | newVal | ) |
Set down-sampled flag.
| newVal | specifies the value of down-sampling. |
ImageLoaded.SetDownsampledFlag(1); // number represents downsample value
| HRESULT IRdBitmapDisp::SaveToFileEx | ( | [in] RtBitmapFileFormat | Format, | |
| [in] BSTR | FileName | |||
| ) |
This method is used to save image to a file using external image library (including alpha channel if format supports it.
| Format | specifies the format of a bitmap. | |
| FileName | specifies the target filename of a bitmap. |
1.5.5