agg_span_solid.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. //----------------------------------------------------------------------------
  2. // Anti-Grain Geometry - Version 2.4
  3. // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
  4. //
  5. // Permission to copy, use, modify, sell and distribute this software
  6. // is granted provided this copyright notice appears in all copies.
  7. // This software is provided "as is" without express or implied
  8. // warranty, and with no claim as to its suitability for any purpose.
  9. //
  10. //----------------------------------------------------------------------------
  11. // Contact: mcseem@antigrain.com
  12. // mcseemagg@yahoo.com
  13. // http://www.antigrain.com
  14. //----------------------------------------------------------------------------
  15. //
  16. // span_solid_rgba8
  17. //
  18. //----------------------------------------------------------------------------
  19. #ifndef AGG_SPAN_SOLID_INCLUDED
  20. #define AGG_SPAN_SOLID_INCLUDED
  21. #include "agg_basics.h"
  22. namespace agg
  23. {
  24. //--------------------------------------------------------------span_solid
  25. template<class ColorT> class span_solid
  26. {
  27. public:
  28. typedef ColorT color_type;
  29. //--------------------------------------------------------------------
  30. void color(const color_type& c) { m_color = c; }
  31. const color_type& color() const { return m_color; }
  32. //--------------------------------------------------------------------
  33. void prepare() {}
  34. //--------------------------------------------------------------------
  35. void generate(color_type* span, int x, int y, unsigned len)
  36. {
  37. do { *span++ = m_color; } while(--len);
  38. }
  39. private:
  40. color_type m_color;
  41. };
  42. }
  43. #endif