Rhino C++ API  7.19
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
CRhinoDib Class Reference

#include <RhinoSdkUiDibMac.h>

Classes

class  CFastPixelAccess
 
class  Pixel
 

Public Types

enum  bitmap_file_type {
  bmp_file_type = 0, jpg_file_type, pcx_file_type, png_file_type,
  tga_file_type, tif_file_type, dds_file_type, unsupported_file_type = 0xFFFFFFFF
}
 
enum  ComponentOrders : int {
  ComponentOrders::None = 0, ComponentOrders::L = 1, ComponentOrders::BGR = 2, ComponentOrders::RGB = 3,
  ComponentOrders::BGRA = 4, ComponentOrders::RGBA = 5, ComponentOrders::ABGR = 6, ComponentOrders::ARGB = 7,
  ComponentOrders::FLOAT = 8, ComponentOrders::RUNTIME_24BIT = 3, ComponentOrders::RUNTIME_32BIT = 5
}
 
enum  Quality : int { Quality::kHigh, Quality::kMedium, Quality::kLow }
 

Public Member Functions

 CRhinoDib ()
 Construction. More...
 
 CRhinoDib (CGImageRef)
 
 CRhinoDib (const CRhinoDib &)
 copy constructor, create bitmap that matches another More...
 
 CRhinoDib (HBITMAP)
 create Dib from hbitmap More...
 
 CRhinoDib (int width, int height, int color_depth, bool select_into_mem_dc=false, CPalette *=NULL)
 create bitmap with sepcified width, height and color depth More...
 
virtual ~CRhinoDib ()
 Destruction. More...
 
BOOL BitBlt (int x, int y, int nWidth, int nHeight, const CRhinoDib *srcDC, int srcLeft, int srcTop, int mode)
 
MAC_DEPRECATED HBITMAP Bitmap () const
 returns this, which is not very useful More...
 
NSBitmapImageRep * BitmapImageRep () const
 
void BitmapImageRep (NSBitmapImageRep *newBitmapRep)
 
CRhinoCacheHandleCache () const
 
void Clear (COLORREF)
 Clears (fills) the entire dib with the passed in color... More...
 
int ColorDepth () const
 
ComponentOrders ComponentOrder (void) const
 
bool ConvertToGrayScale (bool bSetAlpha=false)
 
void ConvertToNormalMap (bool bLossyCompressionSource, bool &bPositiveZComponent)
 
HBITMAP CopyHBitmap ()
 
BOOL CopyToClipboard (HWND hwnd) const
 Clipboard operations. More...
 
bool CreateDib (int width, int height, int color_depth, bool select_into_mem_dc=false, CPalette *=NULL)
 DIB or HBITMAP creation functions. More...
 
BOOL DCSelectBitmap (bool)
 don't know what this might do More...
 
void DestroyDib ()
 Destroy dib && hbitmap and zero out pointers. More...
 
double DPI () const
 
BOOL Draw (CDC *pDC, CRect rect, int xSrc=0, int ySrc=0)
 
BOOL Draw (CDC *pDC, int x=0, int y=0, int cx=0, int cy=0, int xSrc=0, int ySrc=0)
 Blit functions funtions. More...
 
BOOL DrawMasked (CDC *pDC, COLORREF crMask, CRect rect, int xSrc=0, int ySrc=0)
 
BOOL DrawMasked (CDC *pDC, COLORREF crMask, int x=0, int y=0, int cx=0, int cy=0, int xSrc=0, int ySrc=0)
 
CFastPixelAccessFastPixelAccess (void)
 
const CFastPixelAccessFastPixelAccess (void) const
 
BOOL FillSolid (ON_Color color)
 
BOOL FillSolidRect (CRect &rect, ON_Color color)
 
BOOL FillSolidRect (int x, int y, int nWidth, int nHeight, ON_Color color)
 
void FlipVertical ()
 
void GaussianBlurWithRadius (double radius)
 
UINT GetDepth () const
 
BOOL GetPixel (long x, long y, COLORREF &cr) const
 
BOOL GetPixel (long x, long y, COLORREF &cr, int &alpha) const
 
BOOL GetPixel (long x, long y, float &r, float &g, float &b) const
 
BOOL GetPixel (long x, long y, float &r, float &g, float &b, float &alpha) const
 
BOOL GetPixel (long x, long y, int &r, int &g, int &b) const
 
BOOL GetPixel (long x, long y, int &r, int &g, int &b, int &alpha) const
 
bool GetPixel (unsigned char *base, int x, unsigned char *r, unsigned char *g, unsigned char *b)
 
