|
혹시 Fram3D와 같은 API함수를 찾으시는지요?
저두 예전에 찾다가 못찾구 직접구했습니다.
이거 고수들 앞에서 올려두 될려나?? ㅋㅋㅋ
암턴 참조하세요.
불러와서 쓰는법.
Round3DEx(ACanvas, ARect, AColor1, AColor2, ARound, 2);
함수
void __fastcall TForm1::Round3DEx(TCanvas *Canvas, TRect &Rect, TColor TopColor, TColor BottomColor, int Round, int Width)
{
unsigned char ucRGB[3][3];
ucRGB[0][0] = GetRValue(TopColor); ucRGB[1][0] = GetRValue(BottomColor);
ucRGB[0][1] = GetGValue(TopColor); ucRGB[1][1] = GetGValue(BottomColor);
ucRGB[0][2] = GetBValue(TopColor); ucRGB[1][2] = GetBValue(BottomColor);
if(TopColor - BottomColor < 0)
{
ucRGB[2][0] = ucRGB[1][0] - ucRGB[0][0];
ucRGB[2][1] = ucRGB[1][1] - ucRGB[0][1];
ucRGB[2][2] = ucRGB[1][2] - ucRGB[0][2];
}
else
{
ucRGB[2][0] = ucRGB[0][0] - ucRGB[1][0];
ucRGB[2][1] = ucRGB[0][1] - ucRGB[1][1];
ucRGB[2][2] = ucRGB[0][2] - ucRGB[1][2];
}
Canvas->Pen->Width = Width;
Canvas->Pen->Color = TopColor;
Canvas->MoveTo(Rect.left, Rect.bottom - Round);
Canvas->LineTo(Rect.left, Rect.top + Round);
RoundDraw(Canvas, Rect, 180, 270, Round);
Canvas->LineTo(Rect.right - Round, Rect.top);
RoundDraw(Canvas, Rect, ucRGB[0], ucRGB[2], 270, 360, Round, (TopColor - BottomColor < 0));
Canvas->Pen->Color = BottomColor;
Canvas->LineTo(Rect.right -1, Rect.bottom - Round);
RoundDraw(Canvas, Rect, 0, 90, Round);
Canvas->LineTo(Rect.left + Round, Rect.bottom -1);
RoundDraw(Canvas, Rect, ucRGB[1], ucRGB[2], 90, 180, Round, (BottomColor - TopColor < 0));
Rect.top + Width;
Rect.left + Width;
Rect.right - Width;
Rect.bottom - Width;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::RoundDraw(TCanvas *Canvas, TRect &Rect, int StartPos, int EndPos, int Round)
{
double x, y;
double addx, addy;
switch(StartPos)
{
case 0:
addx = Rect.right -Round;
addy = Rect.bottom -Round;
break;
case 90:
addx = Rect.left +Round;
addy = Rect.bottom -Round;
break;
case 180:
addx = Rect.left +Round;
addy = Rect.top +Round;
break;
default:
addx = Rect.right -Round;
addy = Rect.top +Round;
break;
}
for(int i = StartPos +1; i < EndPos; i++)
{
x = cos(i *M_PI /180.0) *Round +addx;
y = sin(i *M_PI /180.0) *Round +addy;
Canvas->LineTo(x, y);
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::RoundDraw(TCanvas *Canvas, TRect &Rect, unsigned char* ucRGB, unsigned char* ucRGBD,
int StartPos, int EndPos, int Round, bool Direction)
{
double x, y;
double addx, addy;
switch(StartPos)
{
case 0:
addx = Rect.right -Round;
addy = Rect.bottom -Round;
break;
case 90:
addx = Rect.left +Round;
addy = Rect.bottom -Round;
break;
case 180:
addx = Rect.left +Round;
addy = Rect.top +Round;
break;
default:
addx = Rect.right -Round;
addy = Rect.top +Round;
break;
}
for(int i = StartPos +1; i < EndPos; i++)
{
x = cos(i *M_PI /180.0) *Round +addx;
y = sin(i *M_PI /180.0) *Round +addy;
Canvas->LineTo(x, y);
if(Direction)
{
Canvas->Pen->Color = (TColor)RGB(ucRGB[0] + MulDiv(i -StartPos, ucRGBD[0], 90),
ucRGB[1] + MulDiv(i -StartPos, ucRGBD[1], 90),
ucRGB[2] + MulDiv(i -StartPos, ucRGBD[2], 90));
}
else
{
Canvas->Pen->Color = (TColor)RGB(ucRGB[0] - MulDiv(i -StartPos, ucRGBD[0], 90),
ucRGB[1] - MulDiv(i -StartPos, ucRGBD[1], 90),
ucRGB[2] - MulDiv(i -StartPos, ucRGBD[2], 90));
}
}
}
//---------------------------------------------------------------------------
|