Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
2.7 KiB

  1. /***************************************************************************\
  2. *
  3. * File: Matrix.h
  4. *
  5. * Description:
  6. * Matrix.h defines common Matrix and Vector operations.
  7. *
  8. *
  9. * History:
  10. * 3/25/2000: JStall: Created
  11. *
  12. * Copyright (C) 2000 by Microsoft Corporation. All rights reserved.
  13. *
  14. \***************************************************************************/
  15. #if !defined(BASE__Matrix_h__INCLUDED)
  16. #define BASE__Matrix_h__INCLUDED
  17. #pragma once
  18. //------------------------------------------------------------------------------
  19. class Vector3
  20. {
  21. public:
  22. inline Vector3();
  23. inline Vector3(const Vector3 & src);
  24. inline Vector3(float fl0, float fl1, float fl2);
  25. inline float Get(int x) const;
  26. inline void Set(int x, float fl);
  27. inline void Set(float flA, float flB, float flC);
  28. inline float operator[](int x) const;
  29. inline void Empty();
  30. #if DBG
  31. void Dump() const;
  32. #endif // DBG
  33. protected:
  34. float m_rgfl[3];
  35. };
  36. //------------------------------------------------------------------------------
  37. class Matrix3
  38. {
  39. public:
  40. inline Matrix3(bool fInit = true);
  41. void ApplyLeft(const XFORM * pxfLeft);
  42. void ApplyLeft(const Matrix3 & mLeft);
  43. void ApplyRight(const Matrix3 & mRight);
  44. void Execute(POINT * rgpt, int cPoints) const;
  45. enum EHintBounds
  46. {
  47. hbInside, // Round pixels on the border inside
  48. hbOutside // Round pixels on the border outside
  49. };
  50. void ComputeBounds(RECT * prcBounds, const RECT * prcLogical, EHintBounds hb) const;
  51. int ComputeRgn(HRGN hrgnDest, const RECT * prcLogical, SIZE sizeOffsetPxl) const;
  52. inline float Get(int y, int x) const;
  53. inline void Set(int y, int x, float fl);
  54. void Get(XFORM * pxf) const;
  55. inline const Vector3 & operator[](int y) const;
  56. void SetIdentity();
  57. void Rotate(float flRotationRad);
  58. void Translate(float flOffsetX, float flOffsetY);
  59. void Scale(float flScaleX, float flScaleY);
  60. #if DBG
  61. void Dump() const;
  62. #endif // DBG
  63. protected:
  64. Vector3 m_rgv[3]; // Each vector is a row
  65. BOOL m_fIdentity:1; // Identity matrix
  66. BOOL m_fOnlyTranslate:1; // Only translations have been applied
  67. };
  68. #include "Matrix.inl"
  69. #endif // BASE__Matrix_h__INCLUDED