void MusRC::DrawBracket ( MusDC *dc, MusSystem *system, int x, int y1, int y2, int cod, int staffSize) // int x, y1, y2; x, 1e et 2e y de barre vert // int cod; si ON, on fait 2e barre vert. mince en position x { int xg, xd, yg, yd, ecart, centre; //HPEN hPen; //discontinu = 0; if (cod == 2) { DrawBrace ( dc, system, x, y1, y2, staffSize); return; } //else if (hdc) { dc->SetPen( m_currentColour , 1, wxSOLID ); dc->SetBrush( m_currentColour , wxTRANSPARENT ); ecart = m_doc->m_barlineSpacing; centre = x - ecart; xg = centre - ecart*2; xd = centre + ecart*2; yg = y1 + m_doc->m_interl[ staffSize ] * 2; yd = y1; SwapY( &yg, &yd ); dc->DrawEllipticArc( ToRendererX(xg), ToRendererY(yg), ToRendererX(xd-xg), ToRendererX(yg-yd), 88, 0 ); yg = y2; yd = y2 - m_doc->m_interl[ staffSize ] * 2; SwapY( &yg, &yd ); dc->DrawEllipticArc( ToRendererX(xg), ToRendererY(yg), ToRendererX(xd-xg), ToRendererX(yg-yd), 360, 272 ); dc->ResetPen(); dc->ResetBrush(); xg = x - (m_doc->m_beamWhiteWidth[0] + 1); // determine le blanc entre barres grosse et mince v_bline2( dc, y1, y2, xg, m_doc->m_beamWidth[0]); } //if (cod) //v_bline(dc, y1, y2, x, m_doc->m_parameters.m_barlineWidth); return; }
void View::DrawFullRectangle( DeviceContext *dc, int x1, int y1, int x2, int y2 ) /* dessine rectangle plein */ { assert( dc ); SwapY( &y1, &y2 ); dc->SetPen( m_currentColour, 0, AxSOLID ); dc->SetBrush( m_currentColour, AxSOLID ); dc->DrawRectangle( ToDeviceContextX( x1 ), ToDeviceContextY(y1), ToDeviceContextX(x2 - x1) , ToDeviceContextX( y1 - y2 )); dc->ResetPen(); dc->ResetBrush(); return; }
/* Draw rectangle partly filled in, as specified by <fillSection>: 1=top, 2=bottom, 3=left side, 4=right side; 0=don't fill in any part. ??SO FAR, <fillSection> IS IGNORED. */ void View::DrawPartFullRectangle( DeviceContext *dc, int x1, int y1, int x2, int y2, int fillSection ) { assert( dc ); // DC cannot be NULL SwapY( &y1, &y2 ); //dc->SetPen( m_currentColour, 0, AxSOLID ); //dc->SetBrush( AxWHITE, AxTRANSPARENT ); dc->SetPen( AxBLUE, 0, AxSOLID ); dc->SetBrush( AxRED, AxTRANSPARENT ); dc->DrawRectangle( ToDeviceContextX( x1 ), ToDeviceContextY(y1), ToDeviceContextX(x2 - x1) , ToDeviceContextX( y1 - y2 )); dc->ResetPen(); dc->ResetBrush(); return; }
void MusRC::DrawBrace ( MusDC *dc, MusSystem *system, int x, int y1, int y2, int staffSize) { int new_coords[2][6]; wxASSERT_MSG( dc , "DC cannot be NULL"); SwapY( &y1, &y2 ); int ymed, xdec, fact, nbrInt; // static POINT *bcoord; // MusPoint *ptcoord; dc->SetPen( m_currentColour , 1, wxSOLID ); dc->SetBrush( m_currentColour , wxSOLID ); x -= m_doc->m_beamWhiteWidth[ staffSize ]; // distance entre barre et debut accolade nbrInt = BEZIER_NB_POINTS; ymed = (y1 + y2) / 2; fact = m_doc->m_beamWidth[ staffSize ]-1 + m_doc->m_env.m_barlineWidth; xdec = ToRendererX(fact); point_[0].x = ToRendererX(x); point_[0].y = ToRendererY(y1); point_[1].x = ToRendererX(x - m_doc->m_step2); point_[1].y = point_[0].y - ToRendererX( m_doc->m_interl[ staffSize ]*3); point_[3].x = ToRendererX(x - m_doc->m_step1*2); point_[3].y = ToRendererY(ymed); point_[2].x = ToRendererX(x + m_doc->m_step1); point_[2].y = point_[3].y + ToRendererX( m_doc->m_interl[ staffSize ]); new_coords[0][0] = point_[1].x; new_coords[0][1] = point_[1].y; new_coords[0][2] = point_[2].x; new_coords[0][3] = point_[2].y; new_coords[0][4] = point_[3].x; new_coords[0][5] = point_[3].y; pntswap (&point_[0], &point_[3]); pntswap (&point_[1], &point_[2]); point_[1].x += xdec; point_[2].x += xdec; point_[1].y = point_[0].y + ToRendererX( m_doc->m_interl[ staffSize ]*2); new_coords[1][0] = point_[1].x; new_coords[1][1] = point_[1].y; new_coords[1][2] = point_[2].x; new_coords[1][3] = point_[2].y; new_coords[1][4] = point_[3].x; new_coords[1][5] = point_[3].y; dc->DrawComplexBezierPath(ToRendererX(x), ToRendererY(y1), new_coords[0], new_coords[1]); // on produit l'image reflet vers le bas: 0 est identique point_[1].y = point_[0].y - ToRendererX( m_doc->m_interl[ staffSize ]*2); point_[3].y = ToRendererY(y2); point_[2].y = point_[3].y + ToRendererX( m_doc->m_interl[ staffSize ]*3); new_coords[0][0] = point_[1].x; new_coords[0][1] = point_[1].y; new_coords[0][2] = point_[2].x; new_coords[0][3] = point_[2].y; new_coords[0][4] = point_[3].x; new_coords[0][5] = point_[3].y; pntswap (&point_[0], &point_[3]); pntswap (&point_[1], &point_[2]); point_[1].x -= xdec; point_[2].x -= xdec; point_[2].y = point_[3].y - ToRendererX( m_doc->m_interl[ staffSize ]); new_coords[1][0] = point_[1].x; new_coords[1][1] = point_[1].y; new_coords[1][2] = point_[2].x; new_coords[1][3] = point_[2].y; new_coords[1][4] = point_[3].x; new_coords[1][5] = point_[3].y; dc->DrawComplexBezierPath(point_[3].x, point_[3].y, new_coords[0], new_coords[1]); //dc->SetPen( m_currentColour , 1, wxSOLID ); //dc->SetBrush( m_currentColour , wxSOLID ); //dc->DrawPolygon (nbrInt*2, bcoord, 0, 0, wxWINDING_RULE ); //(sizeof (bcoord)*2) / sizeof (POINT)); nbrInt*2+ 1; dc->ResetPen(); dc->ResetBrush(); return; }