UINT GetStorageSize () const
 
UINT GetStorageWidth () const
 
UINT GLDataType () const
 e.g. GL_UNSIGNED_BYTE More...
 
UINT GLPixelFormat () const
 OpenGL attributes for this image. More...
 
int Height () const
 
NSImage * Image () const
 
bool IncreaseColorDepth (int nNewColorDepth)
 
bool IsAllocated () const
 Call this to ensure there is memory allocated. Replace calls to check FindDIBBits() for nullptr with this. More...
 
bool IsNormalMap (bool bLossyCompressionSource, bool &bPositiveZComponent) const
 
bool IsNormalMap (void) const
 
const wchar_t * LastSaveName () const
 
void MakeOpaque ()
 convert all partially transparent pixels to fully opaque More...
 
long NumColors () const
 
 operator CDC * ()
 
 operator CDC * () const
 
CRhinoDiboperator= (const CRhinoDib &src)
 
CPalette * Palette () const
 
long PaletteSize () const
 
UINT PelsPerMeter () const
 
bool Print (HWND hWnd=0, bool bFitToPage=true)
 
bool ProcessPixels (bool(*f)(const Pixel &, void *pvData), void *pvData=nullptr) const
 
bool ProcessPixels (bool(*f)(Pixel &, void *pvData), void *pvData=nullptr)
 
void ProcessPixels (void(*f)(const Pixel &, void *pvData), void *pvData=nullptr) const
 
void ProcessPixels (void(*f)(Pixel &, const void *pvData), const void *pvData=nullptr)
 
void ProcessPixels (void(*f)(Pixel &, void *pvData), void *pvData=nullptr)
 
void ProcessPixels_SingleThreaded (void(*f)(const Pixel &, void *pvData), void *pvData=nullptr) const
 
void ProcessPixels_SingleThreaded (void(*f)(Pixel &, const void *pvData), const void *pvData=nullptr)
 
void ProcessPixels_SingleThreaded (void(*f)(Pixel &, void *pvData), void *pvData=nullptr)
 
bool ReadFromFile (const wchar_t *lpsFileName)
 
bool ReadFromFile (HWND hWnd=0, bool bUseDialogs=true)
 
bool ReadFromFile (unsigned int doc_serial_number, const wchar_t *lpsFileName)
 
bool ReadFromMemory (const void *buffer, int sizeof_buffer)
 
void Resize (int newWidth, int newHeight)
 
bool ReuseDib (int width, int height, int depth, bool select_into_mem_dc)
 
unsigned int RuntimeSerialNumber () const
 
long ScanWidth () const
 
void SetBitmap (CGImageRef)
 
void SetBitmap (HBITMAP)
 
BOOL SetDib (LPBITMAPINFO lpbmi, bool free_lpbmi=true)
 
void SetDPI (double)
 
void SetLastSaveName (const wchar_t *)
 
void SetPelsPerMeter (UINT)
 
BOOL SetPixel (long x, long y, COLORREF cr, int alpha=-1)
 
BOOL SetPixel (long x, long y, float r, float g, float b, float alpha=-1.0)
 Functions call FindDIBBits and validate x and y. More...
 
BOOL SetPixel (long x, long y, int r, int g, int b, int alpha=-1)
 
long Size () const
 Bitmap information. More...
 
long SizeBits () const
 
long SizeHeader () const
 
BOOL StretchBlt (int x, int y, int nWidth, int nHeight, const CRhinoDib *srcDC, int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, int mode)
 
void SwapRedAndBlueSamples ()
 exchange the red and blue color bytes in the NSBitmapImageRep More...
 
int Width () const
 
long WidthInBytes () const
 
bool WriteToFile (const wchar_t *lpsFileName, Quality q=Quality::kHigh) const
 
bool WriteToFile (HWND hWnd=0, bool bUseDialogs=true, Quality q=Quality::kHigh) const
 

Static Public Member Functions

static bitmap_file_type FileTypeFromFileName (const wchar_t *lpsFileName)
 
static bool FileTypeSupportsAlphaChannel (bitmap_file_type fileType)
 
static bool FileTypeSupportsAlphaChannel (const wchar_t *fileName)
 
static void FlipVertical (NSBitmapImageRep *imageRep)
 
static ComponentOrders GLFormatToComponentOrder (GLenum)
 
static bool ReadFromFileImageSize (const wchar_t *lpsFileName, unsigned int *image_width_pixels, unsigned int *image_height_pixels, unsigned int *image_width_dpi, unsigned int *image_height_dpi)
 

