Rhino C++ API
8.14
|
#include <rhinoSdkBitmap.h>
Public Member Functions | |
const CRhinoBitmap * | AddBitmap (const BITMAPINFO *bmi, const void *bits, const wchar_t *bitmap_filename=nullptr, bool bReplaceExisting=false) |
const CRhinoBitmap * | AddBitmap (ON_Bitmap *pBitmap, bool bReplaceExisting, unsigned int worksession_ref_model_sn, unsigned int linked_idef_sn) |
const CRhinoBitmap * | AddEmbeddedFile (const ON_FileReference &file_reference, bool bReplaceExisting, unsigned int worksession_ref_model_sn, unsigned int linked_idef_sn) |
const CRhinoBitmap * | AddEmbeddedFile (const wchar_t *file_path, bool bReplaceExisting, unsigned int worksession_ref_model_sn, unsigned int linked_idef_sn) |
const CRhinoBitmap * | Bitmap (const wchar_t *bitmap_filename, bool bLoadFromFile=false) const |
int | BitmapCount () const |
bool | DeleteBitmap (const wchar_t *bitmap_filename) |
bool | DeleteEmbeddedFile (const ON_FileReference &file_reference) |
bool | DeleteEmbeddedFile (const wchar_t *file_path) |
bool | DeleteEmbeddedFile (ON_UUID bitmap_id) |
class CRhinoDoc & | Document () const |
int | ExportToFiles (const wchar_t *dirpath, int overwrite=0) const |
const CRhinoBitmap * | FindBitmap (ON_UUID bitmap_id, bool bIgnoreDeleted=true) const |
const CRhinoBitmap * | FindEmbeddedFile (const ON_FileReference &file_reference, bool bLoadFromFile=false) const |
const CRhinoBitmap * | FindEmbeddedFile (const wchar_t *bitmap_filename, bool bLoadFromFile=false) const |
void | GetSortedList (ON_SimpleArray< const CRhinoBitmap * > &sorted_list) const |
bool | InBitmapTable (const ON_Bitmap *bitmap) const |
bool | IsValidBitmapTableIndex (int bitmap_index) const |
void | ListTable (ON_TextLog &text_log, unsigned int level_of_detail) const |
const CRhinoBitmap * | operator[] (int i) const |
void | SetRemapIndex (int, int) |
void | Sort (int(*compare)(const CRhinoBitmap *const *, const CRhinoBitmap *const *, void *), int(*cull)(const CRhinoBitmap *, void *), void *p=nullptr) |
const class CRhinoDocTableReference & | TableReference () const |
Friends | |
class | CRhDocSdkExtension |
class | CRhinoDoc |
const CRhinoBitmap* CRhinoBitmapTable::AddBitmap | ( | const BITMAPINFO * | bmi, |
const void * | bits, | ||
const wchar_t * | bitmap_filename = nullptr , |
||
bool | bReplaceExisting = false |
||
) |
Description: Adds a new bitmap with specified name to the bitmap table.
Parameters: bmi - [in] definition of new bitmap. (Copied into the table.)
bits - [in] pointer to bitmap bits. If NULL, then it will be assumed the bitmap bits are after the palette in bmi.
bitmap_filename - [in] If NULL or empty, then a unique name of the form "Bitmap 01" will be automatically created.
bReplaceExisting - [in] If true and the there is already a bitmap using the specified name, then that bitmap is replace. If false and there is already a bitmap using the specified name, then NULL is returned.
Returns: A pointer to the added bitmap or NULL if the bitmap name is in use and bReplaceExisting = false.
See Also: CRhinoBitmapTable::Bitmap
const CRhinoBitmap* CRhinoBitmapTable::AddBitmap | ( | ON_Bitmap * | pBitmap, |
bool | bReplaceExisting, | ||
unsigned int | worksession_ref_model_sn, | ||
unsigned int | linked_idef_sn | ||
) |
Description: Adds a new bitmap with specified name to the bitmap table.
Parameters: pBitmap - [in] an bitmap created with either new ON_WindowsBitmapEx() or new ON_EmbeddedBitmap(). If pBitmap->m_name is not set, a name will be provided.
bReplaceExisting - [in] If true and the there is already a bitmap using the specified name, then that bitmap is replace. If false and there is already a bitmap using the specified name, then NULL is returned.
worksession_ref_model_sn - [in] 0: bitmap is not a reference layer 1: bitmap is a reference layer but not part of a worksession reference file 2-1000: reserved for future use >1000: worksession reference file serial number
linked_idef_sn - [in] 0: bitmap is not from a liked instance definition 1-1000: reserved for future use >1000: bitmap instance definition serial number
Returns: NULL if the bitmap cannot be added or the name is in use.
See Also: CRhinoFileUtilities::FindFile CRhinoBitmapTable::Bitmap
const CRhinoBitmap* CRhinoBitmapTable::AddEmbeddedFile | ( | const ON_FileReference & | file_reference, |
bool | bReplaceExisting, | ||
unsigned int | worksession_ref_model_sn, | ||
unsigned int | linked_idef_sn | ||
) |
const CRhinoBitmap* CRhinoBitmapTable::AddEmbeddedFile | ( | const wchar_t * | file_path, |
bool | bReplaceExisting, | ||
unsigned int | worksession_ref_model_sn, | ||
unsigned int | linked_idef_sn | ||
) |
Description: Adds an embedded file to the bitmap table. Parameters: file_reference - [in] Returns: NULL if the file cannot be located.
const CRhinoBitmap* CRhinoBitmapTable::Bitmap | ( | const wchar_t * | bitmap_filename, |
bool | bLoadFromFile = false |
||
) | const |
Description: Get a bitmap. Parameters: bitmap_name - [in] name of bitmap to search for. The search ignores case. bLoadFromFile - [in] if true, and the bitmap is on disk but not in the current table, then the bitmap is added to the table. Returns: NULL if the bitmap could not be found, otherwise a pointer to the bitmap is returned.
int CRhinoBitmapTable::BitmapCount | ( | ) | const |
Returns: Number of bitmaps in the table.
bool CRhinoBitmapTable::DeleteBitmap | ( | const wchar_t * | bitmap_filename | ) |
Description: Deletes bitmap
Parameters: bitmap_index - [in] zero based index of bitmap to delete. This must be in the range 0 <= bitmap_index < BitmapCount(). bQuiet - [in] If TRUE, no warning message box appears if a bitmap the bitmap cannot be deleted because it is the current bitmap or it contains active geometry.
Returns: TRUE if successful. FALSE if bitmap_index is out of range or the the bitmap cannot be deleted because it is the current bitmap or because it bitmap contains active geometry.
bool CRhinoBitmapTable::DeleteEmbeddedFile | ( | const ON_FileReference & | file_reference | ) |
bool CRhinoBitmapTable::DeleteEmbeddedFile | ( | const wchar_t * | file_path | ) |
bool CRhinoBitmapTable::DeleteEmbeddedFile | ( | ON_UUID | bitmap_id | ) |
class CRhinoDoc& CRhinoBitmapTable::Document | ( | ) | const |
Description: Bitmap tables store the list of bitmaps in a Rhino document.
Returns: CRhinoDocument that owns this bitmap table.
int CRhinoBitmapTable::ExportToFiles | ( | const wchar_t * | dirpath, |
int | overwrite = 0 |
||
) | const |
Description: Export all the bitmaps in the table to files. Parameters: dirpath - [in] full path to the directory where the bitmaps should be saved. If NULL, a dialog is used to interactively get the directory name.
overwrite - [in] 0 = no, 1 = yes, 2 = ask Returns: Number of bitmaps written. See Also: CRhinoBitmap::ExportToFile
const CRhinoBitmap* CRhinoBitmapTable::FindBitmap | ( | ON_UUID | bitmap_id, |
bool | bIgnoreDeleted = true |
||
) | const |
const CRhinoBitmap* CRhinoBitmapTable::FindEmbeddedFile | ( | const ON_FileReference & | file_reference, |
bool | bLoadFromFile = false |
||
) | const |
const CRhinoBitmap* CRhinoBitmapTable::FindEmbeddedFile | ( | const wchar_t * | bitmap_filename, |
bool | bLoadFromFile = false |
||
) | const |
Description: Get a bitmap. Parameters: bitmap_filename - [in] name of bitmap to search for. The search ignores case.
bLoadFromFile - [in] if true, and the bitmap is on disk but not in the current table, then the bitmap is added to the table.
Returns: NULL if the bitmap could not be found, otherwise a pointer to the bitmap is returned.
void CRhinoBitmapTable::GetSortedList | ( | ON_SimpleArray< const CRhinoBitmap * > & | sorted_list | ) | const |
Description: Gets an array of pointers to bitmaps that is sorted by the values of CRhinoBitmap::m_sort_index.
Parameters: sorted_list - [out] this array is returned with length BitmapCount() and is sorted by the values of CRhinoBitmap::m_sort_index. bIgnoreDeleted - [in] TRUE means don't include deleted bitmaps.
Remarks: Use Sort() to set the values of m_sort_index.
bool CRhinoBitmapTable::InBitmapTable | ( | const ON_Bitmap * | bitmap | ) | const |
Returns: true The bitmap is an element in this bitmap table.
bool CRhinoBitmapTable::IsValidBitmapTableIndex | ( | int | bitmap_index | ) | const |
Returns: true The bitmap_index is a valid index of a bitmap element in this bitmap table.
void CRhinoBitmapTable::ListTable | ( | ON_TextLog & | text_log, |
unsigned int | level_of_detail | ||
) | const |
const CRhinoBitmap* CRhinoBitmapTable::operator[] | ( | int | i | ) | const |
Parameters: i - [in] 0 <= i < BitmapCount() Returns: Pointer to bitmap or NULL.
void CRhinoBitmapTable::SetRemapIndex | ( | int | , |
int | |||
) |
void CRhinoBitmapTable::Sort | ( | int(*)(const CRhinoBitmap *const *, const CRhinoBitmap *const *, void *) | compare, |
int(*)(const CRhinoBitmap *, void *) | cull, | ||
void * | p = nullptr |
||
) |
Description: Use this to set CRhinoBitmap::m_sort_index so that the values of m_sort_index run from 0 to BitmapCount()-1 and compare(bitmap_table[i],bitmap_table[j]) < 0 ) implies bitmap_table[i].m_sort_index < bitmap_table[j].m_sort_index.
Parameters: compare - [in] compare function with prototype int compare(const CRhinoBitmap* arg1,const CRhinoBitmap* arg2,void* p). that returns <0 if arg1<arg2, 0 if arg1=arg2, and >0 if arg1>arg2. cull - [in] optional filter function with prototype BOOL32 cull(const CRhinoBitmap* arg,void* p). that returns TRUE if the bitmap should be ignored when sorting. Bitmaps that are ignored are not included in the list returned by GetSortedList(). Pass 0 if you do not need to cull bitmaps p - [in] pointer passed as last argument to compare() and cull().
Remarks: After calling Sort(), you can repeatedly call GetSortedList() to get a sorted list of CRhinoBitmap pointers. Sort() and GetSortedList() do not modify the order or persistent information in the bitmap table. They are intended to be used to get sorted lists of bitmaps for dialogs, etc.
const class CRhinoDocTableReference& CRhinoBitmapTable::TableReference | ( | ) | const |
|
friend |
|
friend |