void CParmCopyBorderDlg::OnBnClickedAround() { UpdateMyData(); UpdateBorders(); UpdateMyData(FALSE); EnableBorders(); }
VOID CDrawingObject::Scale(const FLOAT dFactor) { m_fFactor = dFactor; FLOAT scaledW = (dFactor-1) * m_fWidth; FLOAT scaledH = (dFactor-1) * m_fHeight; FLOAT scaledX = scaledW/2.0f; FLOAT scaledY = scaledH/2.0f; m_fXI -= scaledX; m_fYI -= scaledY; m_fWidth += scaledW; m_fHeight += scaledH; // Only limit scaling in the case that the factor is not 1.0 if(dFactor != 1.0f) { m_fXI = max(0, m_fXI); m_fYI = max(0, m_fYI); m_fWidth = min(min(m_iCWidth, m_iCHeight), m_fWidth); m_fHeight = min(min(m_iCWidth, m_iCHeight), m_fHeight); } // Readjust borders for the objects new size UpdateBorders(); }
void CParmCopyBorderDlg::OnChangeBorder() { if (!m_bInit) return; if (!m_bDst) return; UpdateMyData(); UpdateBorders(); UpdateMyData(FALSE); }
BOOL CParmCopyBorderDlg::OnInitDialog() { IppiSize srcSize = {0, 0}, dstSize = {0, 0}; srcSize = m_pDocSrc->GetImage()->GetActualSize(); m_bDst = m_pDocDst ? TRUE : FALSE; if (m_bDst) dstSize = m_pDocDst->GetImage()->GetActualSize(); m_dhw[0] = dstSize.height; m_dhw[1] = dstSize.width; m_shw[0] = srcSize.height; m_shw[1] = srcSize.width; CImage* aroundImage = NULL; if (m_bDst) aroundImage = m_pDocDst->GetImage(); else if (m_Func.Inplace()) aroundImage = m_pDocSrc->GetImage(); if (aroundImage) { const IppiRect* roi = aroundImage->GetRoi(); if (roi) { m_ayx[0] = roi->y; m_ayx[1] = roi->x; m_a_y_x[0] = aroundImage->Height() - roi->height - roi->y; m_a_y_x[1] = aroundImage->Width () - roi->width - roi->x; } else aroundImage = NULL; } if (!aroundImage) m_aroundRoi = FALSE; UpdateBorders(); CParamDlg::OnInitDialog(); if (!aroundImage) m_aroundButton.EnableWindow(FALSE); SetSpin(); EnableBorders(); UpdateMyData(FALSE); return TRUE; }
void CParmCopyBorderDlg::OnOK() { CParamDlg::OnOK(); UpdateMyData(); UpdateBorders(); }
// Sets the default position, dimensions and color for the drawing object VOID CDrawingObject::ResetState(const FLOAT startX, const FLOAT startY, const int ixClient, const int iyClient, const int iScaledWidth, const int iScaledHeight, const DrawingColor colorChoice) { // Set width and height of the client area // must adjust for dpi aware m_iCWidth = iScaledWidth; m_iCHeight = iScaledHeight; // Initialize width height of object m_fWidth = INITIAL_OBJ_WIDTH; m_fHeight = INITIAL_OBJ_HEIGHT; // Set outer elastic border UpdateBorders(); // Set the top, left starting position // Set cooredinates given by processor m_fXI = startX; m_fYI = startY; // Set coordinates used for rendering m_fXR = startX; m_fYR = startY; // Set touch origin to 0 m_fOX = 0.0f; m_fOY = 0.0f; // Initialize scaling factor m_fFactor = 1.0f; // Initialize angle m_fAngleCumulative = 0.0f; if(m_spRT) { HRESULT hr; D2D1_SIZE_U size; size.width = ixClient; size.height = iyClient; hr= m_spRT->Resize(size); if (FAILED(hr)) { m_d2dDriver->DiscardDeviceResources(); InvalidateRect(m_hWnd, NULL, FALSE); } } // Determines what brush to use for drawing this object and // gets the brush from the D2DDriver class switch (colorChoice){ case Blue: m_currBrush = m_d2dDriver->get_GradBrush(CD2DDriver::GRB_Blue); break; case Orange: m_currBrush = m_d2dDriver->get_GradBrush(CD2DDriver::GRB_Orange); break; case Green: m_currBrush = m_d2dDriver->get_GradBrush(CD2DDriver::GRB_Green); break; case Red: m_currBrush = m_d2dDriver->get_GradBrush(CD2DDriver::GRB_Red); break; default: m_currBrush = m_d2dDriver->get_GradBrush(CD2DDriver::GRB_Blue); } }