Protected Member Functions

void construct ()
 
void MakeNSImage ()
 
virtual void NonConstOperation ()
 
void SetImageRep (NSImageRep *)
 

Static Protected Member Functions

static int GetBitmapType (const wchar_t *lpsFileName)
 

Protected Attributes

unsigned int m_color_depth
 
CDC m_dc
 
double m_dpi
 
int m_height
 
NSBitmapImageRep * m_image_rep
 
bool m_is_gray_scale
 
NSImage * m_nsimage
 NSImage that contains the above NSBitmapImageRep. More...
 
int m_width
 
ON_wString m_wLastSaveName
 

Friends

void ApplyBufferImageAttributes (class CRhOpenGLTexture2D *, const wchar_t *name, const class CRhTextureAttributes &, class CRhinoDisplayEngine_OGL *, HGLRC)
 
unsigned int CreateGlAlphaTexture (const CRhinoDib &, bool, unsigned int)
 
class CRhCmnDisplayBitmap
 
class CRhEngine_GL11
 
class CRhEngine_PEP_GL33
 friend void Combine(const CRhinoDib&, CRhinoDib&, const float*, float*); More...
 
class CRhinoDisplayEngine_GDI
 
class CRhinoDisplayEngine_OGL
 
class CRhinoDisplayPipeline
 
class CRhOpenGLRenderer
 
class CRhOpenGLTexture2D
 
class CRhOpenGLTextureCube
 
class CRhRdkPostEffectImage
 This is a list of the badly behaved. More...
 
class CRhRegionSelectHelper
 
class CXXXXRender
 
GLuint GetGlTextureForDib (class CRhinoDisplayEngine_OGL &, const CRhinoDib &)
 
bool RhinoUpdateCachedTextureFromDib (unsigned int, const CRhinoDib &)
 
class TestDavidEBitmapFlip
 

Detailed Description

Class to manage DIB's. This class will create a DIB, a HBITMAP and associated memory DC. The HBITMAP and CRhinoDib::FindBits() point to the smae memory. You can modify the bits directly or use GDI with the associated memory DC to modify the bitmap. The HBITMAP does not get selected by the memory devidce context due to the fact that the DIB can only be selected in one device context at a time. To select or remove the Bitmap() from its memory DC call DCSelectBitmap( bool). If you call DCSelectBitmap( true) you may cast a CRhinoDib as a CDC* or HDC and use it directly.

Member Enumeration Documentation

◆ bitmap_file_type

Enumerator
bmp_file_type 

"*.bmp"

jpg_file_type 

"*.jpg;*.jpeg"

pcx_file_type 

"*.pcx"

png_file_type 

"*.png"

tga_file_type 

"*.tga"

tif_file_type 

"*.tif;*.tiff"

dds_file_type 

"*.dds"

unsupported_file_type 

Do NOT change this value, this allows adding additional values without breaking the SDK in the future

◆ ComponentOrders

enum CRhinoDib::ComponentOrders : int
strong
Enumerator
None 
BGR 
RGB 
BGRA 
RGBA 
ABGR 
ARGB 
FLOAT 
RUNTIME_24BIT 
RUNTIME_32BIT 

◆ Quality

enum CRhinoDib::Quality : int
strong

From RhinoSdkDib.h

Enumerator
kHigh 
kMedium 
kLow 

Constructor & Destructor Documentation

◆ CRhinoDib() [1/5]

CRhinoDib::CRhinoDib ( )

Construction.

◆ CRhinoDib() [2/5]

CRhinoDib::CRhinoDib ( int  width,
int  height,
int  color_depth,
bool  select_into_mem_dc = false,
CPalette *  = NULL 
)

create bitmap with sepcified width, height and color depth

◆ CRhinoDib() [3/5]

CRhinoDib::CRhinoDib ( const CRhinoDib )

copy constructor, create bitmap that matches another

◆ CRhinoDib() [4/5]

CRhinoDib::CRhinoDib ( HBITMAP  )

create Dib from hbitmap

◆ CRhinoDib() [5/5]

CRhinoDib::CRhinoDib ( CGImageRef  )

◆ ~CRhinoDib()

virtual CRhinoDib::~CRhinoDib ( )
virtual

Destruction.

Member Function Documentation

◆ BitBlt()

BOOL CRhinoDib::BitBlt ( int  x,
int  y,
int  nWidth,
int  nHeight,
const CRhinoDib srcDC,
int  srcLeft,
int  srcTop,
int  mode 
)

◆ Bitmap()

