void FenetrePrincipale::TracerDIB(wxImage *d, wxBufferedPaintDC &hdc, wxPoint *curseur) { int x=feuille->GetScrollPos(wxHORIZONTAL); int y=feuille->GetScrollPos(wxVERTICAL); if (curseur) { wxPoint s(curseur->x,curseur->y); osgApp->TracerZoom(s); return; } hdc.SetBrush(*wxRED_BRUSH); //if (facteurZoom!=0) { if (imAcq->cols>0) { if (feuille->BitmapAffichee()==NULL) { wxRect src(0,0,imAcq->cols,imAcq->rows); wxRect dst; int fZoomNume,fZoomDeno; CalculZoom(fZoomNume,fZoomDeno); dst=wxRect(0,0,max(imAcq->cols*fZoomNume/fZoomDeno-1,1),max(imAcq->rows*fZoomNume/fZoomDeno-1,1)); wxImage sousImage=d->GetSubImage(src); wxImage imageZoom=sousImage.Scale(dst.GetRight()-dst.GetLeft()+1,dst.GetBottom()-dst.GetTop()+1); feuille->BitmapAffichee(new wxBitmap(imageZoom)); } hdc.DrawBitmap(*feuille->BitmapAffichee(),0,0); } } /*else { wxBitmap pub(*d); if (curseur) osgApp->TracerZoom(*curseur); else { hdc.DrawBitmap(pub,-x,-y); hdc.SetPen(*wxBLACK); hdc.DrawRectangle(0,0,r.GetRight(),r.GetBottom()); hdc.DrawRectangle(r.GetLeft(),dst.GetBottom(),r.GetRight(),r.GetBottom()); } }*/ }
void FenetrePrincipale::DrawLignes(wxBufferedPaintDC &hdc) { wxBrush wt=*wxTRANSPARENT_BRUSH; hdc.SetBrush(wt); wxPen pActif(*wxBLACK, 3); wxPen pInactif(*wxBLACK, 1); for (int i=0;i<10;i++) if (feuille->Coupe(i)->GetWidth()!=0 || feuille->Coupe(i)->GetHeight()!=0) { wxPoint pTmp1(feuille->Coupe(i)->GetTopLeft()); wxPoint pTmp2(feuille->Coupe(i)->GetBottomRight()); if (i==feuille->IndiceCoupeSelec()) hdc.SetPen(pActif); else hdc.SetPen(pInactif); hdc.DrawLine(RepereImageEcran(pTmp1), RepereImageEcran(pTmp2)); } }
void FenetrePrincipale::DrawRectangles(wxBufferedPaintDC &hdc) { wxBrush wt=*wxTRANSPARENT_BRUSH; hdc.SetBrush(wt); hdc.SetLogicalFunction(wxXOR); hdc.SetPen(wxPen(*wxWHITE, 3)); for (int i=0;i<10;i++) if (feuille->Rectangle(i)->GetWidth()!=0 || feuille->Rectangle(i)->GetHeight()!=0) { hdc.DrawRectangle(RepereImageEcran(*feuille->Rectangle(i))); if (i==feuille->IndiceRectangleSelec()) { int fZoomNume,fZoomDeno; CalculZoom(fZoomNume,fZoomDeno); wxPoint pTmp(feuille->Rectangle(i)->GetTopLeft()); wxPoint p1(RepereImageEcran(pTmp)); wxRect rTrace(p1.x,p1.y,feuille->Rectangle(i)->width*fZoomNume/fZoomDeno,feuille->Rectangle(i)->height*fZoomNume/fZoomDeno); hdc.DrawLine(rTrace.GetBottomLeft(),rTrace.GetTopRight()); hdc.DrawLine(rTrace.GetTopLeft(),rTrace.GetBottomRight()); } } }