Пример #1
0
void TGameWindow::Draw()
{
	TBegin2d begin2d;
	TRenderer * r = TRenderer::GetInstance();

	r->FillRect( TURect(0,0,800,600), TColor(0,0,0,0) );

	TTransformedLitVert verts[4];
	TVec2 corners[4]=
	{
		TVec2(0,0),
		TVec2(800,0),
		TVec2(800,600),
		TVec2(0,600)
	};
	while (mOffset>1)
	{
		mOffset--;
	}
	TVec2 uv[2]=
	{
		TVec2(0+mOffset,0+mOffset),
		TVec2(1+mOffset,1+mOffset),
	};

	CreateVertsFromRect( TVec2(0,0),verts,corners,uv,TMat3(),1,TColor(1,1,1,1) ) ;

	r->SetTexture(mBigTex);
	r->SetTextureMapMode( TRenderer::kMapWrap, TRenderer::kMapWrap );
	r->DrawVertices(TRenderer::kDrawTriFan, TVertexSet(verts,4) );

}
void TSensorView::GreyViewer(TDC& dc,PSHORTREAL pData)
{
  dc.SetWindowExt(TSize(m_nDimSize[0],m_nDimSize[1]));
  for (int y = 0; y < m_nDimSize[1]; y++)
  {
    int xStart = 0,
        x = 0;
    int clrLast,
        clrThis;
    while(x < m_nDimSize[0])
    {
      SHORTREAL r = pData[x + y * (LONGINT) m_nDimSize[0]];
      if (r > 1)
        r = 1;
      else if (r < 0)
        r = 0;
      clrThis = (int) (pow(r,m_dBright) * 255);
      if(!x)
        clrLast = clrThis;
      else if(clrThis != clrLast)
      {
        TBrush br(TColor(clrLast,clrLast,clrLast));
        TRect rect(xStart,y,x,y+1);
        dc.FillRect(rect,br);
        xStart = x;
        clrLast = clrThis;
      }
      x++;
    }
    TBrush br(TColor(clrLast,clrLast,clrLast));
    TRect rect(xStart,y,x,y+1);
    dc.FillRect(rect,br);
  }
  Grid2D(dc);
}
Пример #3
0
///////////////////////////////////////////////////////////////
// TLevelProgressDialog
// --------------------
//
void DrawIconicGauge(TDC &dc, int yPosition, int Width, int Height, int Value)
{
	TBrush BleueBrush(TColor(0,0,255));
	TPen BleuePen (TColor(0,0,255));
	// TBrush GrayBrush (TColor(200,200,200));
	TPen WhitePen (TColor(255,255,255));
	TPen GrayPen (TColor(100,100,100));
	// TPen GrayPen (TColor(0,0,0));

	// Draw upper left white border
	dc.SelectObject(GrayPen);
	dc.MoveTo(0, yPosition + Height - 1);
	dc.LineTo(0, yPosition);
	dc.LineTo(Width - 1, yPosition);

	// Draw lower right border
	dc.SelectObject(WhitePen);
	dc.LineTo(Width - 1, yPosition + Height - 1);
	dc.LineTo(0, yPosition + Height - 1);

	// Draw gauge
	dc.SelectObject(BleueBrush);
	dc.SelectObject(BleuePen);
	dc.Rectangle(1, yPosition + 1, (Width - 1) * Value / 100, yPosition + Height - 1);

	dc.RestoreObjects();
}
void __fastcall TOpenGLFootBall::FormCreate(TObject *Sender)
{
  // default button in toolbar: rotate field
  TeeCommander1->ButtonRotate->Down = true;

  // initialize constants
  W = 210;
  D = 100;
  Ball.x = -20;
  Ball.y = 20;
  for (int t=0; t<5; t++)
  {
    Players[t].x = random(200)-100;
    Players[t].y = random(100)-50;
    DeltaPlayers[t].x = 0;
    DeltaPlayers[t].y = 0;
  }
  DeltaBall.x = 2;
  DeltaBall.y = 3;
  DeltaZoom = 2;

  // colors

  FGreen = TColor(RGB(0x0,0x90,0x0));
  FLines = TColor(RGB(0xB0,0xB0,0xB0));
  FBall = TColor(RGB(0xB0,0xB0,0xB0));
}
Пример #5
0
void __fastcall TForm1::gridPaintPanel(TDBCtrlGrid *DBCtrlGrid, int Index)
{
    int x=DBCtrlGrid->Height; x/=DBCtrlGrid->RowCount;
    if (
        (DBCtrlGrid==grid && !table->FieldByName("send")->AsBoolean
         && !(table->FieldByName("date_next")->AsDateTime>cur.GFromDate())
         && !(table->FieldByName("date_next")->AsDateTime<TDate(1910,1,1))
        ) ||
        (DBCtrlGrid==grd_vac && !vact->FieldByName("send")->AsBoolean)
         && !(vact->FieldByName("date_next")->AsDateTime>cur.GFromDate())
         && !(vact->FieldByName("date_next")->AsDateTime<TDate(1910,1,1))
        )
    {
        DBCtrlGrid->Canvas->Brush->Color=TColor(0x2248ff);
        DBCtrlGrid->Canvas->FillRect(TRect(1,1,DBCtrlGrid->Width-2,x-2));
    }

    if (
        (DBCtrlGrid==grid && table->FieldByName("die")->AsBoolean) ||
        (DBCtrlGrid==grd_vac && vact->FieldByName("die")->AsBoolean)
        )
    {
        DBCtrlGrid->Canvas->Brush->Color=TColor(0xe90dee);
        DBCtrlGrid->Canvas->FillRect(TRect(1,1,DBCtrlGrid->Width-2,x-2));
    }

    if (DBCtrlGrid->PanelIndex!=Index) return;
    DBCtrlGrid->Canvas->Brush->Color=TColor(0xc97632);
    DBCtrlGrid->Canvas->FillRect(TRect(1,1,DBCtrlGrid->Width-2,x-2));
}
void __fastcall TfrmCheckBoxes::SetParameters(AnsiString ASelectValue, AnsiString AMultiSelectValue, bool ABlackAndWhite)
{
  TColor ARGBColors[3] = {clRed, clYellow, clLime};
  TColor ABlackAndWhiteColors[3] = {TColor(0x828282), TColor(0xF8F8F8), TColor(0xDCDCDC)};

  if (ABlackAndWhite)
    SetColors(ABlackAndWhiteColors, ASelectValue, AMultiSelectValue);
  else
    SetColors(ARGBColors, ASelectValue, AMultiSelectValue);
}
Пример #7
0
//---------------------------------------------------------------------------
TDrawing::TDrawing() :
    TList(),
    m_nTool(0),
    m_TmpItem(NULL),
    m_nDragMode(0),
    m_nDragIndex(0),
    m_bDrawRequest(true),
    m_bModified(false),
    m_nPenColor(TColor(0x7fffffff)),
    m_nBrushColor(TColor(-1))
{
}
Пример #8
0
//---------------------------------------------------------------------------
TDrawingItem::TDrawingItem() :
    TList(),
    m_nType(0),
    m_bSelected(false),
    m_bExist(false),
    m_nPenColor(TColor(0x7fffffff)),
    m_nBrushColor(TColor(-1))
{
    m_Rect[0] = 0.0f;
    m_Rect[1] = 0.0f;
    m_Rect[2] = 0.0f;
    m_Rect[3] = 0.0f;
}
Пример #9
0
void __fastcall TZoom::MostraCores(int Azul, int Verde, int Vermelho)
{
  TCanvas *Canvas=BitCores->Canvas;
  Canvas->Brush->Color=clBlack;
  Canvas->FillRect(Rect(0, 0, 1000, 1000));
  Canvas->Brush->Color=TColor(0xFF0000);
  Canvas->FillRect(Rect(0, 0, Azul, 9));
  Canvas->Brush->Color=TColor(0xFF00);
  Canvas->FillRect(Rect(0, 10, Verde, 19));
  Canvas->Brush->Color=TColor(0xFF);
  Canvas->FillRect(Rect(0, 20, Vermelho, 29));
  imCores->Repaint();
}
Пример #10
0
void BVIRayTracerApplication::CreateScene07()
{
    ClearScene();
    Material::shared_ptr m_Material01(new StandardMaterial(1.0, 0.5, COLOUR_GREEN));
    Material::shared_ptr m_Material_Scatter(new ScatterBoardMaterial(1.0, 0.5, COLOUR_RED, COLOUR_GREEN));
    Material::shared_ptr m_Material_PerlinNoiseRed(new PerlinNoiseMaterial(0.0, 1.0, COLOUR_RED));
    Material::shared_ptr m_Material_PerlinNoiseBlue(new PerlinNoiseMaterial(0.0, 1.0, COLOUR_BLUE));
    m_Camera = Camera::shared_ptr(defaultCamera());
    Scene& scene = *m_Scene;

    scene.AddPointLight(new PointLight(TColor(1), Vector( 300,  300, 300), 800));
    scene.AddPointLight(new PointLight(TColor(1), Vector(-300, -300, 300), 450));
    scene.AddPointLight(new PointLight(TColor(1), Vector( 300, -300, 300), 450));
    scene.AddPointLight(new PointLight(TColor(1), Vector(-300,  300, 300), 450));

    int c = 0;
    for (int x = -100; x <= 100; x += 20)
    {
        if (x != 0)
        {
            for (int y = -100; y <= 100; y += 20)
            {
                for (int z =-1000; z <= 100; z += 20)
                {
                    c++;
                    switch(c % 4)
                    {

                    case 0:
                    {

                        scene.AddSceneObject(new Sphere(m_Material01, Vector( x,   y,   z),  5));
                        break;
                    }
                    case 1:
                        scene.AddSceneObject(new Sphere(m_Material_PerlinNoiseBlue, Vector( x,   y,   z),  5));
                        break;

                    case 2:
                        scene.AddSceneObject(new Sphere(m_Material_PerlinNoiseRed, Vector( x,   y,   z),  5));
                        break;
                    case 3:
                        scene.AddSceneObject(new Sphere(m_Material_Scatter, Vector( x,   y,   z),  5));
                        break;
                    }
                }
            }
        }
    }
}
void __fastcall TEditorsStylesDemoDemoMainForm::SetBlueSlideUpHintStyle()
{
  if (!ShowHint) ShowHint = true;
  AdvancedHintStyle->Standard = false;
  AdvancedHintStyle->Animate = cxhaSlideUpward;

  AdvancedHintStyle->Color = TColor(0x00EDBB87);
  AdvancedHintStyle->Font->Color = TColor(0x00AD3F29);
  AdvancedHintStyle->Font->Height = -13;
  AdvancedHintStyle->Font->Style.Clear();
  AdvancedHintStyle->IconType = cxhiCustom;
  AdvancedHintStyle->IconSize = cxisDefault;
  AdvancedHintStyle->Rounded = false;
}
Пример #12
0
//---------------------------------------------------------------------------
// DragOver イベントのコールバック関数
//---------------------------------------------------------------------------
void __fastcall TForm1::FilesDragOver(POINTL ptl)
{

int px, py, pr, pb;
TRect rcResult;
TRect rcMouse = TRect(ptl.x-1, ptl.y-1, ptl.x+1, ptl.y+1);   //マウス位置
TRect rcTarget;

DragAndDropTarget->fMultipleFilesOk = false;
DragAndDropTarget->DropImageType = DROPIMAGE_COPY;

//パスワード入力ボックス
px = txtInputPassword->Left;
py = txtInputPassword->Top;
pr = txtInputPassword->BoundsRect.Right;
pb = txtInputPassword->BoundsRect.Bottom;
rcTarget = Rect(ClientToScreen(TPoint(px, py)), ClientToScreen(TPoint(pr, pb)));

if (IntersectRect(rcResult, rcMouse, rcTarget) == true ) {
	txtInputPassword->Color = TColor(0xDBEBF7);  //オレンジ色
}
else{
	txtInputPassword->Color = clWindow;
}


}
Пример #13
0
//---------------------------------------------------------------------------
TDrawing::TDrawing(TDrawing &Source) :
    TList(),
    m_nTool(0),
    m_TmpItem(NULL),
    m_nDragMode(0),
    m_nDragIndex(0),
    m_bDrawRequest(true),
    m_bModified(false),
    m_nPenColor(TColor(0x7fffffff)),
    m_nBrushColor(TColor(-1))
{
    for (int i = 0 ; i < Source.Count ; i++) {
        Add(new TDrawingItem(*Source.DItem(i)));
    }
    ClearSelection();
}
void TSensorView::Grid3D(TDC& dc)
{
  if(m_bGrid)
  {
    TPen pen(TColor(192,192,192),0);
    dc.SelectObject(pen);
    for (int y = 0; y <= m_ySize ; y++)
    {
      MOVE(dc,Project2D(0,y,1));
      LINE(dc,Project2D(0,y,0));
      LINE(dc,Project2D(m_xSize,y,0));
    }
    for (int x = 0; x <= m_xSize; x++)
    {
      MOVE(dc,Project2D(x,0,1));
      LINE(dc,Project2D(x,0,0));
      LINE(dc,Project2D(x,m_ySize,0));
    }
    for (SHORTREAL z = 0; z < 1.05; z += (SHORTREAL) 0.1)
    {
      MOVE(dc,Project2D(0,m_ySize,z));
      LINE(dc,Project2D(0,0,z));
      LINE(dc,Project2D(m_xSize,0,z));
    }
    dc.RestorePen();
  }
}
Пример #15
0
void __fastcall TItemList::FormShow(TObject *Sender)
{
    InplaceEdit->Editor->Color		= TColor(0x00A0A0A0);
    InplaceEdit->Editor->AutoSelect	= true;
	// check window position
	CheckWindowPos					(this);
}
Пример #16
0
//---------------------------------------------------------------------------
void __fastcall TForm5::Button3Click(TObject *Sender)
{
	Button3->Visible=false;
	Button4->Visible=true;

	OleVariant Template = EmptyParam();
	OleVariant NewTemplate = False;
	OleVariant ItemIndex = 1;

	//conectam la Word
	try{
		WordApplication1->Connect();
	}
	catch(...){
	Application->MessageBoxW(L"Microsoft Wrd is not installed!", L"Error", MB_OK|MB_ICONSTOP);
	return;
	}

	WordApplication1->Documents->Add(Template,NewTemplate);
	WordDocument1->ConnectTo(WordApplication1->Documents->Item(ItemIndex));

	for(int i=1; i<=15;i++)
	WordLine(WordDocument1,WordFont1,IntToStr(i)+ "\n","Calibri",i+10,i%2,i%3,0,i%4,TColor(RGB(i*25,0,250-i*10)));


	WordApplication1->GetDefaultInterface()->Visible=true;
	WordApplication1->Disconnect();
}
Пример #17
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);
}
Пример #18
0
//---------------------------------------------------------------------------
void __fastcall TRxViewDlg::DrawMode(void)
{
	int sync = (m_pRxSet->m_SQ && m_pRxSet->m_pDem->GetSyncState() && m_pRxSet->m_pDem->m_Lock);
	TCanvas *pCanvas = StatusBar->Canvas;
	pCanvas->Brush->Color = sync ? TColor(RGB(0,255,0)) : clBtnFace;
//	pCanvas->FillRect(m_rcBar[sbMODE]);
	pCanvas->TextRect(m_rcBar[sbMODE], m_rcBar[sbMODE].Left+1, m_rcBar[sbMODE].Top+1, g_tDispModeTable[m_pRxSet->m_Mode]);
}
Пример #19
0
void __fastcall TZoom::CoresChange(TObject *Sender)
{
  TColor cor=TColor(sbAzul->Position*0x10000+sbVerde->Position*0x100+sbVermelho->Position);
  pnCor->Color=cor;
  lbAzul->Caption="Azul: "+IntToStr(sbAzul->Position);
  lbVerde->Caption="Verde: "+IntToStr(sbVerde->Position);
  lbVermelho->Caption="Vermelho: "+IntToStr(sbVermelho->Position);
}
Пример #20
0
//---------------------------------------------------------------------------
// get the text color of the first character of the text
//
TColor __fastcall TTaeTextAttributes::GetColor(void)
{
  TCharFormat Format;

  GetAttributes(Format);
  return (Format.dwEffects & CFE_AUTOCOLOR) ?
    clWindowText : TColor(Format.crTextColor);
}
Пример #21
0
bool simulation_load_render_mesh(const char* filename)
{
    SurfaceMesh* mesh = new SurfaceMesh;
    if (!read_mesh_obj(filename, mesh->positions, mesh->triangles, (render_meshes.empty() ? &mesh->texcoords : NULL))) // we use the texture only for the first OBJ
    {
        delete mesh;
        return false;
    }
    mesh->filename = filename;
    mesh->updateNormals();
    if (render_meshes.size()&1)
        mesh->color = TColor(0.15f, 0.15f, 0.15f, 1.0f);
    else
        mesh->color = TColor(0.8f, 0.8f, 0.8f, 1.0f);
    render_meshes.push_back(mesh);
    return true;
}
void __fastcall DrawSeats(TCanvas3D *ACanvas, int y, int tmp, const int W)
{
 // Draw an stair to simulate a building with many rows of seats
 int z;
 ACanvas->Pen->Style = psClear;
 int x1 = tmp-W+12;
 int x2 = tmp+W-12;
 y +=6;
 for (int t=1; t<=10; t++)
 {
   z = 200+16*(t-1);
   ACanvas->Brush->Color = TColor(RGB(0xB0,0x60,0x70));
   ACanvas->RectangleWithZ(Classes::Rect(x1,y,x2,y-6),z);
   ACanvas->Brush->Color = TColor(RGB(0x70,0x70,0xB0));
   ACanvas->RectangleY(x1,y-6,x2,z,z+16);
   y -= 6;
 }
}
Пример #23
0
TColor TColor::Sepia()const
{
	TColor tTemp = TColor(r, g, b, a);
	tTemp.r = (r * 0.393f) + (g * 0.769f) + (b * 0.189f);
	tTemp.g = (r * 0.349f) + (g * 0.686f) + (b * 0.168f);
	tTemp.b = (r * 0.272f) + (g * 0.534f) + (b * 0.131f);
	
	tTemp = tTemp.Clamp();

	return tTemp;
}
Пример #24
0
TColor TColor::Grayscale()const
{
	TColor tTemp = TColor(r, g, b, a);
	tTemp.r = (r * 0.2126f) + (g * 0.7152f) + (b * 0.0722f);
	tTemp.g = (r * 0.2126f) + (g * 0.7152f) + (b * 0.0722f);
	tTemp.b = (r * 0.2126f) + (g * 0.7152f) + (b * 0.0722f);
	
	tTemp = tTemp.Clamp();

	return tTemp;
}
Пример #25
0
PushButton::PushButton(TBase *parent, std::string text)
: AbstractPushButton(parent)
{
	handle = (unsigned)this;
	setStyle(TStyleOption());
	setMouseHoverColor(TColor(1, COLOR_WHITE, COLOR_CYAN));

	if (text != std::string(nullstr))
		setText(text);
	setBorderVisibility(true);
}
Пример #26
0
//---------------------------------------------------------------------------
void __fastcall TDlgEditorProps::AssignSynAttr()
{
    if(SETTING_IT) return;

    SynAttr[lbHlNames->ItemIndex]->Background = TColor(pnBG->Color);
    SynAttr[lbHlNames->ItemIndex]->Foreground = TColor(~pnFG->Color);
    SynAttr[lbHlNames->ItemIndex]->Foreground = TColor(pnFG->Color);
    if(cbBold->Checked)
        SynAttr[lbHlNames->ItemIndex]->Style = SynAttr[lbHlNames->ItemIndex]->Style << fsBold;
    else
        SynAttr[lbHlNames->ItemIndex]->Style = SynAttr[lbHlNames->ItemIndex]->Style >> fsBold;
    if(cbItalic->Checked)
        SynAttr[lbHlNames->ItemIndex]->Style = SynAttr[lbHlNames->ItemIndex]->Style << fsItalic;
    else
        SynAttr[lbHlNames->ItemIndex]->Style = SynAttr[lbHlNames->ItemIndex]->Style >> fsItalic;
    if(cbUnderlined->Checked)
        SynAttr[lbHlNames->ItemIndex]->Style = SynAttr[lbHlNames->ItemIndex]->Style << fsUnderline;
    else
        SynAttr[lbHlNames->ItemIndex]->Style = SynAttr[lbHlNames->ItemIndex]->Style >> fsUnderline;
}
Пример #27
0
void TEnhancedListBox :: DrawItem  ( DRAWITEMSTRUCT far & drawInfo )
	{
	char 	table [100] ;			/* buffer de travail      */
	TDC	drawDC(drawInfo.hDC);		/* zones de dessin        */
	TRect	itemRect(drawInfo.rcItem.left,drawInfo.rcItem.top,drawInfo.rcItem.right,drawInfo.rcItem.bottom);
	TRect   BaseRect = itemRect ;
	char *	pchar ;
	bool	useinvert = ( drawInfo. itemState & ODS_SELECTED ) ;

	if  ( drawInfo. itemID >= Nb_display )
		return ;

	if  ( ! boolpopup )			/* redimensionnement ?    */
		{
		TRect	deplace ;

		boolpopup = TRUE ;

		Parent -> GetWindowRect ( deplace ) ;	/* basee sur le parent */
		deplace. right -= deplace. left ;
		deplace. left = -1 ;
		deplace. bottom -= deplace. top ;
		deplace. top = -1 ;
		deplace. right += GetSystemMetrics ( SM_CXVSCROLL ) ; /* cache scroller */
		MoveWindow ( deplace, TRUE ) ;
		 }

	TListBox :: GetString ( table, drawInfo. itemID  ) ;

	drawDC. FillRect ( itemRect, TBrush ( TColor ( ::GetSysColor ( useinvert ? COLOR_HIGHLIGHT : COLOR_WINDOW ) ) ) ) ;

	if  ( useinvert )
		{
		SetTextColor ( drawDC, GetSysColor ( COLOR_HIGHLIGHTTEXT ) ) ;
		SetBkColor   ( drawDC, GetSysColor ( COLOR_HIGHLIGHT ) ) ;
		 }
	else
		{
		SetTextColor ( drawDC, GetSysColor ( COLOR_WINDOWTEXT ) ) ;
		SetBkColor   ( drawDC, GetSysColor ( COLOR_WINDOW ) ) ;
		 }

	itemRect. left += 3 ;		       	/* écriture formatée      */
	drawDC. DrawText ( table , -1, itemRect, DT_VCENTER ) ;
	itemRect. left += x1 ;
	pchar = memo [ base_display + drawInfo. itemID ] ;
	while  ( * pchar  &&  * pchar  !=  ' '  &&  * pchar  !=  '\t' )
		pchar ++ ;
	while  ( * pchar  ==  ' '  ||  * pchar  ==  '\t' )
		pchar ++ ;
	if  ( * pchar )
		drawDC. DrawText( pchar , -1, itemRect, DT_VCENTER ) ;
	 }