MAC_DEPRECATED HBITMAP CRhinoDib::Bitmap ( ) const

returns this, which is not very useful

◆ BitmapImageRep() [1/2]

NSBitmapImageRep* CRhinoDib::BitmapImageRep ( ) const

◆ BitmapImageRep() [2/2]

void CRhinoDib::BitmapImageRep ( NSBitmapImageRep *  newBitmapRep)

◆ Cache()

CRhinoCacheHandle* CRhinoDib::Cache ( ) const

◆ Clear()

void CRhinoDib::Clear ( COLORREF  )

Clears (fills) the entire dib with the passed in color...

◆ ColorDepth()

int CRhinoDib::ColorDepth ( ) const

◆ ComponentOrder()

ComponentOrders CRhinoDib::ComponentOrder ( void  ) const

◆ construct()

void CRhinoDib::construct ( )
protected

◆ ConvertToGrayScale()

bool CRhinoDib::ConvertToGrayScale ( bool  bSetAlpha = false)

Converts the dib into a grayscale image...and promotes it to a 24 bit dib if need be... If bSetAlpha is true, and the bitmap is a 32-bit image, the alpha byte is set to the same as the other three components otherwise, the alpha byte is preserved from the original image.

◆ ConvertToNormalMap()

void CRhinoDib::ConvertToNormalMap ( bool  bLossyCompressionSource,
bool &  bPositiveZComponent 
)

◆ CopyHBitmap()

HBITMAP CRhinoDib::CopyHBitmap ( )

Return copy of the current Dib(). If Bitmap() is NULL then one is created from Dib() and returned. m_hBitmap is not set if Bitmap was NULL. You are responsible for destroying this object.

◆ CopyToClipboard()

BOOL CRhinoDib::CopyToClipboard ( HWND  hwnd) const

Clipboard operations.

◆ CreateDib()

bool CRhinoDib::CreateDib ( int  width,
int  height,
int  color_depth,
bool  select_into_mem_dc = false,
CPalette *  = NULL 
)

DIB or HBITMAP creation functions.

◆ DCSelectBitmap()

BOOL CRhinoDib::DCSelectBitmap ( bool  )

don't know what this might do

◆ DestroyDib()

void CRhinoDib::DestroyDib ( )

Destroy dib && hbitmap and zero out pointers.

◆ DPI()

double CRhinoDib::DPI ( ) const

◆ Draw() [1/2]

BOOL CRhinoDib::Draw ( CDC *  pDC,
CRect  rect,
int  xSrc = 0,
int  ySrc = 0 
)

◆ Draw() [2/2]

BOOL CRhinoDib::Draw ( CDC *  pDC,
int  x = 0,
int  y = 0,
int  cx = 0,
int  cy = 0,
int  xSrc = 0,
int  ySrc = 0 
)

Blit functions funtions.

◆ DrawMasked() [1/2]

BOOL CRhinoDib::DrawMasked ( CDC *  pDC,
COLORREF  crMask,
CRect  rect,
int  xSrc = 0,
int  ySrc = 0 
)

◆ DrawMasked() [2/2]

BOOL CRhinoDib::DrawMasked ( CDC *  pDC,
COLORREF  crMask,
int  x = 0,
int  y = 0,
int  cx = 0,
int  cy = 0,
int  xSrc = 0,
int  ySrc = 0 
)

◆ FastPixelAccess() [1/2]

CFastPixelAccess* CRhinoDib::FastPixelAccess ( void  )

◆ FastPixelAccess() [2/2]

const CFastPixelAccess* CRhinoDib::FastPixelAccess ( void  ) const

◆ FileTypeFromFileName()

static bitmap_file_type CRhinoDib::FileTypeFromFileName ( const wchar_t *  lpsFileName)
static

Description: Call this method to get supported file type from file name. Parameters: lpsFileName - [in] File name, extension will be extracted from the end of this string and compared to supported bitmap file types. Returns: Returns a valid bitmap_file_type on success or unsupported_file_type if the file type is not supported.

◆ FileTypeSupportsAlphaChannel() [1/2]

static bool CRhinoDib::FileTypeSupportsAlphaChannel ( bitmap_file_type  fileType)
static

Description: Call this method to see if a specified file type supports 32 bit bitmaps with alpha channel. Parameters: fileType - [in] Bitmap file type to check Returns: Returns a true if the bitmap can be saved as a 32 bit DIB with alpha channel.

◆ FileTypeSupportsAlphaChannel() [2/2]

static bool CRhinoDib::FileTypeSupportsAlphaChannel ( const wchar_t *  fileName)
static

