void RenderDemoDlg::RenderControl(ReDrawInfoType* ExtraInfo) { // Go get a render region DocRect VirtualSize(-ExtraInfo->dx/2, -ExtraInfo->dy/2, ExtraInfo->dx/2, ExtraInfo->dy/2); RenderRegion* pRender = CreateGRenderRegion(&VirtualSize, ExtraInfo); if (pRender!=NULL) { DialogColourInfo RedrawColours; // Get a supplier for default dlg colours // Render stuff in here // Build a Linear fill attribute LinearFillAttribute MyGradFill; MyGradFill.Colour = DocColour(255, 255, 0); MyGradFill.EndColour = DocColour(0, 255, 255); MyGradFill.StartPoint = DocCoord(0, ExtraInfo->dy); MyGradFill.EndPoint = DocCoord(ExtraInfo->dx, 0); // Build a path Path InkPath; InkPath.Initialise(12,12); InkPath.FindStartOfPath(); // Get the coords used to build a shape INT32 dx = ExtraInfo->dx / 2; INT32 dy = ExtraInfo->dy / 2; INT32 Midx = ExtraInfo->dx / 4; INT32 Midy = ExtraInfo->dy / 4; // build a circle in the middle of the control InkPath.InsertMoveTo(DocCoord(Midx, dy)); InkPath.InsertCurveTo(DocCoord(Midx+Midx/2, dy), DocCoord(dx, Midy+Midy/2), DocCoord(dx, Midy)); InkPath.InsertCurveTo(DocCoord(dx, Midy-Midy/2), DocCoord(Midx+Midx/2, 0), DocCoord(Midx, 0)); InkPath.InsertCurveTo(DocCoord(Midx-Midx/2, 0), DocCoord(0, Midy-Midy/2), DocCoord(0, Midy)); InkPath.InsertCurveTo(DocCoord(0, Midy+Midy/2), DocCoord(Midx-Midx/2, dy), DocCoord(Midx, dy)); InkPath.IsFilled = TRUE; // A Grey colour [...hmmm, it's not a very grey grey any more... oragnge more like] DocColour Grey(255,200,0); // Render the attributes and the a rectangle pRender->SaveContext(); pRender->SetLineColour(Grey); // Draw a rectangle to fill in the background - Fill with Dialogue Background colour DocRect DrawMe(0, 0, ExtraInfo->dx, ExtraInfo->dy); pRender->SetFillColour(RedrawColours.DialogBack()); pRender->DrawRect(&VirtualSize); // Draw some shapes and stuff pRender->SetFillGeometry(&MyGradFill, FALSE); pRender->DrawPath(&InkPath); // Build a path Path TriPath; TriPath.Initialise(12,12); TriPath.FindStartOfPath(); // build a circle in the middle of the control TriPath.InsertMoveTo(VirtualSize.lo); TriPath.InsertLineTo(DocCoord(VirtualSize.hi.x, VirtualSize.lo.y)); TriPath.InsertLineTo(DocCoord(0, VirtualSize.hi.y)); TriPath.InsertLineTo(VirtualSize.lo); TriPath.IsFilled = TRUE; LinearFillAttribute MyTriFill; MyTriFill.Colour = ShowFirst ? First : Second; MyTriFill.EndColour = DocColour(0,0,0); MyTriFill.StartPoint = DocCoord(ExtraInfo->dx, 0); MyTriFill.EndPoint = DocCoord(0, ExtraInfo->dy); pRender->SetFillGeometry(&MyTriFill, FALSE); pRender->DrawPath(&TriPath); pRender->RestoreContext(); // Get rid of the render region DestroyGRenderRegion(pRender); } // and animate it! if (ShowFirst) { INT32 Red, Green, Blue; First.GetRGBValue(&Red, &Green, &Blue); if (Blue>0) { // Set the colour back again Blue -= 10; First.SetRGBValue(Red, Green, Blue); // redraw it InvalidateGadget(_R(IDC_REDRAW_ME)); } } else { // Set the colour back to how it was First.SetRGBValue(255, 0, 250); } }