Ejemplo n.º 1
0
//---------------------------------------------------------------------------
void __fastcall TClockAdjDlg::DrawCursor(void)
{
	TCanvas *pCanvas = PBoxT->Canvas;
	pCanvas->Pen->Color = clLime;
	pCanvas->Pen->Style = psDot;
	pCanvas->MoveTo(m_CursorX, 0);
	int rop = ::SetROP2(pCanvas->Handle, R2_MASKPENNOT);
	pCanvas->LineTo(m_CursorX, PBoxT->Height - 1);
	::SetROP2(pCanvas->Handle, rop);
	if( m_Point ){
		pCanvas->Pen->Color = clYellow;
		pCanvas->Pen->Style = psSolid;
		pCanvas->MoveTo(m_PointX, m_PointY);
		::SetROP2(pCanvas->Handle, R2_MASKPENNOT);
		pCanvas->LineTo(m_PointX2, m_PointY2);
		::SetROP2(pCanvas->Handle, rop);
		char bf[256];
		if( sys.m_MsgEng ){
			sprintf( bf, "OK : Left button,  Cancel : Right button   Clock=%.2lf", GetPointSamp());
		}
		else {
			sprintf( bf, "決定 : 左ボタン,  中止 : 右ボタン   Clock=%.2lf", GetPointSamp());
		}
		DrawMessage(bf);
		if( PBoxT->Cursor != crCross ) PBoxT->Cursor = crCross;
	}
	else {
		if( PBoxT->Cursor != crDefault ) PBoxT->Cursor = crDefault;
	}
}
Ejemplo n.º 2
0
//===========================================================================
void TTransromXYZ_RoQE::DrawElementFace()
{
      TCanvas    *dbCanvas = VisualElementParam->Bitmap->Canvas;
      int         aw       = VisualElementParam->Width ;
      int         ah       = VisualElementParam->Height;

      dbCanvas->Brush->Color = clWhite;
      dbCanvas->Pen  ->Color = clBlack;

      dbCanvas->Rectangle(0, 0, aw, ah);

   // --------- Отрисовка прямоугольника --- (прямокгольник процесса разработки) -----
     if (DesignPhase != dpAllreadyTesting) {
         if (DesignPhase == dpNotTesting  ) {dbCanvas->Pen  ->Color = clRed;}
         if (DesignPhase == dpNeedModified) {dbCanvas->Pen  ->Color = clRed; dbCanvas->Pen  ->Style = psDot;}

         dbCanvas->Rectangle(2, 2, VisualElementParam->Width - 2, VisualElementParam->Height - 2);

         dbCanvas->Pen->Color = clBlack;
         dbCanvas->Pen->Style = psSolid;
      }   

      dbCanvas->MoveTo(5, 2     );   dbCanvas->LineTo(5, ah - 2);
      dbCanvas->MoveTo(2, ah - 5);   dbCanvas->LineTo(aw - 2, ah - 5);

      dbCanvas->Pen->Color = clBlue;
      dbCanvas->MoveTo(8, ah - 10);   dbCanvas->LineTo(aw - 4, 6);

      dbCanvas->Pen->Color = clBlack;
}
Ejemplo n.º 3
0
void __fastcall TForm4::PaintBox5Paint(TObject *Sender)
{
        TCanvas *FormCanvas = ((TPaintBox*)Sender)->Canvas;
        int CenterX, CenterY;

        if (((TPanel *)((TPaintBox *)Sender)->Parent)->BevelOuter == bvLowered)
        {
                FormCanvas->Pen->Width = 2;
                FormCanvas->Font->Style = TFontStyles() << fsBold << fsItalic;
        }
        else FormCanvas->Pen->Width = 1;

        CenterX = 16;
        CenterY = 16;
        /*FormCanvas->MoveTo(CenterX + 8, CenterY + 5);
        FormCanvas->LineTo(CenterX - 8, CenterY + 5);*/
        FormCanvas->Font->Name = "Arial";
        FormCanvas->Font->Size = 6;
        //FormCanvas->Font->Style = TFontStyles() << fsBold << fsItalic;
        FormCanvas->TextOut(CenterX - 9, CenterY + 5, "АВТО");
        //Рисование значка щероховатости над полкой
        FormCanvas->Pen->Width = 1;
        FormCanvas->MoveTo(CenterX - 5, CenterY - 5);
        FormCanvas->LineTo(CenterX, CenterY + 4);
	FormCanvas->LineTo(CenterX + 8, CenterY - 10);
}
Ejemplo n.º 4
0
//---------------------------------------------------------------------------
void __fastcall TRxViewDlg::DrawWaterCursor(void)
{
	if( !m_pRxSet ) return;

    int fo = m_pRxSet->m_pDem->m_CarrierFreq;
	int xx = m_rcBar[sbWATER].Left + 0.5 + (fo - m_WaterLowFQ) * m_fftXW / m_WaterWidth;
	if( xx < m_rcBar[sbWATER].Left + 4 ) return;
    if( xx > m_rcBar[sbWATER].Right - 4 ) return;
    TCanvas *pCanvas = StatusBar->Canvas;
	int fb = m_rcBar[sbWATER].Bottom - 1;
#if 0
	if( (m_pRxSet->m_Mode == MODE_RTTY) || (m_pRxSet->m_Mode == MODE_U_RTTY) ){
		pCanvas->Pen->Width = 3;
		pCanvas->Pen->Color = MainVARI->m_tWaterColset[4].c;
		int x = m_rcBar[sbWATER].Left + 0.5 + (fo - m_WaterLowFQ - 85.5) * m_fftXW / m_WaterWidth;
        pCanvas->MoveTo(x, fb-4);
        pCanvas->LineTo(x, fb-1);
		x = m_rcBar[sbWATER].Left + 0.5 + (fo - m_WaterLowFQ + 85.5) * m_fftXW / m_WaterWidth;
        pCanvas->LineTo(x, fb-1);
        pCanvas->LineTo(x, fb-5);
		pCanvas->Pen->Width = 1;
    }
#endif
	POINT pt[3];
    pt[0].x = xx - 4; pt[0].y = fb;
    pt[1].x = xx + 4; pt[1].y = fb;
    pt[2].x = xx; pt[2].y = fb - 6;

	pCanvas->Pen->Color = MainVARI->m_tWaterColset[3].c;
	pCanvas->Brush->Color = MainVARI->m_tWaterColset[4].c;
	pCanvas->Polygon(pt, 2);
}
Ejemplo n.º 5
0
void __fastcall TForm4::PaintBox1Paint(TObject *Sender)
{
        TCanvas *FormCanvas = ((TPaintBox*)Sender)->Canvas;
        int CenterX, CenterY;

        if (((TPanel *)((TPaintBox *)Sender)->Parent)->BevelOuter == bvLowered) FormCanvas->Pen->Width = 2; else FormCanvas->Pen->Width = 1;
        CenterX = 15;
        CenterY = 16;
        FormCanvas->MoveTo(CenterX - 8, CenterY - 3);
        FormCanvas->LineTo(CenterX, CenterY + 11);
        FormCanvas->LineTo(CenterX + 11, CenterY - 12);
}
Ejemplo n.º 6
0
void __fastcall TTScope::PaintScope(CScope *sp, int n)
{
	TRect rc;

	int YW = (pBitmap->Height - GAGEWIDTH) / 2;
	rc.Top = (YW * n) + GAGEWIDTH;
	rc.Bottom = rc.Top + YW;
	rc.Left = 0;
	rc.Right = pBitmap->Width;

	TCanvas *pCanvas = pBitmap->Canvas;

	pCanvas->Brush->Color = clBlack;
	pCanvas->FillRect(rc);

	if( !sp->GetFlag() ) return;

	if( n < 2 ){
		pCanvas->Pen->Color = clWhite;
		pBitmap->Canvas->Pen->Style = psDot;
		pCanvas->MoveTo(rc.Left, rc.Top + YW/2);
		pCanvas->LineTo(rc.Right, rc.Top + YW/2);
	}

	pCanvas->Pen->Color = clWhite;
	pBitmap->Canvas->Pen->Style = psSolid;
	double d;
	int x, y, xx, xe;
	for( x = 0; x < rc.Right; x++ ){
		xx = (x * m_XW / rc.Right) + m_XOFF;
		xe = xx + (m_XW / rc.Right);
		if( xe >= sp->m_ScopeSize ) xe = sp->m_ScopeSize - 1;
		double *dp = &sp->pScopeData[xx];
		for( ; xx <= xe; xx++, dp++ ){
			d = *dp;
			if( n < 1 ){
				y = rc.Bottom - int(d * YW * m_Gain/16384.0) - 1;
			}
			else {
				y = rc.Bottom - int(d * YW * m_Gain/32768.0) - YW/2;
			}
			if( y < rc.Top ) y = rc.Top;
			if( y > rc.Bottom ) y = rc.Bottom;
			if( x ){
				pCanvas->LineTo(x, y);
			}
			else {
				pCanvas->MoveTo(x, y);
			}
		}
	}
}
Ejemplo n.º 7
0
//---------------------------------------------------------
void __fastcall CEVision::DrawAll(HDC hDC)
{
        TCanvas *tempCanvas = new TCanvas;
        tempCanvas->Handle=hDC;

       m_ImageTmpBW8.Draw(tempCanvas->Handle,m_dScaleSizeX,m_dScaleSizeY);
       tempCanvas->Pen->Width=2;
       tempCanvas->Pen->Style=psSolid;
       tempCanvas->Pen->Color= clRed;

       if(m_bShowLayout)
          for(int nIndex=0;nIndex<m_vectRect.size();nIndex++)
          {
                tempCanvas->FrameRect(Rect(m_vectRect[nIndex].Left*m_dScaleSizeX,m_vectRect[nIndex].Top*m_dScaleSizeY,
                        m_vectRect[nIndex].Right*m_dScaleSizeX,m_vectRect[nIndex].Bottom*m_dScaleSizeY));
                tempCanvas->TextOutA( m_vectRect[nIndex].left*m_dScaleSizeX, m_vectRect[nIndex].top*m_dScaleSizeY ,IntToStr(nIndex+1));
          }

        for(int nIndex=0;nIndex<3;nIndex++)
        {
                tempCanvas->Pen->Color= clRed;
                if(m_bShowMarkROI[nIndex]) m_roiMark[nIndex].DrawFrame(tempCanvas->Handle,E_FRAME_ON, TRUE,m_dScaleSizeX,m_dScaleSizeY);

                tempCanvas->Pen->Color= clLime;
                if(m_bShowPatternROI[nIndex]) m_roiMarkPattern[nIndex].DrawFrame(tempCanvas->Handle,E_FRAME_ON, TRUE,m_dScaleSizeX,m_dScaleSizeY);

                if(m_bShowMatchResult[nIndex]) m_markMatch[nIndex].DrawPositions(tempCanvas->Handle,m_dScaleSizeX,m_dScaleSizeY);
        }
       
       if(m_bShowMatchResultAll)
       for(int nIndex=0;nIndex<m_vectPattern.size();nIndex++)
       {
               m_vectPattern[nIndex].DrawPositions(tempCanvas->Handle,m_dScaleSizeX,m_dScaleSizeY);
       }

       if(m_bShowMarkROI[2])
       {
        tempCanvas->Pen->Width=1;
        tempCanvas->Pen->Style=psDot;
        tempCanvas->Pen->Color=clRed;

        tempCanvas->MoveTo(320*m_dScaleSizeX,230*m_dScaleSizeY);
        tempCanvas->LineTo(320*m_dScaleSizeX,250*m_dScaleSizeY);
        tempCanvas->MoveTo(310*m_dScaleSizeX,240*m_dScaleSizeY);
        tempCanvas->LineTo(330*m_dScaleSizeX,240*m_dScaleSizeY);
        }



       delete tempCanvas;
}
Ejemplo n.º 8
0
void __fastcall TClipMaker::BPOnPaint(TObject *Sender)
{
	TMxPanel* bp 		= dynamic_cast<TMxPanel*>(Sender); VERIFY(bp);
    CEditableObject* O	= 	m_CurrentObject; VERIFY(O);
    TCanvas* canvas 	= bp->Canvas;
    canvas->Font->Name 	= "MS Sans Serif";
    canvas->Font->Style	= TFontStyles();
    canvas->Font->Color = clBlack;
    canvas->Pen->Color	= clBlack;
    canvas->Pen->Style	= psSolid;
    canvas->Brush->Style= bsSolid;
    if (-2==bp->Tag){
        for (UIClipIt it=clips.begin(); it!=clips.end(); it++){
	        canvas->Brush->Color= (*it==sel_clip)?(drag_obj==bp->Tag?BP_ACTIVE_DRAG_COLOR:BP_ACTIVE_COLOR):BP_INACTIVE_COLOR;
            TRect R 			= TRect((*it)->PLeft(), 1, (*it)->PRight()-1, 15);
    	    AnsiString fx_name	= (*it)->FXName();
            if (!fx_name.IsEmpty()){
                canvas->Rectangle	(R);
                R.Top				+= 1;
                R.Bottom			-= 1;
                R.Left				+= 1;
                R.Right				-= 1;
                canvas->TextRect	(R,R.Left,R.Top,fx_name);
            }
        }
    }else if ((bp->Tag>=0)&&(bp->Tag<(int)O->BoneParts().size())){
        AnsiString mn_prev		= "";
        for (UIClipIt it=clips.begin(); it!=clips.end(); it++){
            AnsiString mn		= (*it)->CycleName(u16(bp->Tag));
            TRect R 			= TRect((*it)->PLeft(), 1, (*it)->PRight()-1, 15);
            if (!mn.IsEmpty()){
                canvas->Brush->Color= (*it==sel_clip)?(drag_obj==bp->Tag?BP_ACTIVE_DRAG_COLOR:BP_ACTIVE_COLOR):BP_INACTIVE_COLOR;
                canvas->Rectangle	(R);
                R.Top				+= 1;
                R.Bottom			-= 1;
                R.Left				+= 1;
                R.Right				-= 1;
                canvas->TextRect	(R,R.Left,R.Top,mn);
	            mn_prev				= mn;
            }else if (!mn_prev.IsEmpty()){
	            canvas->MoveTo		((*it)->PLeft()+1,13);
                canvas->LineTo		(R.Right,13);
                canvas->LineTo		(R.Width()>5?R.Right-5:R.Right-R.Width(),8);
                R.Top				+= 1;
                R.Bottom			-= 1;
                R.Left				+= 1;
                R.Right				-= 1;
            }
        }
    }
}
Ejemplo n.º 9
0
/*-----------------------------------------------------------------*/
void __fastcall TFixeinzugForm::_DrawCursor(TColor _col)
{
    TCanvas* pCanvas = pbFixeinzug->Canvas;
    pCanvas->Pen->Color = _col;
    int x, y;
    if (frm->righttoleft) x = (maxx-1-cx)*dx;
    else x = cx*dx;
    if (frm->toptobottom) y = cy*dy;
    else y = (maxy-1-cy)*dy;
    pCanvas->MoveTo (x, y);
    pCanvas->LineTo (x+dx, y);
    pCanvas->LineTo (x+dx, y+dy);
    pCanvas->LineTo (x, y+dy);
    pCanvas->LineTo (x, y);
}
Ejemplo n.º 10
0
//---------------------------------------------------------------------------
void __fastcall TRxViewDlg::DrawLevel(void)
{
	if( m_pRxSet == NULL ) return;
	if( !m_pBitmapLevel ) return;

    TCanvas *pCanvas = m_pBitmapLevel->Canvas;
    TRect rc;
    rc.Left = 0; rc.Top = 0;
    rc.Right = m_levelXW; rc.Bottom = m_levelYW;
    pCanvas->Brush->Color = clBlack;
    pCanvas->Pen->Color = clBlack;
    pCanvas->FillRect(rc);

//	pCanvas->Pen->Color = clYellow;
	int d = m_pRxSet->m_StgFFT.Sig - 500;
	if( m_pRxSet->IsMFSK() && sys.m_MFSK_SQ_Metric ){
		d = m_pRxSet->m_pDem->GetMFSKMetric(0);
	}
   	if( d > LEVELMAX ) d = LEVELMAX;

	if( m_pRxSet->m_pDem->m_AGC.GetOver() && !MainVARI->m_TX ){
		pCanvas->Brush->Color = clRed;
    }
	else if( !m_pRxSet->m_pDem->m_Lock ){
		pCanvas->Brush->Color = m_pRxSet->m_SQ ? clBlue : clGray;
    }
    else {
		pCanvas->Brush->Color = m_pRxSet->m_SQ ? TColor(RGB(0,255,0)) : clGray;
    }
  	rc.Right = (d * m_levelXW / LEVELMAX);
   	pCanvas->FillRect(rc);
    pCanvas->Pen->Color = m_pRxSet->m_SQ ? clBlack : clWhite;
	d = (m_pRxSet->m_SQLevel * m_levelXW / LEVELMAX);
	pCanvas->MoveTo(d, 0); pCanvas->LineTo(d, m_levelYW);
}
Ejemplo n.º 11
0
void __fastcall TfrmBaseConverter::ctlSplitterPaint(TObject *Sender)
{
    TCanvas *oCanvas;
    TRect   oGrabber;

    oCanvas  = this->ctlSplitter->Canvas;
    oGrabber = oCanvas->ClipRect;

    //---------------------------------------------------------------------------
    // Background
    oCanvas->Pen->Color   = (TColor)DEFAULT_SPLITTER_BORDER_COLOR;
    oCanvas->Brush->Color = (TColor)DEFAULT_SPLITTER_BACK_COLOR;
    oCanvas->RoundRect(oGrabber.Left, oGrabber.Top, oGrabber.Right, oGrabber.Bottom, 2, 2);

    // Middle grabber
    oGrabber         = oCanvas->ClipRect;
    oGrabber.Right  -= 1;
    oGrabber.Top     = (int)(oCanvas->ClipRect.Height() / 2.5);
    oGrabber.Bottom  = oGrabber.Bottom - oGrabber.Top;

    oCanvas->Pen->Color = (TColor)DEFAULT_SPLITTER_BORDER_COLOR;

    for (int iItem = oGrabber.Top; iItem < oGrabber.Bottom;)
    {
        oCanvas->MoveTo(oGrabber.Left, iItem);
        oCanvas->LineTo(oGrabber.Right, iItem);

        iItem += 3;
    }

    return;
}
Ejemplo n.º 12
0
void __fastcall TTScope::PaintPosition(void)
{
	TCanvas *pCanvas = pBitmap->Canvas;

	TRect rc;
	rc.Top = 0;
	rc.Bottom = GAGEWIDTH;
	rc.Left = 0;
	rc.Right = pBitmap->Width;

	pCanvas->Brush->Color = clBlack;
	pCanvas->FillRect(rc);

	int xw = (m_XW * rc.Right) / pScope->m_ScopeSize;
	int x = (m_XOFF * rc.Right) / pScope->m_ScopeSize;
	int xc = (m_CursorX * rc.Right) / pScope->m_ScopeSize;
	pCanvas->Brush->Color = clGreen;
	rc.Left = x;
	rc.Right = x + xw;
	pCanvas->FillRect(rc);

	pCanvas->Pen->Color = clYellow;
	pCanvas->Pen->Style = psSolid;
	pCanvas->MoveTo(xc, rc.Top);
	pCanvas->LineTo(xc, rc.Bottom);

	pCanvas->Font->Color = clWhite;
	pCanvas->Font->Size = 8;
	char bf[32];
	sprintf(bf, "Gain:%.1lf", m_Gain);
	::SetBkMode(pCanvas->Handle, TRANSPARENT);
	pCanvas->TextOut(0, 0, bf);
}
Ejemplo n.º 13
0
void __fastcall TfrmBaseConverter::ctlSizeGripPaint(TObject *Sender)
{
    TCanvas *oCanvas;

    oCanvas = this->ctlSizeGrip->Canvas;
    oCanvas->Pen->Color = (TColor)this->Base->DarkenColor(this->pnlBottom->Color, 150);

    oCanvas->MoveTo(oCanvas->ClipRect.Right - 4,  oCanvas->ClipRect.Bottom - 2);
    oCanvas->LineTo(oCanvas->ClipRect.Right - 1,  oCanvas->ClipRect.Bottom - 2);
    oCanvas->MoveTo(oCanvas->ClipRect.Right - 8,  oCanvas->ClipRect.Bottom - 2);
    oCanvas->LineTo(oCanvas->ClipRect.Right - 1,  oCanvas->ClipRect.Bottom - 8);
    oCanvas->MoveTo(oCanvas->ClipRect.Right - 12, oCanvas->ClipRect.Bottom - 2);
    oCanvas->LineTo(oCanvas->ClipRect.Right - 1,  oCanvas->ClipRect.Bottom - 12);

    return;
}
Ejemplo n.º 14
0
void __fastcall TForm4::PaintBox6Paint(TObject *Sender)
{
        TCanvas *FormCanvas = ((TPaintBox*)Sender)->Canvas;
        int CenterX, CenterY;

        if (((TPanel *)((TPaintBox *)Sender)->Parent)->BevelOuter == bvLowered) FormCanvas->Pen->Width = 2; else FormCanvas->Pen->Width = 1;
        CenterX = 16;
        CenterY = 16;
        FormCanvas->MoveTo(CenterX + 7, CenterY + 4);
        FormCanvas->LineTo(CenterX - 7, CenterY + 4);
        FormCanvas->LineTo(CenterX - 13, CenterY + 12);
        //Рисование значка щероховатости над полкой
        FormCanvas->Pen->Width = 1;
        FormCanvas->MoveTo(CenterX - 5, CenterY - 5);
        FormCanvas->LineTo(CenterX, CenterY + 4);
        FormCanvas->LineTo(CenterX + 8, CenterY - 10);
}
Ejemplo n.º 15
0
void  TfrmSoundLib::OnAttenuationDraw(CanvasValue* sender, void* _canvas, const Irect& _rect)
{
	TCanvas* canvas 	= (TCanvas*)_canvas;
    const TRect& rect	= *((TRect*)&_rect);
//	canvas
    int w = rect.Width();
    int h = rect.Height();
    int x0= rect.left;
    int y0= rect.top;

    canvas->Brush->Color = clBlack;
    canvas->FillRect(rect);
    canvas->Pen->Color = TColor(0x00006600);
    canvas->MoveTo(x0,y0);
    for (int i=0; i<X_GRID+1; i++){
        canvas->LineTo(x0+i*w/X_GRID,y0+h);
        canvas->MoveTo(x0+(i+1)*w/X_GRID,y0+0);
    }
    canvas->MoveTo(x0+0,y0+0);
    for (int j=0; j<Y_GRID+1; j++){
        canvas->LineTo(x0+w,y0+j*h/Y_GRID);
        canvas->MoveTo(x0+0,y0+(j+1)*h/Y_GRID);
    }
    canvas->Pen->Color = clYellow;
    canvas->MoveTo(x0+0,y0+iFloor(float(h)-float(h)*0.01f)); // snd cull = 0.01f
    canvas->LineTo(x0+w,y0+iFloor(float(h)-float(h)*0.01f));

    ESoundThumbnail* thm	= m_THM_Current.back();
    float d_cost 			= thm->MaxDist()/w;
    AnsiString temp;
//    float v = m_D3D.range;
//    temp.sprintf("Range = %.2f",v); lbRange->Caption = temp;
    canvas->Pen->Color = clLime;
    for (int d=1; d<w; d++){
        float R = d*d_cost;
    	float b = thm->MinDist()/(psSoundRolloff*R);
//		float b = m_Brightness/(m_Attenuation0+m_Attenuation1*R+m_Attenuation2*R*R);
        float bb = h-(h*b);
        int y = iFloor(y0+bb); clamp(y,int(rect.Top),int(rect.Bottom));
        if (1==d)	canvas->MoveTo(x0+d,y);
        else		canvas->LineTo(x0+d,y);
    }
}
Ejemplo n.º 16
0
void __fastcall TClipMaker::gtClipPaint(TObject *Sender)
{
	TCanvas* canvas 	= gtClip->Canvas;
    canvas->Font->Name 	= "MS Sans Serif";
    canvas->Font->Style	= TFontStyles();
	canvas->Pen->Color 	= clBlack;
    canvas->Pen->Width	= 1;
    canvas->Pen->Style	= psSolid;  
	for (UIClipIt it=clips.begin(); it!=clips.end(); it++){
        canvas->MoveTo	((*it)->PLeft(), 0);
        canvas->LineTo	((*it)->PLeft(), 6);
		AnsiString s	= AnsiString().sprintf("%2.1f",(*it)->RunTime());
        float dx		= 2.f;
        float dy		= canvas->TextHeight(s);
        TRect R 		= TRect((*it)->PLeft()+1-dx, 20-dy, (*it)->PRight()-dx, 20);
        canvas->TextRect(R,R.Left,R.Top,s);
	}
    if (!clips.empty()){
    	CUIClip* C		= clips.back();
        canvas->MoveTo	(C->PRight()-1, 0);
        canvas->LineTo	(C->PRight()-1, 6);
		AnsiString s	= AnsiString().sprintf("%2.1f",m_TotalLength);
        float dx		= canvas->TextWidth(s);
        float dy		= canvas->TextHeight(s);
        TRect R 		= TRect(C->PRight()-dx, 20-dy, C->PRight(), 20);
        canvas->TextRect(R,R.Left,R.Top,s);
    }
/*    if (g_resizing){
    	canvas->Pen->Color = clGreen;
        canvas->MoveTo	(g_X_cur, 0);
        canvas->LineTo	(g_X_cur, gtClip->Width);
    }
*/
    if (m_RTFlags.is(flRT_Playing)){
        canvas->Pen->Color 	= clRed;
        canvas->MoveTo		(m_CurrentPlayTime*m_Zoom, 0);
        canvas->LineTo		(m_CurrentPlayTime*m_Zoom, gtClip->Width);
    }
}
Ejemplo n.º 17
0
void __fastcall TForm4::PaintBox4Paint(TObject *Sender)
{
        TCanvas *FormCanvas = ((TPaintBox*)Sender)->Canvas;
        int CenterX, CenterY;
        double deg;
	TSize stSize;

	stSize.cx = 0;
	if (ListBox1->ItemIndex < 0) ListBox1->ItemIndex = 0;
	//Пишет
        FormCanvas->Font->Name = "GOST type A";
	FormCanvas->Font->Size = 50;
	FormCanvas->Font->Style = TFontStyles() << fsItalic;
	FormCanvas->TextOut(70, 30, ListBox1->Items->operator [](ListBox1->ItemIndex));

        //Рисует
        //deg = 60*M_PI/180;
        FormCanvas->Pen->Width = 3;
        FormCanvas->MoveTo(20, 50);
	FormCanvas->LineTo(45, 96);
	FormCanvas->LineTo(80, 23);
	//Дополнительная верхняя линия которая зависит от размера текста
	stSize = FormCanvas->TextExtent(ListBox1->Items->operator [](ListBox1->ItemIndex));
	if ( ListBox1->Items->operator [](ListBox1->ItemIndex).Length())
	{
		FormCanvas->LineTo(90 + stSize.cx, 23);
        }
        //Дополнительные значки зависящие от панелей
        if (Panel2->BevelOuter == bvLowered)
        {
                FormCanvas->MoveTo(20, 50);
                FormCanvas->LineTo(67, 50);
        }
        if (Panel3->BevelOuter == bvLowered)
        {
                FormCanvas->Ellipse(30, 48, 60, 78);
        }
        //Полка
        if ((Panel5->BevelOuter == bvLowered) || (Panel6->BevelOuter == bvLowered))
        {
                FormCanvas->MoveTo(80 + stSize.cx, 96);
                FormCanvas->LineTo(30, 96);
                FormCanvas->LineTo(5, 130);
        }
        if (Panel6->BevelOuter == bvLowered)
        {
                FormCanvas->MoveTo(5, 130);
                FormCanvas->LineTo(13, 110);
                FormCanvas->MoveTo(5, 130);
                FormCanvas->LineTo(22, 116);
        }
        //По контуру
        if (Panel7->BevelOuter == bvLowered)
        {
                FormCanvas->MoveTo(80, 23);
                FormCanvas->Brush->Style = bsClear;
                FormCanvas->Ellipse(80-15, 23 - 15, 80+15, 23+15);
        }
}
Ejemplo n.º 18
0
//===========================================================================
void TSumator::DrawElementFace()
{
      TCanvas    *dbCanvas = VisualElementParam->Bitmap->Canvas;
      int         aw       = VisualElementParam->Width;
      int         ah       = VisualElementParam->Height;
  // --------
      int x1 = 0.35 * aw;
      int y1 = 0.32 * ah;
      int x2 = 0.35 * aw;
      int y2 = 0.50  * ah;
      int x3 = x2 + (aw - x2 - x1) / 2;
  // --------
      dbCanvas->Brush->Color = clWhite;
      dbCanvas->Pen  ->Color = clBlack;
  // --------
      dbCanvas->Rectangle(0, 0, aw, ah);
   // --------- Отрисовка прямоугольника --- (прямокгольник процесса разработки) -----
     if (DesignPhase != dpAllreadyTesting) {
         if (DesignPhase == dpNotTesting  ) {dbCanvas->Pen  ->Color = clRed;}
         if (DesignPhase == dpNeedModified) {dbCanvas->Pen  ->Color = clRed; dbCanvas->Pen  ->Style = psDot;}

         dbCanvas->Rectangle(2, 2, VisualElementParam->Width - 2, VisualElementParam->Height - 2);

         dbCanvas->Pen->Color = clBlack;
         dbCanvas->Pen->Style = psSolid;
      }   
  // --------
      dbCanvas->Pen->Width = 1;
      dbCanvas->MoveTo(aw - x1,      1.1*y1);
      dbCanvas->LineTo(aw - x1,          y1);
      dbCanvas->LineTo(x2     ,          y1);
      dbCanvas->LineTo(x3     ,          y2);
      dbCanvas->LineTo(x2     , ah -     y1);
      dbCanvas->LineTo(aw - x1, ah -     y1);
      dbCanvas->LineTo(aw - x1, ah - 1.1*y1);
      dbCanvas->Pen->Width = 1;
}
Ejemplo n.º 19
0
void TForm1::RedrawBitmap(){
    if(!bmp) return;
    TCanvas *pCanvas = bmp->Canvas;
    int width=lblPic->Width, height=lblPic->Height;
    if(width != bmp->Width) bmp->Width = width;
    if(height != bmp->Height) bmp->Height = height;

    //clear the bitmap first
    pCanvas->Brush->Color = (TColor)0xFFFFFF;
    pCanvas->Brush->Style = bsSolid;
    pCanvas->FillRect(TRect(0, 0, width-1, height-1));
    
    if(theBuffer){

        //calculate number of text rows & columns
        textCols = (lblPic->Width / charWidth);
        textRows = (lblPic->Height / charHeight);
        pCanvas->Pen->Color = clBlack;
        pCanvas->Font->Color = clBlack;

        if(textCols && textRows){
            //draw text
            char* textLine = new char[textCols+1];
            int pos=textPosition, x=lblPic->Left, y=lblPic->Top;
            for(int j=0; j<textRows; j++){
                if(pos >= bufSize) break;
                memcpy(textLine, &theBuffer[pos], pos+textCols < bufSize ? textCols : bufSize - pos);
                textLine[pos+textCols < bufSize ? textCols : bufSize - pos] = 0;
                pos += textCols;
                pCanvas->TextOut(x, y, String(textLine));
                y += charHeight;
            }

            delete [] textLine;

            if(lstResults->Selected){

                MyResult *r = (MyResult*)lstResults->Selected->Data;
                for(int i=0; i<r->numWords; i++){

                    pCanvas->Pen->Color = myColors[i];
                    pCanvas->Pen->Width = 3;
                    pCanvas->Pen->Mode = pmNotXor;
                    int lx, ly;
                    bool lineStarted=false;

                    for(unsigned int j=0; j<r->words[i].length; j++){
                        int localPosition = r->words[i].start - textPosition;
                        localPosition += (j*r->words[i].delta);
                        lx = (localPosition % textCols)*charWidth + (charWidth/2);
                        ly = (localPosition / textCols)*charHeight + (charHeight/2);
                        if((lx<0) || (ly<0)) continue;
                        if((lx>width) || (ly>height)) continue;

                        if(!lineStarted){
                            pCanvas->MoveTo(lx, ly);
                            lineStarted = true;
                        }else{
                            pCanvas->LineTo(lx, ly);
                        }
                    }

                    pCanvas->Brush->Color = myColors[i];
                    pCanvas->Pen->Color = clWhite;
                    pCanvas->Pen->Width = 1;
                    pCanvas->Pen->Mode = pmCopy;
                    pCanvas->Font->Color = clWhite;

                    for(unsigned int j=0; j<r->words[i].length; j++){
                        int localPosition = r->words[i].start - textPosition;
                        localPosition += (j*r->words[i].delta);
                        lx = (localPosition % textCols)*charWidth;
                        ly = (localPosition / textCols)*charHeight;
                        if((lx<0) || (ly<0)) continue;
                        if((lx>width) || (ly>height)) continue;

                        pCanvas->TextOut(lx, ly, String(theBuffer[r->words[i].start+(j*r->words[i].delta)]));
                    }
                }
            }
        }
    }
    
    FormPaint(NULL);
}
Ejemplo n.º 20
0
void TRecta::graphic(TImage *i, double cx, double cy, double z)
{
    double maxx, minx, maxy, miny;
    double gx, gy, x, y;
    TCanvas *c = i->Canvas;
    int W, H;
    W = i->Picture->Bitmap->Width;
    H = i->Picture->Bitmap->Height;
    maxx = (double)(W-cx)/z;
    minx = (double)(-cx)/z;
    maxy = (double)(cy)/z;
    miny = (double)(cy-H)/z;
    i->Canvas->Pen->Assign(style);
    //Obtener x para la izq de la pantalla
    x = -1.0*(double)cx/(double)z;
    y = k*(x-x0)+y0;
    if(miny <= y && y <= maxy) // A
    {
        c->MoveTo(cx + x*z, cy - y*z);
        //Obtener x para la der de la pantalla
        x = (double)(W-cx)/(double)z;
        y = k*(x-x0)+y0;
        if(miny <= y && y <= maxy) // B
        {
            c->LineTo(cx + x*z, cy - y*z);
        }
        else
        {
            y = 1.0*cy/z;
            x = (y-y0)/k+x0;
            if(minx <= x && x <= maxx) // C
            {
                c->LineTo(cx + x*z, cy - y*z);
            }
            else //B
            {
                x = (double)(W-cx)/(double)z;
                y = k*(x-x0)+y0;
                c->LineTo(cx + x*z, cy - y*z);
            }
        }
    }
    else // B o C o D
    {
        y = 1.0*cy/z;
        x = (y-y0)/k+x0;
        if(minx <= x && x <= maxx) // C
        {
            c->MoveTo(cx + x*z, cy - y*z);
            y = 1.0*(cy-H)/z;
            x = (y-y0)/k+x0;
            if(minx <= x && x <= maxx) // D
            {
                c->LineTo(cx + x*z, cy - y*z);
            }
            else //B
            {
                x = (double)(W-cx)/(double)z;
                y = k*(x-x0)+y0;
                c->LineTo(cx + x*z, cy - y*z);
            }
        }
        else
        {   // B o D
            y = 1.0*(cy-H)/z;
            x = (y-y0)/k+x0;
            if(minx <= x && x <= maxx) // D
            {
                c->MoveTo(cx + x*z, cy - y*z);
                x = (double)(W-cx)/(double)z;
                y = k*(x-x0)+y0;
                c->LineTo(cx + x*z, cy - y*z);
            }
            else //B
            {   //ERROR
                /*
                x = (double)(W-cx)/(double)z;
                   y = k*(x-x0)+y0;
                   c->LineTo(cx + x*z, cy - y*z);
                   */
            }
        }
    }

    if(vdirector)
    {
        c->MoveTo(cx, cy);
        double m = sqrt(a1*a1 + a2*a2);
        c->LineTo(cx + a1/m*z, cy - a2/m*z);
    }
    if(vnormal)
    {
        c->MoveTo(cx, cy);
        double m = sqrt(A*A + B*B);
        c->LineTo(cx + A/m*z, cy - B/m*z);
    }
}
Ejemplo n.º 21
0
void TExtendedButton::DrawControl(void)
{
    EDrawingMode iDrawingMode;
    TCanvas      *oCanvas;
    long         lStartColor;
    long         lEndColor;
    long         lBorderColor;
    short        iTextDeviation;
    RECT		 oArea;

    this->FDrawingBuffer->Width  = this->Width;
    this->FDrawingBuffer->Height = this->Height;
    oCanvas = this->FDrawingBuffer->Canvas;
    oCanvas->Font = this->Font;

    //---------------------------------------------------------------------------
    // Find the drawing mode
    iDrawingMode = DM_NORMAL;

    if (::GetAsyncKeyState(VK_LBUTTON) == 0)
    {
        if (PtInRect(this->Canvas->ClipRect, this->ScreenToClient(Mouse->CursorPos)) == true)
            iDrawingMode = DM_HOT;
    }
    else
    {
        if (PtInRect(this->Canvas->ClipRect, this->ScreenToClient(Mouse->CursorPos)) == false)
        {
            if (this->FFocused == true)
                iDrawingMode = DM_HOT;
        }
        else
            iDrawingMode = DM_DOWN;
    }
    //---------------------------------------------------------------------------

    //---------------------------------------------------------------------------
    // Define which colors to use for painting
    switch (iDrawingMode)
    {
        case DM_NORMAL:
            lStartColor    = this->StartColor;
            lEndColor      = this->EndColor;
            lBorderColor   = this->BorderColor;
            iTextDeviation = 0;
            oCanvas->Font->Color = Graphics::clBlack;
            break;

        case DM_DOWN:
            lStartColor    = this->FBase->DarkenColor(this->EndColor, 20);
            lEndColor      = this->FBase->DarkenColor(this->StartColor, 20);
            lBorderColor   = this->FBase->DarkenColor(this->BorderColor, 50);
            iTextDeviation = 1;
            oCanvas->Font->Color = Graphics::clBlack;
            break;

        case DM_HOT:
            lStartColor    = this->FBase->LightenColor(this->StartColor, 100);
            lEndColor      = this->FBase->LightenColor(this->EndColor, 100);
            lBorderColor   = this->FBase->LightenColor(this->BorderColor, 100);
            iTextDeviation = 0;
            oCanvas->Font->Color = Graphics::clGray;
            break;

        default:
            lStartColor    = this->StartColor;
            lEndColor      = this->EndColor;
            lBorderColor   = this->BorderColor;
            iTextDeviation = 0;
            break;
    }
    //---------------------------------------------------------------------------

    //---------------------------------------------------------------------------
    // Perform the actual drawing
    this->FBase->FillGradient(oCanvas->Handle, oCanvas->ClipRect, lStartColor, lEndColor, comn::OT_DIAGONAL);
    oCanvas->Pen->Color   = (TColor)lBorderColor;
    oCanvas->Brush->Style = Graphics::bsClear;
    oCanvas->RoundRect(oCanvas->ClipRect.Left, oCanvas->ClipRect.Top, oCanvas->ClipRect.Right, oCanvas->ClipRect.Bottom, 6, 6);
    //---------------------------------------------------------------------------

    //---------------------------------------------------------------------------
    // Draw the image if required
    if (this->ImageID != comn::BI_NONE && this->DrawImage == true)
    {
        oArea.left   = 2;
        oArea.top    = 2;
        oArea.right  = this->Width - 2;
        oArea.bottom = this->Height - 2;

        if (iDrawingMode == DM_DOWN)
        {
            oArea.left++;
            oArea.top++;
            oArea.right++;
            oArea.bottom++;
        }

        this->FBase->DrawBitmap(oCanvas->Handle, oArea, this->ImageID, true);
    }
    //---------------------------------------------------------------------------

    //---------------------------------------------------------------------------
    // Draw a closing cross if required
    if (this->DrawCross == true)
    {
        oCanvas->Brush->Style = Graphics::bsSolid;
        oCanvas->Pen->Color   = (TColor)lBorderColor;
        oCanvas->Pen->Width   = 1;

        oCanvas->MoveTo(oCanvas->ClipRect.Left + 1,  oCanvas->ClipRect.Top + 1);
        oCanvas->LineTo(oCanvas->ClipRect.Right - 1, oCanvas->ClipRect.Bottom - 1);
        oCanvas->MoveTo(oCanvas->ClipRect.Right - 2, oCanvas->ClipRect.Top + 1);
        oCanvas->LineTo(oCanvas->ClipRect.Left, oCanvas->ClipRect.Bottom - 1);
    }
    //---------------------------------------------------------------------------

    //---------------------------------------------------------------------------
    // Draw the caption
	::DrawText(oCanvas->Handle, AnsiString(this->Caption).c_str(), this->Caption.Length(), &oArea, DT_CALCRECT);

    oArea.left   = 0 + iTextDeviation;
    oArea.top    = 0 + iTextDeviation;
    oArea.right  = oCanvas->ClipRect.Width() + iTextDeviation;
    oArea.bottom = oCanvas->ClipRect.Height() + iTextDeviation;

    ::SetBkMode(oCanvas->Handle, TRANSPARENT);
	::DrawText(oCanvas->Handle, AnsiString(this->Caption).c_str(), this->Caption.Length(), &oArea, DT_CENTER|DT_VCENTER|DT_SINGLELINE|DT_END_ELLIPSIS);
    //---------------------------------------------------------------------------

    //---------------------------------------------------------------------------
    // Output the drawing into screen
    this->FPaintBox->Canvas->Draw(0, 0, this->FDrawingBuffer);
    //---------------------------------------------------------------------------

    return;
}
Ejemplo n.º 22
0
/*-----------------------------------------------------------------*/
void __fastcall TOverviewForm::SBPrintClick(TObject *Sender)
{
    // Ausdrucken der Geschichte...
    TCursor savecursor = Cursor;
    Cursor = crHourGlass;

    Printer()->Title = (String)APP_TITLE+" - "+ExtractFileName(frm->filename);
    Printer()->BeginDoc();

    CalcPrintDimensions();

    int mx = min(maxi, frm->kette.count());
    int my = min(maxj, frm->schuesse.count());

    TCanvas* canvas = Printer()->Canvas;

    if (frm->GewebeNormal->Checked) {
        for (int i=frm->kette.a; i<frm->kette.a+mx; i++)
            for (int j=frm->schuesse.a; j<frm->schuesse.a+my; j++) {
                int x;
                if (frm->righttoleft) x = (mx+1)*gw - (i-frm->kette.a+1)*gw;
                else x = (i-frm->kette.a)*gw;
                int y = (my+1)*gh - (j-frm->schuesse.a+1)*gh;
                if (frm->gewebe.feld.Get(i, j)>0) {
                    canvas->Brush->Style = bsSolid;
                    canvas->Pen->Color = GetRangeColor(frm->gewebe.feld.Get(i, j));
                    canvas->Brush->Color = GetRangeColor(frm->gewebe.feld.Get(i, j));
                    canvas->Rectangle (mleft+x, mtop+y, mleft+x+gw, mtop+y+gh);
                }
                if (grid) {
                    canvas->Pen->Color = clBlack;
                    canvas->MoveTo (mleft+x, mtop+y);
                    canvas->LineTo (mleft+x, mtop+y+gh);
                    canvas->LineTo (mleft+x+gw, mtop+y+gh);
                    canvas->LineTo (mleft+x+gw, mtop+y);
                    canvas->LineTo (mleft+x, mtop+y);
                }
            }
    } else if (frm->GewebeFarbeffekt->Checked || frm->GewebeSimulation->Checked) {
        // Nach Farben getrennt malen, schneller...
        for (int i=frm->kette.a; i<frm->kette.a+mx; i++)
            for (int j=frm->schuesse.a; j<frm->schuesse.a+my; j++) {
                bool drawhebung = frm->gewebe.feld.Get(i,j)>0;
                if (frm->sinkingshed) drawhebung = !drawhebung;
                canvas->Brush->Style = bsSolid;
                if (drawhebung) {
                    canvas->Brush->Color = GETPALCOL(frm->kettfarben.feld.Get(i));
                    canvas->Pen->Color = GETPALCOL(frm->kettfarben.feld.Get(i));
                } else {
                    canvas->Brush->Color = GETPALCOL(frm->schussfarben.feld.Get(j));
                    canvas->Pen->Color = GETPALCOL(frm->schussfarben.feld.Get(j));
                }
                int x;
                if (frm->righttoleft) x = pwidth - (i-frm->kette.a+1)*gw;
                else x = (i-frm->kette.a)*gw;
                int y = (my+1)*gh - (j-frm->schuesse.a+1)*gh;
                canvas->Rectangle (mleft+x, mtop+y, mleft+x+gw, mtop+y+gh);
                if (grid) {
                    canvas->Pen->Color = clBlack;
                    canvas->MoveTo (mleft+x, mtop+y);
                    canvas->LineTo (mleft+x, mtop+y+gh);
                    canvas->LineTo (mleft+x+gw, mtop+y+gh);
                    canvas->LineTo (mleft+x+gw, mtop+y);
                    canvas->LineTo (mleft+x, mtop+y);
                }
            }
    }

    Printer()->EndDoc();
    Cursor = savecursor;
    ::MessageBeep (-1);
}
Ejemplo n.º 23
0
//---------------------------------------------------------------------------
void __fastcall TCodeView::PBoxPaint(TObject *Sender)
{
	if( !m_pFont ) return;

	CWaitCursor w;
	Graphics::TBitmap *pBmp = new Graphics::TBitmap;
    pBmp->Width = PBox->Width;
    pBmp->Height = PBox->Height;
	TCanvas *pCanvas = pBmp->Canvas;
	BOOL eud = SBOut->Down;
	if( !m_Base && !eud ) memset(m_tPfx, 0, sizeof(m_tPfx));
	SetPBoxFont(pCanvas);
	if( !eud ) SetMBCP(m_pFont->Charset);
	int x, y, xx, yy, fw, fh;
    char bf[16];
	int c = 0;
	for( y = 0; y < 16; y++ ){
		for( x = 0; x < 16; x++ ){
			if( eud ){
				DrawChar(pCanvas, c, FALSE);
            }
            else {
				if( !m_Base && (_mbsbtype((const unsigned char *)&c, 0) == _MBC_LEAD) ){
					m_tPfx[c] = TRUE;
    	        	DrawCursor(pCanvas, c, FALSE);
        	    }
            	else {
					DrawChar(pCanvas, c, FALSE);
            	}
            }
           	c++;
        }
    }
	pCanvas->Font = Font;
    pCanvas->Pen->Color = clBlack;
	::SetBkMode(pCanvas->Handle, TRANSPARENT);
    for( y = 0; y < 16; y++ ){
		wsprintf(bf, "%X", y);
		fw = pCanvas->TextWidth(bf);
        fh = pCanvas->TextHeight(bf);
        xx = m_XW1 + y*m_XW + (m_XW-fw)/2;
        yy = (m_YW1-fh)/2;
        pCanvas->TextOut(xx, yy, bf);

		if( eud ){
			c = GetEUDC(y, 1) & 0xfff0;
            if( c ){
		        wsprintf(bf, "%04x", c);
            }
            else {
				bf[0] = 0;
            }
        }
		else if( m_Base ){
	        wsprintf(bf, "%04x", y*16 + m_Base);
        }
        else {
	        wsprintf(bf, "%02X", y*16);
        }
		fw = pCanvas->TextWidth(bf);
        fh = pCanvas->TextHeight(bf);
        xx = (m_XW1-fw)/2;
        yy = m_YW1 + y*m_YW + (m_YW-fh)/2;
        pCanvas->TextOut(xx, yy, bf);

		pCanvas->Pen->Width = y ? 1 : 2;
		pCanvas->MoveTo(0, m_YW1 + y*m_YW);
        pCanvas->LineTo(PBox->Width, m_YW1 + y*m_YW);
		pCanvas->MoveTo(m_XW1 + y*m_XW, 0);
        pCanvas->LineTo(m_XW1 + y*m_XW, PBox->Height);
    }
    PBox->Canvas->Draw(0, 0, pBmp);
    delete pBmp;
	m_pfxCount = 0;
    for( x = 0; x < 256; x++ ){
		if( m_tPfx[x] ){
			m_tPfxIdx[m_pfxCount] = x;
        	m_pfxCount++;
        }
    }
	if( m_pfxCount != UDMB->Max ) UDMB->Max = short(m_pfxCount - 1);
}
Ejemplo n.º 24
0
void __fastcall TBeadForm::PrintItAll()
{
    Printer()->BeginDoc();
    String title = APP_TITLE;
    title += " - " + ExtractFileName(savedialog->FileName);
    Printer()->Title = title;
    TCanvas* canvas = Printer()->Canvas;

    int sx = GetDeviceCaps(Printer()->Handle, LOGPIXELSX);
    int sy = GetDeviceCaps(Printer()->Handle, LOGPIXELSY);

    int gx = (15+zoomidx*5)*sx/254;
    int gy = (15+zoomidx*5)*sy/254;

    int draftleft, normalleft, simulationleft, reportleft;
    int reportcols;

    int m = MM2PRx(10);
    if (draft->Visible) {
        draftleft = m;
        m += MM2PRx(13) + field.Width()*gx + MM2PRx(7);
    }

    if (normal->Visible) {
        normalleft = m;
        m += MM2PRx(7) + (field.Width()+1)*gx;
    }

    if (simulation->Visible) {
        simulationleft = m;
        m += MM2PRx(7) + (field.Width()/2+1)*gx;
    }

    if (report->Visible) {
        reportleft = m;
        reportcols = (Printer()->PageWidth - m - 10) / (MM2PRx(5) + MM2PRx(8));
    }

    int h = Printer()->PageHeight - MM2PRy(10);

    ////////////////////////////////////////
    //
    //   Draft
    //
    ////////////////////////////////////////

    // Grid
    canvas->Pen->Color = clBlack;
    int left = draftleft+MM2PRx(13);
    if (left<0) left=0;
    int maxj = min(field.Height(), (h-MM2PRy(10))/gy);
    for (int i=0; i<field.Width()+1; i++) {
        canvas->MoveTo(left+i*gx, h-(maxj)*gy);
        canvas->LineTo(left+i*gx, h-1);
    }
    for (int j=0; j<=maxj; j++) {
        canvas->MoveTo(left, h-1-j*gy);
        canvas->LineTo(left+field.Width()*gx, h-1-j*gy);
    }

    // Daten
    for (int i=0; i<field.Width(); i++)
        for (int j=0; j<maxj; j++) {
            char c = field.Get (i, j);
            assert(c>=0 && c<=9);
            if (c>0) {
                canvas->Brush->Color = coltable[c];
                canvas->Pen->Color = canvas->Brush->Color;
                canvas->Rectangle (left+i*gx+1, h-(j+1)*gy,
                                    left+(i+1)*gx, h-1-j*gy);
            }
        }
    canvas->Brush->Color = clWhite;

    // Zehnermarkierungen
    canvas->Pen->Color = clBlack;
    for (int j=0; j<maxj; j++) {
        if ((j%10)==0) {
            canvas->MoveTo (draftleft, h - j*gy - 1);
            canvas->LineTo (left-MM2PRx(3), h - j*gy - 1);
            canvas->TextOutA (draftleft, h - j*gy + MM2PRy(1), IntToStr(j));
        }
    }

    // Rapportmarkierung
#if(0)
    if (rapport!=0) {
        canvas->Pen->Color = clRed;
        canvas->MoveTo (draftleft, h - (rapport)*gx - 1);
        canvas->LineTo (left-MM2PRx(3), h - (rapport)*gx - 1);
    }
#endif

    ////////////////////////////////////////
    //
    //   Korrigiert (normal)
    //
    ////////////////////////////////////////

    // Grid
    canvas->Pen->Color = clBlack;
    left = normalleft+gx/2;
    if (left<0) left=gx/2;
    maxj = min(field.Height(), (h-MM2PRy(10))/gy);
    for (int i=0; i<field.Width()+1; i++) {
        for (int jj=0; jj<maxj; jj+=2) {
            canvas->MoveTo(left+i*gx, h-(jj+1)*gy);
            canvas->LineTo(left+i*gx, h-jj*gy);
        }
    }
    for (int i=0; i<=field.Width()+1; i++) {
        for (int jj=1; jj<maxj; jj+=2) {
            canvas->MoveTo(left+i*gx-gx/2, h-(jj+1)*gy);
            canvas->LineTo(left+i*gx-gx/2, h-jj*gy);
        }
    }
    canvas->MoveTo(left, h-1);
    canvas->LineTo(left+field.Width()*gx+1, h-1);
    for (int jj=1; jj<=maxj; jj++) {
        canvas->MoveTo(left-gx/2, h-1-jj*gy);
        canvas->LineTo(left+field.Width()*gx+gx/2+1, h-1-jj*gy);
    }

    // Daten
    for (int i=0; i<field.Width(); i++)
        for (int jj=0; jj<maxj; jj++) {
            char c = field.Get (i, jj+scroll);
            assert(c>=0 && c<=9);
            if (c==0) continue;
            canvas->Brush->Color = coltable[c];
            canvas->Pen->Color = canvas->Brush->Color;
            int ii = i;
            int j1 = jj;
            CorrectCoordinates (ii, j1);
            if (j1%2==0) {
                canvas->Rectangle (left+ii*gx+1,
                                           h-(j1+1)*gy,
                                           left+(ii+1)*gx,
                                           h-1-j1*gy);
            } else {
                canvas->Rectangle (left-gx/2+ii*gx+1,
                                           h-(j1+1)*gy,
                                           left-gx/2+(ii+1)*gx,
                                           h-1-j1*gy);
            }
        }
    canvas->Brush->Color = clWhite;


    ////////////////////////////////////////
    //
    //   Simulation
    //
    ////////////////////////////////////////

    // Grid
    canvas->Pen->Color = clBlack;
    left = simulationleft+gx/2;
    if (left<0) left=gx/2;
    maxj = min(field.Height(), (h-MM2PRy(10))/gy);
    int w = field.Width()/2;
    for (int j=0; j<maxj; j+=2) {
        for (int i=0; i<w+1; i++) {
            canvas->MoveTo(left+i*gx, h-(j+1)*gy);
            canvas->LineTo(left+i*gx, h-j*gy);
        }
        if (j>0 || scroll>0) {
            canvas->MoveTo (left-gx/2, h-(j+1)*gy);
            canvas->LineTo (left-gx/2, h-j*gy);
        }
    }
    for (int j=1; j<maxj; j+=2) {
        for (int i=0; i<w+1; i++) {
            canvas->MoveTo(left+i*gx-gx/2, h-(j+1)*gy);
            canvas->LineTo(left+i*gx-gx/2, h-j*gy);
        }
        canvas->MoveTo(left+w*gx, h-(j+1)*gy);
        canvas->LineTo(left+w*gx, h-j*gy);
    }
    canvas->MoveTo(left, h-1);
    canvas->LineTo(left+w*gx+1, h-1);
    for (int j=1; j<=maxj; j++) {
        canvas->MoveTo(left-gx/2, h-1-j*gy);
        canvas->LineTo(left+w*gx+1, h-1-j*gy);
    }

    // Daten
    for (int i=0; i<field.Width(); i++)
        for (int j=0; j<maxj; j++) {
            char c = field.Get (i, j+scroll);
            assert(c>=0 && c<=9);
            if (c==0) continue;
            canvas->Brush->Color = coltable[c];
            canvas->Pen->Color = canvas->Brush->Color;
            int ii = i;
            int jj = j;
            CorrectCoordinates (ii, jj);
            if (ii>w && ii!=field.Width()) continue;
            if (jj%2==0) {
                if (ii==w) continue;
                canvas->Rectangle (left+ii*gx+1,
                                           h-(jj+1)*gy,
                                           left+(ii+1)*gx,
                                           h-1-jj*gy);
            } else {
                if (ii!=field.Width() && ii!=w) {
                    canvas->Rectangle (left-gx/2+ii*gx+1,
                                               h-(jj+1)*gy,
                                               left-gx/2+(ii+1)*gx,
                                               h-1-jj*gy);
                } else if (ii==w) {
                    canvas->Rectangle (left-gx/2+ii*gx+1,
                                               h-(jj+1)*gy,
                                               left-gx/2+ii*gx+gx/2,
                                               h-1-jj*gy);
                } else {
                    canvas->Rectangle (left-gx/2+1,
                                               h-(jj+2)*gy,
                                               left,
                                               h-1-(jj+1)*gy-1);
                }
            }
        }
    canvas->Brush->Color = clWhite;



    ////////////////////////////////////////
    //
    //   Auswertung
    //
    ////////////////////////////////////////

    int x1 = reportleft;
    int x2 = reportleft + MM2PRx(30);
    int y = MM2PRy(10);
    int dy = MM2PRy(5);
    int dx = MM2PRx(5);

    // Mustername
    canvas->Pen->Color = clBlack;
    canvas->TextOut (x1, y, LANG_STR("Pattern:", "Muster:"));
    canvas->TextOut (x2, y, ExtractFileName(savedialog->FileName));
    y += dy;
    // Umfang
    canvas->TextOut (x1, y, LANG_STR("Circumference:", "Umfang:"));
    canvas->TextOut (x2, y, IntToStr(field.Width()));
    y += dy;
    // Musterrapport
#if(0)
    canvas->TextOut (x1, y, LANG_STR("Repeat of pattern:", "Musterrapport:"));
    canvas->TextOut (x2, y, IntToStr(rapport) + LANG_STR(" turns", " Umgänge"));
    y += dy;
#endif
    // Farbrapport
    canvas->TextOut (x1, y, LANG_STR("Repeat of colors:", "Farbrapport:"));
    canvas->TextOut (x2, y, IntToStr(farbrapp) + LANG_STR(" beads", " Perlen"));
    y += dy;
    // Fädelliste...
    if (farbrapp>0) {
        int page = 1;
        int column = 0;
        canvas->TextOut (x1, y, LANG_STR("List of beads", "Fädelliste"));
        y += dy;
        int ystart = y;
        char col = field.Get(farbrapp-1);
        int  count = 1;
        for (signed int i=farbrapp-2; i>=0; i--) {
            if (field.Get(i)==col) {
                count++;
            } else {
                if (col!=0) {
                    canvas->Brush->Color = coltable[col];
                    canvas->Pen->Color = clWhite;
                } else {
                    canvas->Brush->Color = clWhite;
                    canvas->Pen->Color = clBlack;
                }
                canvas->Rectangle (x1, y, x1+dx-MM2PRx(1), y+dy-MM2PRy(1));
                canvas->Pen->Color = clBlack;
                canvas->Brush->Color = clWhite;
                canvas->TextOut (x1+dx+3, y, IntToStr(count));
                y += dy;
                col = field.Get(i);
                count = 1;
            }
            if (y>=Printer()->PageHeight-MM2PRy(10)) {
                x1 += dx + MM2PRx(8);
                y = ystart;
                column++;
                if (column>=reportcols) { // neue Seite und weiter...
                    Printer()->NewPage();
                    x1 = draftleft;
                    x2 = draftleft + MM2PRx(30);
                    y = MM2PRy(10);
                    reportcols = (Printer()->PageWidth - draftleft - 10) / (MM2PRx(5) + MM2PRx(8));
                    column = 0;
                    page++;
                    canvas->Pen->Color = clBlack;
                    canvas->TextOut (x1, y, String(LANG_STR("Pattern ", "Muster "))+ExtractFileName(savedialog->FileName) + " - " + LANG_STR("page ", "Seite ") + IntToStr(page));
                    y += dy;
                    ystart = y;
                }
            }
        }
        if (y<Printer()->PageHeight-MM2PRy(10)) {
            if (col!=0) {
                canvas->Brush->Color = coltable[col];
                canvas->Pen->Color = clWhite;
            } else {
                canvas->Brush->Color = clWhite;
                canvas->Pen->Color = clBlack;
            }
            canvas->Rectangle (x1, y, x1+dx-MM2PRx(1), y+dy-MM2PRy(1));
            canvas->Pen->Color = clBlack;
            canvas->Brush->Color = clWhite;
            canvas->TextOut (x1+dx+3, y, IntToStr(count));
        }
    }

g_exit:
    Printer()->EndDoc();
}
Ejemplo n.º 25
0
void TMainForm::UpdateGraph()
{
	if(!m_Animator)				return;
    TCanvas *canvas 			 = Image->Picture->Bitmap->Canvas;
    canvas->Brush->Color 		 = clWhite;
    canvas->FillRect 			 (TRect (0, 0, Image->Picture->Bitmap->Width, Image->Picture->Bitmap->Height));
    canvas->Pen->Color 			 = clBlack;
    canvas->MoveTo 				 (0, Image->Picture->Bitmap->Height / 2);
    canvas->LineTo               (Image->Picture->Bitmap->Width, Image->Picture->Bitmap->Height / 2);
    canvas->MoveTo               (0, 0);
    canvas->LineTo               (Image->Picture->Bitmap->Width, 0);
    canvas->MoveTo               (0, Image->Picture->Bitmap->Height - 1);
    canvas->LineTo               (Image->Picture->Bitmap->Width, Image->Picture->Bitmap->Height - 1);
    canvas->TextOutA             (0, Image->Picture->Bitmap->Height / 2 - 14, "0.0");
    canvas->TextOutA             (0, Image->Picture->Bitmap->Height - 14, "-1.0");
    canvas->TextOutA             (0, 2, "1.0");


    float alltime 				= m_Animator->GetLength ();
    string128 					buf;
    sprintf 					(buf, "Effect time : %.3f", alltime);
    StatusBar->Panels->Items[0]->Text = buf;
    if (alltime == 0.0f) 		return;
    
    float width 				= (float)Image->Picture->Bitmap->Width, height = (float)Image->Picture->Bitmap->Height * 0.5f;
    //draw marker
    int left 					= (int)(width / alltime * m_Marker);
    canvas->MoveTo 				(left, 0);
    canvas->Pen->Style 			= psDot;
    canvas->LineTo 				(left, Image->Picture->Bitmap->Height);
    canvas->Pen->Style 			= psSolid;

    SPPInfo						m_EffectorParams;
    ZeroMemory 					(&m_EffectorParams, sizeof (SPPInfo));

    float increment 			= alltime / (float)Image->Width;

    for (float t = 0.0f; t < alltime; t += increment)
    {
        m_Animator->Process 	(t, m_EffectorParams);
        int x 					= (int)(width / alltime * t);
        
        for(u32 idx =pp_base_color;idx<pp_last;++idx)
        {
            if(!m_ActiveShowForm->DrawChannel((_pp_params)idx))
                continue;
            
            switch (idx)
                   {
                   case pp_base_color:
                        canvas->Pixels[x][(int)(-m_EffectorParams.color_base.r * height + height)] = clRed;
                        canvas->Pixels[x][(int)(-m_EffectorParams.color_base.g * height + height)] = clGreen;
                        canvas->Pixels[x][(int)(-m_EffectorParams.color_base.b * height + height)] = clBlue;
                        break;
                   case pp_add_color:
                        canvas->Pixels[x][(int)(-m_EffectorParams.color_add.r * height + height)] = clRed;
                        canvas->Pixels[x][(int)(-m_EffectorParams.color_add.g * height + height)] = clGreen;
                        canvas->Pixels[x][(int)(-m_EffectorParams.color_add.b * height + height)] = clBlue;
                        break;
                   case pp_gray_color:
                        canvas->Pixels[x][(int)(-m_EffectorParams.color_gray.r * height + height)] = clRed;
                        canvas->Pixels[x][(int)(-m_EffectorParams.color_gray.g * height + height)] = clGreen;
                        canvas->Pixels[x][(int)(-m_EffectorParams.color_gray.b * height + height)] = clBlue;
                        break;
                   case pp_gray_value:
                        canvas->Pixels[x][(int)(-m_EffectorParams.blur * height + height)] = clBlack;
                        break;
                   case pp_blur:
                        canvas->Pixels[x][(int)(-m_EffectorParams.gray * height + height)] = clBlack;
                        break;
                   case pp_dual_h:
                        canvas->Pixels[x][(int)(-m_EffectorParams.duality.h * height + height)] = clRed;
                        break;
                   case pp_dual_v:
                        canvas->Pixels[x][(int)(-m_EffectorParams.duality.v * height + height)] = clGreen;
                        break;
                   case pp_noise_i:
                        canvas->Pixels[x][(int)(-m_EffectorParams.noise.intensity * height + height)] = clRed;
                        break;
                   case pp_noise_g:
                        canvas->Pixels[x][(int)(-m_EffectorParams.noise.grain * height + height)] = clGreen;
                        break;
                   case pp_noise_f:
                        canvas->Pixels[x][(int)(-m_EffectorParams.noise.fps * height + height)] = clBlue;
                        break;
                   }//switch
           	}//channel
    }//time
}
Ejemplo n.º 26
0
//---------------------------------------------------------------------------
void __fastcall TClockAdjDlg::DrawFFT(BOOL fClear)
{
	if( !m_pBitmapFFT ) return;

    TCanvas *pCanvas = m_pBitmapFFT->Canvas;
    TRect rc;
    rc.Left = 0; rc.Top = 0;
    rc.Right = m_fftXW; rc.Bottom = m_fftYW;
    pCanvas->Brush->Color = MainVARI->m_tFFTColset[0].c;
    pCanvas->Pen->Color = MainVARI->m_tFFTColset[0].c;
    pCanvas->FillRect(rc);

	pCanvas->Pen->Style = psDot;
    int xx, y;
    int fh = pCanvas->TextHeight("A");

	switch(MainVARI->m_FFTVType){
		case 0:
			pCanvas->Pen->Color = MainVARI->m_tFFTColset[3].c;
			for( y = 6; y <= 86; y += 20 ){
				xx = y * m_fftYW / 100;
    			pCanvas->MoveTo(0, xx); pCanvas->LineTo(m_fftXW, xx);
    		}
        	break;
        case 1:
			pCanvas->Pen->Color = MainVARI->m_tFFTColset[3].c;
			for( y = 6; y <= 66; y += 20 ){
				xx = y * m_fftYW / 60;
    			pCanvas->MoveTo(0, xx); pCanvas->LineTo(m_fftXW, xx);
    		}
        	break;
    }

#if 1
	pCanvas->Font->Height = -12;
	pCanvas->Font->Color = MainVARI->m_tFFTColset[2].c;
	pCanvas->Pen->Color = MainVARI->m_tFFTColset[3].c;
	MainVARI->DrawFreqScale(pCanvas, m_fftXW, m_fftYW, 0, 3000, fh, FALSE);
#else
	int A, L;
	A = 500; L = 500;
	f = 0;
    int f, fw;
	char bf[128];
	pCanvas->Font->Height = -12;
	pCanvas->Font->Color = MainVARI->m_tFFTColset[2].c;
	pCanvas->Pen->Color = MainVARI->m_tFFTColset[3].c;
    y = 0;
	for( ; f < 3000; f += A ){
	    xx = f * m_fftXW / 3000;
        if( xx >= m_fftXW ) break;
		if( !(f % 1000) || !(f % L) ){
			sprintf(bf, "%u", f);
            fw = pCanvas->TextWidth(bf)/2;
            if( (xx - fw) > 0 ) pCanvas->TextOut(xx - fw, y, bf);
//    		pCanvas->MoveTo(xx, y ? 0 : fh); pCanvas->LineTo(xx, y ? m_fftYW-fh : m_fftYW);
    		pCanvas->MoveTo(xx, fh); pCanvas->LineTo(xx, m_fftYW);
        }
        else {
    		pCanvas->MoveTo(xx, 0); pCanvas->LineTo(xx, m_fftYW);
        }
    }
#endif
	pCanvas->Pen->Color = clGreen;
	xx = (DEMSAMPFREQ*0.5) * m_fftXW / 3000;
   	pCanvas->MoveTo(xx, fh); pCanvas->LineTo(xx, m_fftYW);
	int rfo = m_ToneFreq;
	pCanvas->Pen->Style = psSolid;
	pCanvas->Pen->Color = MainVARI->m_tFFTColset[4].c;
	xx = 0.5 + rfo * m_fftXW / 3000;
   	pCanvas->MoveTo(xx, fh); pCanvas->LineTo(xx, m_fftYW);
	POINT pt[4];
	pt[0].x = xx; pt[0].y = fh;
    pt[1].x = xx - 3; pt[1].y = fh+3;
    pt[2].x = xx; pt[2].y = fh + 6;
    pt[3].x = xx + 3; pt[3].y = fh+3;
	pCanvas->Brush->Color = MainVARI->m_tFFTColset[4].c;
	pCanvas->Polygon(pt, 3);

    if( !fClear ){
		pCanvas->Pen->Style = psSolid;
		pCanvas->Pen->Color = MainVARI->m_tFFTColset[1].c;

		double k = double(PBoxFFT->Height)/double(MainVARI->PBoxFFT->Height);
		int *pFFT = MainVARI->m_fftout;
		int xo = 0;
    	int x, y;
		if( MainVARI->m_FFTVType == 1 ){
			int yo = m_fftYW * 40;
	    	for( x = 0; x < m_fftXW; x++ ){
				xx = xo + (x * m_FFTWindow / m_fftXW);
        	    y = pFFT[xx] * k;
				y = m_fftYW - ((y-yo)/60);
				if( x ){
	    		    pCanvas->LineTo(x, y);
            	}
            	else {
					pCanvas->MoveTo(x, y);
            	}
    		}
        }
        else {
	    	for( x = 0; x < m_fftXW; x++ ){
				xx = xo + (x * m_FFTWindow / m_fftXW);
        	    y = pFFT[xx] * k;
				y = m_fftYW - (y/100);
				if( x ){
	    		    pCanvas->LineTo(x, y);
            	}
            	else {
					pCanvas->MoveTo(x, y);
            	}
    		}
		}
    }
}