Description: Call this method to see if a specified file (gets the type from the file extension) supports 32 bit bitmaps with alpha channel. Parameters: fileName - [in] Name of the file to extract the extension from. Returns: Returns a true if the bitmap can be saved as a 32 bit DIB with alpha channel.

◆ FillSolid()

BOOL CRhinoDib::FillSolid ( ON_Color  color)

◆ FillSolidRect() [1/2]

BOOL CRhinoDib::FillSolidRect ( CRect &  rect,
ON_Color  color 
)

◆ FillSolidRect() [2/2]

BOOL CRhinoDib::FillSolidRect ( int  x,
int  y,
int  nWidth,
int  nHeight,
ON_Color  color 
)

From RhinoSdkDib.h Fills the entire dib with the specified color...Note: if it's a 32 bit dib, then the high-order byte of the passed in color is considered to be an alpha value, and thus will also be included in the fill operation (normal GDI operations will strip this out).

◆ FlipVertical() [1/2]

void CRhinoDib::FlipVertical ( )

◆ FlipVertical() [2/2]

static void CRhinoDib::FlipVertical ( NSBitmapImageRep *  imageRep)
static

◆ GaussianBlurWithRadius()

void CRhinoDib::GaussianBlurWithRadius ( double  radius)

◆ GetBitmapType()

static int CRhinoDib::GetBitmapType ( const wchar_t *  lpsFileName)
staticprotected

◆ GetDepth()

UINT CRhinoDib::GetDepth ( ) const

◆ GetPixel() [1/7]

BOOL CRhinoDib::GetPixel ( long  x,
long  y,
COLORREF &  cr 
) const

◆ GetPixel() [2/7]

BOOL CRhinoDib::GetPixel ( long  x,
long  y,
COLORREF &  cr,
int &  alpha 
) const

◆ GetPixel() [3/7]

BOOL CRhinoDib::GetPixel ( long  x,
long  y,
float &  r,
float &  g,
float &  b 
) const

◆ GetPixel() [4/7]

BOOL CRhinoDib::GetPixel ( long  x,
long  y,
float &  r,
float &  g,
float &  b,
float &  alpha 
) const

◆ GetPixel() [5/7]

BOOL CRhinoDib::GetPixel ( long  x,
long  y,
int &  r,
int &  g,
int &  b 
) const

◆ GetPixel() [6/7]

BOOL CRhinoDib::GetPixel ( long  x,
long  y,
int &  r,
int &  g,
int &  b,
int &  alpha 
) const

◆ GetPixel() [7/7]

bool CRhinoDib::GetPixel ( unsigned char *  base,
int  x,
unsigned char *  r,
unsigned char *  g,
unsigned char *  b 
)

◆ GetStorageSize()

UINT CRhinoDib::GetStorageSize ( ) const
inline

◆ GetStorageWidth()

UINT CRhinoDib::GetStorageWidth ( ) const

◆ GLDataType()

UINT CRhinoDib::GLDataType ( ) const

e.g. GL_UNSIGNED_BYTE

◆ GLFormatToComponentOrder()

static ComponentOrders CRhinoDib::GLFormatToComponentOrder ( GLenum  )
static

◆ GLPixelFormat()

UINT CRhinoDib::GLPixelFormat ( ) const

OpenGL attributes for this image.

e.g. GL_RGBA

◆ Height()

int CRhinoDib::Height ( ) const

◆ Image()

NSImage* CRhinoDib::Image ( ) const

◆ IncreaseColorDepth()

bool CRhinoDib::IncreaseColorDepth ( int  nNewColorDepth)

If color depth is less than the requested color depth create a new bitmap of the desired color depth and copy old bits to it

◆ IsAllocated()

bool CRhinoDib::IsAllocated ( ) const

Call this to ensure there is memory allocated. Replace calls to check FindDIBBits() for nullptr with this.

◆ IsNormalMap() [1/2]

bool CRhinoDib::IsNormalMap ( bool  bLossyCompressionSource,
bool &  bPositiveZComponent 
) const

Description: Call this method to see if the DIB appears to be a normal map. Parameters: bLossyCompressionSource - [in] True if the source of the bitmap is an image with lossy compression (e.g. jpg). False otherwise. The check will be less strict if the image can contain errors due to lossy compression. bPositiveZComponent - [out] True if the image is a normal map with the z-component mapped to the range 0 .. +1. False if the image is a normal map with the z-component mapped to the range -1 .. +1. Returns: Returns true if the bitmap appears to be a normal map. False otherwise.

