|
아래글에서 물음표 표시한곳에서
GetRValue(StartColor) 함수에 대한 내용이 없는데 어떻게
이용해야 되나요?
소스를 보면
Tcolor StartColor = clBlue;
int InitialRed = GetRValue(StartColor);
이렇게 되어 있는걸로 봐선.. color값을 받아서 int값으로 변경하는것 같은데..
제가 잘 몰라서....
아래 소스를 좀 변경해서 사용하려구 하는데...
GetRValue(StartColor)함수에 대한 내용이 없어서....
도움 바랍니다...
방태윤 님이 쓰신 글 :
: void __fastcall DrawClientWindow (HDC &Hdc)
: {
: // this routine paints a gradient background that slowly
: // changes from StartColor at the top to black at the bottom
: const int NumGradients = 64; // number of shading levels
: const TColor StartColor = clBlue; // initial color
:
: TRect rect ; // calculate size of backgnd
: ::GetClientRect (Form1->Handle, (RECT *) &rect) ;
:
: // painting a shaded gradient is slow, and can cause flickering
: // eliminate flicker by using memory bitmaps and BitBlit
: Graphics::TBitmap *MemBitmap = new Graphics::TBitmap;
: MemBitmap->Width = rect.Right - rect.Left;
: MemBitmap->Height= rect.Bottom- rect.Top;
: MemBitmap->Canvas->Brush->Style = bsSolid;
: MemBitmap->Canvas->Brush->Color = clBlack;
: MemBitmap->Canvas->FillRect(Rect(0,0,
: MemBitmap->Width,
: MemBitmap->Height));
: // calculate the height of each little gradient section
: int GradientHeight = MemBitmap->Height / NumGradients;
:
: // calculate individual RGB intensities of the starting color.
: int InitialRed = GetRValue(StartColor); ---------------------????
: int InitialGreen = GetGValue(StartColor); ---------------------????
: int InitialBlue = GetBValue(StartColor); ---------------------????
: int RedIncrement = (InitialRed + 1) / NumGradients; // calculate
: int GreenIncrement= (InitialGreen + 1)/ NumGradients; // increment of
: int BlueIncrement = (InitialBlue + 1) / NumGradients; // each gradient
:
: TColor FillColor;
: // the for loop draws each gradient section. the loop stops one pass
: // away from black because black was drawn by FillRect above
: for (int j=0;j< NumGradients;j++)
: {
: rect.Bottom = rect.Top + GradientHeight;
: FillColor = (TColor) RGB( InitialRed -(RedIncrement * j),
: InitialGreen -(GreenIncrement* j),
: InitialBlue -(BlueIncrement * j));
: MemBitmap->Canvas->Brush->Color = FillColor;
: MemBitmap->Canvas->FillRect(rect);
: rect.Top += GradientHeight;
: }
: // Use API BitBlt to copy pixels to the screen.
: ::BitBlt(Hdc,0,0,MemBitmap->Width, MemBitmap->Height,
: MemBitmap->Canvas->Handle,0,0,SRCCOPY);
: delete MemBitmap; // delete the temporary bitmap.
: }
: void __fastcall TForm1::Button1Click(TObject *Sender)
: {
: DrawClientWindow(Canvas->Handle);
: }
: <출처를알수없음>
:
: 박용우 님이 쓰신 글 :
: : 그라데이션 효과 아시죠..
: : 점점 진해진다든지 점점 밝아지는 그런 효과를 주려고하는데
: : 어떻게 하시는지 아시는분
: : 캔버스에 사각형을 그리고 싶어요 입체감있게 보이는.
|