本文整理汇总了C++中ttool::Application::getPaletteController方法的典型用法代码示例。如果您正苦于以下问题:C++ Application::getPaletteController方法的具体用法?C++ Application::getPaletteController怎么用?C++ Application::getPaletteController使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ttool::Application
的用法示例。
在下文中一共展示了Application::getPaletteController方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pickRect
void RGBPickerTool::pickRect() {
TImageP image = TImageP(getImage(false));
TTool::Application *app = TTool::getApplication();
TPaletteHandle *ph = app->getPaletteController()->getCurrentPalette();
int styleId = ph->getStyleIndex();
TPalette *palette = ph->getPalette();
TRectD area = m_selectingRect;
if (!palette) return;
if (m_selectingRect.x0 > m_selectingRect.x1) {
area.x1 = m_selectingRect.x0;
area.x0 = m_selectingRect.x1;
}
if (m_selectingRect.y0 > m_selectingRect.y1) {
area.y1 = m_selectingRect.y0;
area.y0 = m_selectingRect.y1;
}
m_selectingRect.empty();
if (area.getLx() <= 1 || area.getLy() <= 1) return;
StylePicker picker(image, palette);
// iwsw commented out temporarily
// if (m_viewer->get3DLutUtil() &&
// Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled())
// m_viewer->get3DLutUtil()->bindFBO();
m_currentValue = picker.pickColor(area);
// iwsw commented out temporarily
// if (m_viewer->get3DLutUtil() &&
// Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled())
// m_viewer->get3DLutUtil()->releaseFBO();
}
示例2: leftButtonDown
void RGBPickerTool::leftButtonDown(const TPointD &pos, const TMouseEvent &e) {
TTool::Application *app = TTool::getApplication();
TPaletteHandle *pltHandle = app->getPaletteController()->getCurrentPalette();
m_currentStyleId = pltHandle->getStyleIndex();
if (m_currentStyleId == 0) return;
TColorStyle *colorStyle = pltHandle->getStyle();
if (colorStyle) m_oldValue = colorStyle->getMainColor();
if (m_pickType.getValue() == RECT_PICK) {
m_selectingRect.x0 = e.m_pos.x;
m_selectingRect.y0 = e.m_pos.y;
m_selectingRect.x1 = e.m_pos.x;
m_selectingRect.y1 = e.m_pos.y;
m_drawingRect.x0 = pos.x;
m_drawingRect.y0 = pos.y;
m_drawingRect.x1 = pos.x;
m_drawingRect.y1 = pos.y;
invalidate();
return;
} else if (m_pickType.getValue() == FREEHAND_PICK) {
startFreehand(pos, convert(e.m_pos));
return;
} else if (m_pickType.getValue() == POLYLINE_PICK) {
addPointPolyline(pos, convert(e.m_pos));
return;
} else {
pick(e.m_pos);
}
}
示例3: setCurrentColorWithUndo
void setCurrentColorWithUndo(const TPixel32 &color) {
TTool::Application *app = TTool::getApplication();
TPaletteHandle *ph = app->getPaletteController()->getCurrentPalette();
int styleId = ph->getStyleIndex();
TPalette *palette = ph->getPalette();
TXshSimpleLevel *level = app->getCurrentLevel()->getSimpleLevel();
if (palette)
TUndoManager::manager()->add(
new UndoPickRGBM(palette, styleId, color, level));
setCurrentColor(color);
if (level) {
std::vector<TFrameId> fids;
level->getFids(fids);
invalidateIcons(level, fids);
}
}
示例4: onImageChanged
void RGBPickerTool::onImageChanged() {
if (m_currentStyleId != 0 && m_makePick &&
(m_pickType.getValue() == POLYLINE_PICK ||
m_pickType.getValue() == RECT_PICK)) {
TTool::Application *app = TTool::getApplication();
TPaletteHandle *ph = app->getPaletteController()->getCurrentPalette();
int styleId = ph->getStyleIndex();
TPalette *palette = ph->getPalette();
TXshSimpleLevel *level = app->getCurrentLevel()->getSimpleLevel();
if (palette)
TUndoManager::manager()->add(
new UndoPickRGBM(palette, styleId, m_currentValue, level));
setCurrentColor(m_currentValue);
if (level) {
std::vector<TFrameId> fids;
level->getFids(fids);
invalidateIcons(level, fids);
}
}
m_makePick = false;
}
示例5: pick
void RGBPickerTool::pick(TPoint pos) {
TImageP image = TImageP(getImage(false));
TTool::Application *app = TTool::getApplication();
TPaletteHandle *ph = app->getPaletteController()->getCurrentPalette();
int styleId = ph->getStyleIndex();
TPalette *palette = ph->getPalette();
if (!palette) return;
TRectD area = TRectD(pos.x - 1, pos.y - 1, pos.x + 1, pos.y + 1);
StylePicker picker(image, palette);
// iwsw commented out temporarily
// if (m_viewer->get3DLutUtil() &&
// Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled())
// m_viewer->get3DLutUtil()->bindFBO();
m_currentValue = picker.pickColor(area);
// iwsw commented out temporarily
// if (m_viewer->get3DLutUtil() &&
// Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled())
// m_viewer->get3DLutUtil()->releaseFBO();
TXshSimpleLevel *level = app->getCurrentLevel()->getSimpleLevel();
UndoPickRGBM *cmd = new UndoPickRGBM(palette, styleId, m_currentValue, level);
TUndoManager::manager()->add(cmd);
cmd->redo();
/*
setCurrentColor(m_currentValue);
if(level)
{
vector<TFrameId> fids;
level->getFids(fids);
invalidateIcons(level,fids);
}
*/
}
示例6: pickStroke
void RGBPickerTool::pickStroke() {
TImageP image = TImageP(getImage(false));
TTool::Application *app = TTool::getApplication();
TPaletteHandle *ph = app->getPaletteController()->getCurrentPalette();
int styleId = ph->getStyleIndex();
TPalette *palette = ph->getPalette();
if (!palette) return;
StylePicker picker(image, palette);
TStroke *stroke = new TStroke(*m_stroke);
// iwsw commented out temporarily
// if (m_viewer->get3DLutUtil() &&
// Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled())
// m_viewer->get3DLutUtil()->bindFBO();
m_currentValue = picker.pickColor(stroke);
// iwsw commented out temporarily
// if (m_viewer->get3DLutUtil() &&
// Preferences::instance()->isDoColorCorrectionByUsing3DLutEnabled())
// m_viewer->get3DLutUtil()->releaseFBO();
if (!(m_pickType.getValue() == POLYLINE_PICK)) {
TXshSimpleLevel *level = app->getCurrentLevel()->getSimpleLevel();
TUndoManager::manager()->add(
new UndoPickRGBM(palette, styleId, m_currentValue, level));
setCurrentColor(m_currentValue);
if (level) {
std::vector<TFrameId> fids;
level->getFids(fids);
invalidateIcons(level, fids);
}
}
}