◆ IsNormalMap() [2/2]

bool CRhinoDib::IsNormalMap ( void  ) const

Description: Call this method to see if the DIB appears to be a normal map. Returns: Returns true if the bitmap appears to be a normal map. False otherwise.

Deprecated:
Use the version that takes parameters bLossyCompressionSource and bPositiveZComponent

◆ LastSaveName()

const wchar_t* CRhinoDib::LastSaveName ( ) const

◆ MakeNSImage()

void CRhinoDib::MakeNSImage ( )
protected

◆ MakeOpaque()

void CRhinoDib::MakeOpaque ( )

convert all partially transparent pixels to fully opaque

◆ NonConstOperation()

virtual void CRhinoDib::NonConstOperation ( )
protectedvirtual

◆ NumColors()

long CRhinoDib::NumColors ( ) const

◆ operator CDC *() [1/2]

CRhinoDib::operator CDC * ( )

◆ operator CDC *() [2/2]

CRhinoDib::operator CDC * ( ) const

◆ operator=()

CRhinoDib& CRhinoDib::operator= ( const CRhinoDib src)

Copy source bitmap, if m_hBitmap is non NULL then create destroy current and create new hBitmap

◆ Palette()

CPalette* CRhinoDib::Palette ( ) const

◆ PaletteSize()

long CRhinoDib::PaletteSize ( ) const

◆ PelsPerMeter()

UINT CRhinoDib::PelsPerMeter ( ) const

◆ Print()

bool CRhinoDib::Print ( HWND  hWnd = 0,
bool  bFitToPage = true 
)

Description: Display print dialog Parameters: hWnd - [in] Parent window for print dialog. If NULL will use Rhino frame window. Returns: true - DIB sent to printer false - Print dialog canceled or error writing to printer.

◆ ProcessPixels() [1/5]

bool CRhinoDib::ProcessPixels ( bool(*)(const Pixel &, void *pvData)  f,
void *  pvData = nullptr 
) const

◆ ProcessPixels() [2/5]

bool CRhinoDib::ProcessPixels ( bool(*)(Pixel &, void *pvData)  f,
void *  pvData = nullptr 
)

Pixel iterators with an interupt. Return false in the callback function to interupt the loops. Current implementation is not multithreaded, but this may change.

◆ ProcessPixels() [3/5]

void CRhinoDib::ProcessPixels ( void(*)(const Pixel &, void *pvData)  f,
void *  pvData = nullptr 
) const

◆ ProcessPixels() [4/5]

void CRhinoDib::ProcessPixels ( void(*)(Pixel &, const void *pvData)  f,
const void *  pvData = nullptr 
)

◆ ProcessPixels() [5/5]

void CRhinoDib::ProcessPixels ( void(*)(Pixel &, void *pvData)  f,
void *  pvData = nullptr 
)

Fast pixel iterators. Quick access to the image data for each pixel, multi-threaded. Use the pixel setter provided to quickly set pixel values.

◆ ProcessPixels_SingleThreaded() [1/3]

void CRhinoDib::ProcessPixels_SingleThreaded ( void(*)(const Pixel &, void *pvData)  f,
void *  pvData = nullptr 
) const

◆ ProcessPixels_SingleThreaded() [2/3]

void CRhinoDib::ProcessPixels_SingleThreaded ( void(*)(Pixel &, const void *pvData)  f,
const void *  pvData = nullptr 
)

◆ ProcessPixels_SingleThreaded() [3/3]

void CRhinoDib::ProcessPixels_SingleThreaded ( void(*)(Pixel &, void *pvData)  f,
void *  pvData = nullptr 
)

◆ ReadFromFile() [1/3]

bool CRhinoDib::ReadFromFile ( const wchar_t *  lpsFileName)

Description: Read bitmap from disk. Parameters: lpsFileName - [in] Name of file to read. Uses CRhinoFileUtilities::FindFile(...) to validate file name. Returns: true - File was read from disk. false - Error reading file or invalid file type.

Deprecated:
Use the version that takes doc_serial_number

◆ ReadFromFile() [2/3]

bool CRhinoDib::ReadFromFile ( HWND  hWnd = 0,
bool  bUseDialogs = true 
)

Description: Display Rhino bitmap open dialog prompting for name then read bitmap from disk. Parameters: hWnd - [in] Parent window for file dialog. If NULL will use Rhino frame window. bUseDialogs - [in] If true then display file dialog otherwise prompt for name on command line. Returns: true - File name specified and writen to disk. false - File dialog canceled or error writing file.

