DRAWRECT.CPP 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*
  2. ** Command & Conquer Red Alert(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /***************************************************************************
  19. ** C O N F I D E N T I A L --- W E S T W O O D A S S O C I A T E S **
  20. ***************************************************************************
  21. * *
  22. * Project Name : Westwood 32 Bit Library *
  23. * *
  24. * File Name : DRAWRECT.C *
  25. * *
  26. * Programmer : Christopher Yates *
  27. * *
  28. * Last Update : August 20, 1993 [JLB] *
  29. * *
  30. *-------------------------------------------------------------------------*
  31. * Functions: *
  32. * Draw_Rect -- Draws a rectangle to the LogicPage. *
  33. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  34. #include "gbuffer.h"
  35. /***************************************************************************
  36. * Draw_Rect -- Draws a rectangle to the LogicPage. *
  37. * *
  38. * This routine will draw a rectangle to the LogicPage. The rectangle *
  39. * doesn't have to be aligned on the vertical or horizontal axis. In *
  40. * fact, it doesn't even have to be a rectangle. The "square" can be *
  41. * skewed. *
  42. * *
  43. * INPUT: x1_pixel, y1_pixel -- One corner. *
  44. * *
  45. * x2_pixel, y2_pixel -- The other corner. *
  46. * *
  47. * color -- The color to draw the lines. *
  48. * *
  49. * OUTPUT: none *
  50. * *
  51. * WARNINGS: None, but the rectangle will be clipped to the current *
  52. * draw line clipping rectangle. *
  53. * *
  54. * HISTORY: *
  55. * 08/20/1993 JLB : Created. *
  56. *=========================================================================*/
  57. VOID GraphicViewPortClass::Draw_Rect(int x1_pixel, int y1_pixel, int x2_pixel, int y2_pixel, unsigned char color)
  58. {
  59. Lock();
  60. Draw_Line(x1_pixel, y1_pixel, x2_pixel, y1_pixel, color);
  61. Draw_Line(x1_pixel, y2_pixel, x2_pixel, y2_pixel, color);
  62. Draw_Line(x1_pixel, y1_pixel, x1_pixel, y2_pixel, color);
  63. Draw_Line(x2_pixel, y1_pixel, x2_pixel, y2_pixel, color);
  64. Unlock();
  65. }