Пример #28
0
void __fastcall TDlgEditorProps::lbHlNamesClick(TObject *Sender)
{
    SETTING_IT = TRUE;
    pnBG->Color = SynAttr[lbHlNames->ItemIndex]->Background;
    BtnBG->Font->Color = TColor((~pnBG->Color)&0xFFFFFF);
    pnFG->Color = SynAttr[lbHlNames->ItemIndex]->Foreground;
    BtnFG->Font->Color = TColor((~pnFG->Color)&0xFFFFFF);

    cbBold->Checked =
        SynAttr[lbHlNames->ItemIndex]->Style.Contains(fsBold);
    cbItalic->Checked =
        SynAttr[lbHlNames->ItemIndex]->Style.Contains(fsItalic);
    cbUnderlined->Checked =
        SynAttr[lbHlNames->ItemIndex]->Style.Contains(fsUnderline);  /*
    ShowMessage(
        IntToStr(lbHlNames->ItemIndex)+"\nBOLD:"+
        IntToStr(SynAttr[lbHlNames->ItemIndex]->Style.Contains(fsBold))+"\nITALIC:"+
        IntToStr(SynAttr[lbHlNames->ItemIndex]->Style.Contains(fsItalic))+"\nUN:"+
        IntToStr(SynAttr[lbHlNames->ItemIndex]->Style.Contains(fsUnderline)));  */
    SETTING_IT = FALSE;
}
//---------------------------------------------------------------------------
void __fastcall DrawPlayer(TCanvas3D *ACanvas, int X, int Y, int Z,
                TColor BodyColor, TColor ArmColor, TColor PantsColor, TColor LegsColor)
{
  /* Create some 3D objects (cube, sphere, etc) to form
     a person like a football player */

  TColor clSkin = TColor(RGB(241,226,190));

  ACanvas->Pen->Style = psClear;
  // head
  ACanvas->Brush->Color = clSkin;
  ACanvas->Sphere(X,Y-20,Z,2.5);
  // neck
  ACanvas->Cylinder(true,X-1,Y-18,X+1,Y-16,Z-1,Z+1,true);

  // eyes
  ACanvas->Brush->Color = clBlack;
  ACanvas->Sphere(X-2,Y-21,Z-1,0.5);
  ACanvas->Sphere(X-2,Y-21,Z+1,0.5);

  // body
  ACanvas->Brush->Color = BodyColor;
  ACanvas->Cube(X-2,X+2,Y-16,Y-8,Z-3,Z+3,true);

  // arms
  ACanvas->Brush->Color = ArmColor;
  ACanvas->Cylinder(true,X-1,Y-16,X+2,Y-10,Z-5,Z-3,true);
  ACanvas->Cylinder(true,X-1,Y-16,Z+2,Y-10,Z+5,Z+3,true);

  // bottom arms
  ACanvas->Brush->Color = clSkin;
  ACanvas->Cylinder(true,X-1,Y-10,X+2,Y-5,Z-5,Z-3,true);
  ACanvas->Cylinder(true,X-1,Y-10,X+2,Y-5,Z+5,Z+3,true);

  // pants
  ACanvas->Brush->Color = PantsColor;
  ACanvas->Cube(X-2,X+2,Y-8,Y-4,Z-3,Z+3,true);

  // legs
  ACanvas->Brush->Color = clSkin;
  ACanvas->Cylinder(true,X-1,Y-4,X+2,Y,Z-4,Z,true);
  ACanvas->Cylinder(true,X-1,Y-4,X+2,Y,Z+4,Z,true);

  // bottom legs
  ACanvas->Brush->Color = LegsColor;
  ACanvas->Cylinder(true,X-2,Y,X+2,Y+8,Z-3,Z,true);
  ACanvas->Cylinder(true,X-2,Y,X+2,Y+8,Z+4,Z+1,true);

  // feet
  ACanvas->Brush->Color = clBlack;
  ACanvas->Cube(X-3,X+2,Y+8,Y+10,Z-2,Z-1,true);
  ACanvas->Cube(X-3,X+2,Y+8,Y+10,Z+2,Z+1,true);
}
Пример #30
0
//---------------------------------------------------------------------------
TDrawing::TDrawing(AnsiString S) :
    TList(),
    m_nTool(0),
    m_TmpItem(NULL),
    m_nDragMode(0),
    m_nDragIndex(0),
    m_bDrawRequest(true),
    m_bModified(false),
    m_nPenColor(TColor(0x7fffffff)),
    m_nBrushColor(TColor(-1))
{
    //文字列からデコード
    int count = StrToIntDef(AnsiString("0x") + S.SubString(1, 8), 0);
    int pos = 9;
    for (int i = 0 ; i < count ; i++) {
        int len = StrToIntDef(AnsiString("0x") + S.SubString(pos, 8), 0);
        pos += 8;
        Add(new TDrawingItem(S.SubString(pos, len)));
        pos += len;
    }
}