Floaters and Regions in the LBitmapWindow Class

The LBitmapWindow class automates the region and floater capabilities of the toolkit.

Some definitions:

Floater

A selection (actually, a separate bitmap) that has an animated outline.

The floater can be created by using LBitmapWindow::SetToolType().

The floater can be moved by clicking and dragging the mouse.

The LBitmapWindow::HasFloater() member function returns TRUE if there is a floater.

Region

A subset of a bitmap, much like a Windows region. When a bitmap has a region, most image processing functions will only process the region and not the entire bitmap.

The LBitmapBase::HasRgn() member function returns TRUE if there is a region.

 

The following are various scenarios and how they can be implemented with the LBitmapWindow class.

Scenario One

I want to create a floater with the region tool, and move it around. I don't want a region

m_BitmapWindow.SetAutoFloaterToRgn(FALSE)
m_BitmapWindow.SetToolType(TOOL_REGION)
m_BitmapWindow.SetRegionType(REGION_TYPE_RECT)
<Click and drag mouse to create floater>
<Drag mouse to move floater>

In this scenario, no region is created

 

Scenario Two

I want to create a region with the region tool. I don't want the floater.

m_BitmapWindow.SetAutoFloaterToRgn(TRUE)
m_BitmapWindow.SetToolType(TOOL_REGION)
m_BitmapWindow.SetRegionType(REGION_TYPE_RECT)
Click and drag mouse to create floater
m_BitmapWindow.CancelRgn() //this removes the floater, but leaves the bitmap region

In this scenario, a region is created and the floater is destroyed.

 

Scenario Three

I want to create a floater programmatically (without using the tools). I don't want a bitmap region.

RECT Rect={10,20,50,100};
m_ BitmapWindow.SetAutoRgnToFloater(TRUE);
LBitmapRgn Region(&m_ BitmapWindow);
Region.SetRgnRect(&Rect);

 

Scenario Four

I want to create a region programmatically (without using the tools). I don't want a floater.

RECT Rect={10,20,50,100};
m_ BitmapWindow.SetAutoRgnToFloater(FALSE);
LBitmapRgn Region(&m_ BitmapWindow);
Region.SetRgnRect(&Rect);

Related Topics:

image\sqrblit.gif Saving a Region