C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[17866] Re:Re:Re:[질문] Rect 그릴때에 일반적인거 말고 그라데이션 효과주려면? (예전답변에 대한 질문입니다)
방태윤 [nabty] 1020 읽음    2002-04-23 13:36
빌더의 help->windows sdk 클릭하고
GetRValue를 검색하면 도움말이 나옵니다...
칼라값의 red,green,blue 값을 분리하는 함수입니다.


GetRValue

The GetRValue macro retrieves an intensity value for the red component of a 32-bit red, green, blue (RGB) value.

BYTE GetRValue(

    DWORD rgb    // 32-bit RGB value
   );   


Parameters

rgb

Specifies an RGB color value.



Return Values

The return value is the intensity of the red component of the specified RGB color.

Remarks

The intensity value is in the range 0 through 255.
The GetRValue macro is defined as follows:

#define GetRValue(rgb)   ((BYTE) (rgb)) 


See Also

GetBValue, GetGValue, PALETTEINDEX, PALETTERGB, RGB


*초보* 님이 쓰신 글 :
: 아래글에서 물음표 표시한곳에서
: 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);
: : }
: : <출처를알수없음>
: :
: : 박용우 님이 쓰신 글 :
: : : 그라데이션 효과 아시죠..
: : : 점점 진해진다든지 점점 밝아지는 그런 효과를 주려고하는데
: : : 어떻게 하시는지 아시는분
: : : 캔버스에 사각형을 그리고 싶어요 입체감있게 보이는.

+ -

관련 글 리스트
17859 Re:Re:[질문] Rect 그릴때에 일반적인거 말고 그라데이션 효과주려면? (예전답변에 대한 질문입니다) *초보* 968 2002/04/23
17866     Re:Re:Re:[질문] Rect 그릴때에 일반적인거 말고 그라데이션 효과주려면? (예전답변에 대한 질문입니다) 방태윤 1020 2002/04/23
17868         Re:Re:Re:Re: 답변 감사합니다....^^ (냉무) *초보* 665 2002/04/23
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.