◆ ReadFromFile() [3/3]

bool CRhinoDib::ReadFromFile ( unsigned int  doc_serial_number,
const wchar_t *  lpsFileName 
)

Description: Read bitmap from disk. Parameters: lpsFileName - [in] Name of file to read. Uses CRhinoFileUtilities::FindFile(...) to validate file name. doc_serial_number - [in] Runtime serial number of the CRhinoDoc to be used for image searches Returns: true - File was read from disk. false - Error reading file or invalid file type.

◆ ReadFromFileImageSize()

static bool CRhinoDib::ReadFromFileImageSize ( const wchar_t *  lpsFileName,
unsigned int *  image_width_pixels,
unsigned int *  image_height_pixels,
unsigned int *  image_width_dpi,
unsigned int *  image_height_dpi 
)
static

Description: Read bitmap image size from disk. Parameters: lpsFileName - [in] Name of file to read. Uses CRhinoFileUtilities::FindFile(...) to validate file name.

image_width_pixels - [out] image_height_pixels - [out] The sizes of the image are returned in the pixels parameters.

image_width_dpi - [out] image_height_dpi - [out] The dots per inch values saved in the image file are returned in the dpi parameters. Returns: true - File was read from disk. false - Error reading file or invalid file type.

◆ ReadFromMemory()

bool CRhinoDib::ReadFromMemory ( const void *  buffer,
int  sizeof_buffer 
)

Description: Read bitmap from a memory buffer. Parameters: buffer - [in] sizeof_buffer - [in] number of bytes in the buffer Returns: true - Image was read from buffer false - Error reading buffer

◆ Resize()

void CRhinoDib::Resize ( int  newWidth,
int  newHeight 
)

◆ ReuseDib()

bool CRhinoDib::ReuseDib ( int  width,
int  height,
int  depth,
bool  select_into_mem_dc 
)

◆ RuntimeSerialNumber()

unsigned int CRhinoDib::RuntimeSerialNumber ( ) const

◆ ScanWidth()

long CRhinoDib::ScanWidth ( ) const

◆ SetBitmap() [1/2]

void CRhinoDib::SetBitmap ( CGImageRef  )

◆ SetBitmap() [2/2]

void CRhinoDib::SetBitmap ( HBITMAP  )

◆ SetDib()

BOOL CRhinoDib::SetDib ( LPBITMAPINFO  lpbmi,
bool  free_lpbmi = true 
)

Destroy existing m_bitmapinfo and m_hBitmap, set them to specified dib. If Bitmap() was non NULL then a new HBITMAP is created from the new dib

◆ SetDPI()

void CRhinoDib::SetDPI ( double  )

◆ SetImageRep()

void CRhinoDib::SetImageRep ( NSImageRep *  )
protected

◆ SetLastSaveName()

void CRhinoDib::SetLastSaveName ( const wchar_t *  )

◆ SetPelsPerMeter()

void CRhinoDib::SetPelsPerMeter ( UINT  )

◆ SetPixel() [1/3]

BOOL CRhinoDib::SetPixel ( long  x,
long  y,
COLORREF  cr,
int  alpha = -1 
)

◆ SetPixel() [2/3]

BOOL CRhinoDib::SetPixel ( long  x,
long  y,
float  r,
float  g,
float  b,
float  alpha = -1.0 
)

Functions call FindDIBBits and validate x and y.

◆ SetPixel() [3/3]

BOOL CRhinoDib::SetPixel ( long  x,
long  y,
int  r,
int  g,
int  b,
int  alpha = -1 
)

◆ Size()

long CRhinoDib::Size ( ) const

Bitmap information.

◆ SizeBits()

long CRhinoDib::SizeBits ( ) const

◆ SizeHeader()

long CRhinoDib::SizeHeader ( ) const

◆ StretchBlt()

BOOL CRhinoDib::StretchBlt ( int  x,
int  y,
int  nWidth,
int  nHeight,
const CRhinoDib srcDC,
int  xSrc,
int  ySrc,
int  nSrcWidth,
int  nSrcHeight,
int  mode 
)

◆ SwapRedAndBlueSamples()

void CRhinoDib::SwapRedAndBlueSamples ( )

exchange the red and blue color bytes in the NSBitmapImageRep

◆ Width()

int CRhinoDib::Width ( ) const

◆ WidthInBytes()

long CRhinoDib::WidthInBytes ( ) const

◆ WriteToFile() [1/2]

bool CRhinoDib::WriteToFile ( const wchar_t *  lpsFileName,
Quality  q = Quality::kHigh 
) const

