рисовал polyline- ом Image->Canvas - ничего не дрожало...
(«Телесистемы»: Конференция «Микроконтроллеры и их применение»)

миниатюрный аудио-видеорекордер mAVR

Отправлено xc164 24 февраля 2004 г. 08:37
В ответ на: Народ , подскажите пожалуйста , кто сталкивался с проблеммой высококачественного отображения осциолограммы из данных с USB шины в билдере. отправлено tolian 23 февраля 2004 г. 23:48


//---------------------------------------------------------------------------
/* отрисовка развертки на экране осциллографа */
int DrawScanning(float ydesired_speed, float yspeed, float yUm, float yIm, float yPWM, int cmd)
{static float aDesiredSpeed[MAX_POINT];
static float aSpeed[MAX_POINT];
static float aIm [MAX_POINT];
static float aUm [MAX_POINT];
static float aPWM[MAX_POINT];

static TPoint DesiredSpeed[MAX_POINT];
static TPoint Speed[MAX_POINT];
static TPoint Im [MAX_POINT];
static TPoint Um [MAX_POINT];
static TPoint PWM[MAX_POINT];
static int i,x;
// char str[32];
float k;
static float _ox=0, ox;
k= fabs((float)xscale /(((float)xs) * xstep));

switch(cmd)
{case 1:for(x=1; x < 2048; x++)
{aDesiredSpeed[x-1]= aSpeed[x-1]= aIm[x-1]= aUm[x-1]= aPWM[x-1]= 0.0;
DesiredSpeed[x-1].x= Speed[x-1].x= Im[x-1].x= Um[x-1].x= PWM[x-1].x= x;
}
npoint=0;
break;
case 4:_ox+=1;
for(ox=_ox - k;ox >= 0; ox-=k)
{if( npoint <= Form1->Image1->Width)
{aDesiredSpeed[npoint]=ydesired_speed;
aSpeed[npoint]= yspeed;
aIm[npoint]= yIm;
aUm[npoint]= yUm;
aPWM[npoint]= yPWM;
npoint++;
_ox=ox;
}
}
break;
case 0:_ox+=1;
for(ox=_ox - k; ox >= 0; ox-=k)
{//int tmp[MAX_POINT];
// memcpy( (char *)tmp, (char *)aDesiredSpeed + sizeof(int), sizeof(int)* Form1->Image1->Width);
// memcpy( (char *)aDesiredSpeed, (char *)tmp, sizeof(int)* Form1->Image1->Width);
// memcpy( (char *)tmp, (char *)aSpeed + sizeof(int), sizeof(int)* Form1->Image1->Width);
// memcpy( (char *)aSpeed, (char *)tmp, sizeof(int)* Form1->Image1->Width);
// memcpy( (char *)tmp, (char *)aIm + sizeof(int), sizeof(int)* Form1->Image1->Width);
// memcpy( (char *)aIm, (char *)tmp, sizeof(int)* Form1->Image1->Width);
// memcpy( (char *)tmp, (char *)aUm + sizeof(int), sizeof(int)* Form1->Image1->Width);
// memcpy( (char *)aUm, (char *)tmp, sizeof(int)* Form1->Image1->Width);
// memcpy( (char *)tmp, (char *)aPWM + sizeof(int), sizeof(int)* Form1->Image1->Width);
// memcpy( (char *)aPWM, (char *)tmp, sizeof(int)* Form1->Image1->Width);
for(x=0; x < Form1->Image1->Width; x++)
{aDesiredSpeed[x]= aDesiredSpeed[x+1];
aSpeed[x]= aSpeed[x+1];
aIm[x]= aIm[x+1];
aUm[x]= aUm[x+1];
aPWM[x]= aPWM[x+1];
}
aDesiredSpeed[Form1->Image1->Width]= ydesired_speed;
aSpeed[Form1->Image1->Width]= yspeed;
aIm[Form1->Image1->Width]= yIm;
aUm[Form1->Image1->Width]= yUm;
aPWM[Form1->Image1->Width]= yPWM;
npoint++;
_ox=ox;
}
break;
}
if( npoint > Form1->Image1->Width)
npoint= Form1->Image1->Width +1;
if(cmd==4) return npoint;
if((Form1->CheckBox2->Checked) && (tmp_file==NULL))
{Form1->Image1->Refresh();
return npoint;
}
if(cmd != 6 && cmd != 4) return npoint;

Form1->Image1->Canvas->Lock();
Form1->Image1->Canvas->Brush->Color = clWhite;
Form1->Image1->Canvas->Brush->Style = bsSolid;
Form1->Image1->Canvas->FillRect(Rect(0,0,Form1->Image1->Width,Form1->Image1->Height));
draw_grid();
if(Form1->CSpinEdit3->Value > 20) Form1->CSpinEdit3->Value=1;
Form1->Image1->Canvas->Pen->Width= Form1->CSpinEdit3->Value;
if(Form1->CheckBox3->Checked)
{Form1->Image1->Canvas->Pen->Color = desired_speed_color;
for(i=0; i<= Form1->Image1->Width; i++)
DesiredSpeed[i].y= Form1->Image1->Height/2 -(int)(aDesiredSpeed[i] * Fs_yscale * (float)ys);
Form1->Image1->Canvas->Polyline(DesiredSpeed,Form1->Image1->Width);
}
if(Form1->CheckBox4->Checked)
{Form1->Image1->Canvas->Pen->Color = speed_color;
for(i=0;i<= Form1->Image1->Width; i++)
Speed[i].y= Form1->Image1->Height/2 -(int)(aSpeed[i] * F_yscale * (float)ys);
Form1->Image1->Canvas->Polyline(Speed,Form1->Image1->Width);
}
if(Form1->CheckBox5->Checked)
{Form1->Image1->Canvas->Pen->Color = Im_color;
for(i=0;i<= Form1->Image1->Width; i++)
Im[i].y= Form1->Image1->Height/2 -(int)(aIm[i] * I_yscale * (float)ys);
Form1->Image1->Canvas->Polyline(Im,Form1->Image1->Width);
}
if(Form1->CheckBox6->Checked)
{Form1->Image1->Canvas->Pen->Color = Um_color;
for(i=0;i<= Form1->Image1->Width; i++)
Um[i].y= Form1->Image1->Height/2 -(int)(aUm[i] * U_yscale * (float)ys);
Form1->Image1->Canvas->Polyline(Um,Form1->Image1->Width);
}
if(Form1->CheckBox7->Checked)
{Form1->Image1->Canvas->Pen->Color = PWM_color;
for(i=0;i<= Form1->Image1->Width; i++)
PWM[i].y= Form1->Image1->Height/2 -(int)(aPWM[i] * PWM_yscale * (float)ys);
Form1->Image1->Canvas->Polyline(PWM,Form1->Image1->Width);
}
Form1->Image1->Canvas->Unlock();

draw_grid();
// Form1->Image1->Repaint();
// Form1->Image1->Update();
return npoint;
}


Составить ответ  |||  Конференция  |||  Архив

Ответы



Перейти к списку ответов  |||  Конференция  |||  Архив  |||  Главная страница  |||  Содержание  |||  Без кадра

E-mail: info@telesys.ru