Esempio n. 1
0
std::shared_ptr<touchmind::model::node::NodeModel>
touchmind::model::node::NodeModel::Create(touchmind::selection::SelectionManager *pSelectionManager) {
  ASSERT(pSelectionManager != nullptr);
  auto node = std::make_shared<NodeModel>();
  node->SetSelectionManager(pSelectionManager);

  auto defaultProp = pSelectionManager->GetDefaultPropertyModel();
  node->SetBackgroundColor(defaultProp->UpdateProperty_GetNodeBackgroundColor());
  node->SetNodeShape(defaultProp->UpdateProperty_GetNodeShape());

  auto path = node->GetPathModel();
  path->SetSelectionManager(pSelectionManager);
  path->SetColor(defaultProp->UpdateProperty_GetLineColor());
  path->SetWidth(defaultProp->UpdateProperty_GetLineWidth());
  path->SetStyle(defaultProp->UpdateProperty_GetLineStyle());
  return node;
}
Esempio n. 2
0
void touchmind::view::path::impl::DefaultPathView::CreateDeviceDependentResources(
    touchmind::Context *pContext,
    ID2D1RenderTarget *pRenderTarget )
{
    if (!_CheckValidity()) {
        return;
    }
    auto node = GetNodeModel().lock();
    auto path = node->GetPathModel();
    if (path->IsRepaintRequired(GetRepaintCounter()) ||
            m_pathBrush == nullptr ||
            m_pathGeometry == nullptr ||
            m_pathStyle == nullptr) {
        _CreateDeviceDependentResources(pContext, pRenderTarget, node);
        if (path->IsSelected()) {
            _CreateTexture(pContext, pRenderTarget, node);
        } else {
            m_pBitmap = nullptr;
        }
        SetRepaintCounter(path);
    }
}
Esempio n. 3
0
void touchmind::view::path::impl::DefaultPathView::Draw(
    touchmind::Context *pContext,
    ID2D1RenderTarget *pRenderTarget )
{
    if (!_CheckValidity()) {
        return;
    }
    auto node = GetNodeModel().lock();
    auto path = node->GetPathModel();

    CreateDeviceDependentResources(pContext, pRenderTarget);
    if (path->IsSelected()) {
        FLOAT shadowOffset = GetNodeViewManager()->GetGaussFilter()->GetOffset();
        D2D1_SIZE_F size = m_pBitmap->GetSize();
        FLOAT left = m_bounds.left -  shadowOffset;
        FLOAT top  = m_bounds.top - shadowOffset;
        pRenderTarget->DrawBitmap(m_pBitmap, D2D1::RectF(left, top, left + size.width, top + size.height));
    }
    pRenderTarget->DrawGeometry(
        m_pathGeometry,
        m_pathBrush,
        path->GetWidthAsValue(),
        m_pathStyle);
}