//------------------------------------------------------------
// Extract edge
// Called by the UI when the EdgeExtraction button is pushed
//------------------------------------------------------------
void ImpressionistUI::cb_EdgeExtraction(Fl_Widget* o, void* v)
{
	ImpressionistUI *pUI = ((ImpressionistUI*)(o->user_data()));
	ImpressionistDoc * pDoc = ((ImpressionistUI*)(o->user_data()))->getDocument();

	//calculate the edge map according to the threshold
	pDoc->CalculateEdgeMap(pUI->m_nEdgeThreshold);
	pUI->m_origView->viewMode = OriginalView::EDGE_MODE;
	pUI->m_origView->refresh();
}
//---The light button callback for edge clipping---------------------
void ImpressionistUI::cb_EdgeClipping(Fl_Widget* o, void* v)
{
	ImpressionistUI *pUI = ((ImpressionistUI*)(o->user_data()));

	if (pUI->m_bEdgeClipping == TRUE) pUI->m_bEdgeClipping = FALSE;
	else {
		pUI->m_bEdgeClipping = TRUE;
		ImpressionistDoc* pDoc = pUI->getDocument();
		pDoc->CalculateEdgeMap(pUI->m_nEdgeThreshold);
	}
}