Description: Write bitmap to disk. Parameters: lpsFileName - [in] Name of file to write. Returns: true - Specified File name writen to disk. false - Error writing file or invalid file type.

◆ WriteToFile() [2/2]

bool CRhinoDib::WriteToFile ( HWND  hWnd = 0,
bool  bUseDialogs = true,
Quality  q = Quality::kHigh 
) const

Friends And Related Function Documentation

◆ ApplyBufferImageAttributes

void ApplyBufferImageAttributes ( class CRhOpenGLTexture2D ,
const wchar_t *  name,
const class CRhTextureAttributes &  ,
class CRhinoDisplayEngine_OGL ,
HGLRC   
)
friend

◆ CreateGlAlphaTexture

unsigned int CreateGlAlphaTexture ( const CRhinoDib ,
bool  ,
unsigned int   
)
friend

◆ CRhCmnDisplayBitmap

friend class CRhCmnDisplayBitmap
friend

◆ CRhEngine_GL11

friend class CRhEngine_GL11
friend

◆ CRhEngine_PEP_GL33

friend class CRhEngine_PEP_GL33
friend

friend void Combine(const CRhinoDib&, CRhinoDib&, const float*, float*);

◆ CRhinoDisplayEngine_GDI

friend class CRhinoDisplayEngine_GDI
friend

◆ CRhinoDisplayEngine_OGL

friend class CRhinoDisplayEngine_OGL
friend

◆ CRhinoDisplayPipeline

friend class CRhinoDisplayPipeline
friend

◆ CRhOpenGLRenderer

friend class CRhOpenGLRenderer
friend

friend class CRhinoZBuffer; friend class CRhinoRenderOverlays;

◆ CRhOpenGLTexture2D

friend class CRhOpenGLTexture2D
friend

◆ CRhOpenGLTextureCube

friend class CRhOpenGLTextureCube
friend

◆ CRhRdkPostEffectImage

friend class CRhRdkPostEffectImage
friend

This is a list of the badly behaved.

◆ CRhRegionSelectHelper

friend class CRhRegionSelectHelper
friend

◆ CXXXXRender

friend class CXXXXRender
friend

◆ GetGlTextureForDib

GLuint GetGlTextureForDib ( class CRhinoDisplayEngine_OGL ,
const CRhinoDib  
)
friend

friend CRhinoDib* RhinoCreateAnaglyph(const CRhinoDib&, const CRhinoDib&,const int); friend void ConvertDepthToImage(CRhinoDib&, bool);

◆ RhinoUpdateCachedTextureFromDib

bool RhinoUpdateCachedTextureFromDib ( unsigned int  ,
const CRhinoDib  
)
friend

Description: Updates the given cached texture's contents with the contents of the passed in Dib. Note: If the resolution of the Dib is not the same as the cached texture's, then a new cached texture will be created in its place, re-using the same cached handle. For performance purposes, it is recommended that you try to manage using matching resolutions when updating cached textures.

Parameters: hTexture - handle to a valid cached texture (obtained by calling GetCachedTexture()) Dib - Image contents used to update the cached texture's contents.

Returns: True - if/when the updating of the cached texture succeeds. False - if/when something failed during the update process.

◆ TestDavidEBitmapFlip

friend class TestDavidEBitmapFlip
friend

Member Data Documentation

◆ m_color_depth

unsigned int CRhinoDib::m_color_depth
protected

◆ m_dc

CDC CRhinoDib::m_dc
protected

This Mac-only CDC points at ourself. We deliberately use an instantiated CDC object rather than using the Windows m_pDC so the two very different CDC implementations (Mac and Windows) do not collide and the Mac CDC cannot be deleted independently of this DIB.

◆ m_dpi

double CRhinoDib::m_dpi
protected

◆ m_height

int CRhinoDib::m_height
protected

◆ m_image_rep

NSBitmapImageRep* CRhinoDib::m_image_rep
protected

Native OS X NSBitmapImageRep data is stored top row first. Windows bitmaps are stored bottom row first. Rhino code expects to access the raw pixels in a CRhinoDib, so the pixels stored in m_image are stored bottom row first.

◆ m_is_gray_scale

bool CRhinoDib::m_is_gray_scale
protected

◆ m_nsimage

NSImage* CRhinoDib::m_nsimage
protected

NSImage that contains the above NSBitmapImageRep.

◆ m_width

int CRhinoDib::m_width
protected

◆ m_wLastSaveName

ON_wString CRhinoDib::m_wLastSaveName
mutableprotected