SVGComponentTransferFunctionElement.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef mozilla_dom_SVGComponentTransferFunctionElement_h
  6. #define mozilla_dom_SVGComponentTransferFunctionElement_h
  7. #include "nsSVGEnum.h"
  8. #include "nsSVGFilters.h"
  9. #include "nsSVGNumber2.h"
  10. #include "SVGAnimatedNumberList.h"
  11. #define NS_SVG_FE_COMPONENT_TRANSFER_FUNCTION_ELEMENT_CID \
  12. { 0xafab106d, 0xbc18, 0x4f7f, \
  13. { 0x9e, 0x29, 0xfe, 0xb4, 0xb0, 0x16, 0x5f, 0xf4 } }
  14. namespace mozilla {
  15. class DOMSVGAnimatedNumberList;
  16. namespace dom {
  17. typedef SVGFEUnstyledElement SVGComponentTransferFunctionElementBase;
  18. class SVGComponentTransferFunctionElement : public SVGComponentTransferFunctionElementBase
  19. {
  20. protected:
  21. explicit SVGComponentTransferFunctionElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
  22. : SVGComponentTransferFunctionElementBase(aNodeInfo)
  23. {
  24. }
  25. virtual ~SVGComponentTransferFunctionElement() {}
  26. public:
  27. typedef gfx::AttributeMap AttributeMap;
  28. // interfaces:
  29. NS_DECLARE_STATIC_IID_ACCESSOR(NS_SVG_FE_COMPONENT_TRANSFER_FUNCTION_ELEMENT_CID)
  30. NS_DECL_ISUPPORTS_INHERITED
  31. virtual bool AttributeAffectsRendering(
  32. int32_t aNameSpaceID, nsIAtom* aAttribute) const override;
  33. virtual int32_t GetChannel() = 0;
  34. AttributeMap ComputeAttributes();
  35. // WebIDL
  36. virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override = 0;
  37. already_AddRefed<SVGAnimatedEnumeration> Type();
  38. already_AddRefed<DOMSVGAnimatedNumberList> TableValues();
  39. already_AddRefed<SVGAnimatedNumber> Slope();
  40. already_AddRefed<SVGAnimatedNumber> Intercept();
  41. already_AddRefed<SVGAnimatedNumber> Amplitude();
  42. already_AddRefed<SVGAnimatedNumber> Exponent();
  43. already_AddRefed<SVGAnimatedNumber> Offset();
  44. protected:
  45. virtual NumberAttributesInfo GetNumberInfo() override;
  46. virtual EnumAttributesInfo GetEnumInfo() override;
  47. virtual NumberListAttributesInfo GetNumberListInfo() override;
  48. enum { TABLEVALUES };
  49. SVGAnimatedNumberList mNumberListAttributes[1];
  50. static NumberListInfo sNumberListInfo[1];
  51. enum { SLOPE, INTERCEPT, AMPLITUDE, EXPONENT, OFFSET };
  52. nsSVGNumber2 mNumberAttributes[5];
  53. static NumberInfo sNumberInfo[5];
  54. enum { TYPE };
  55. nsSVGEnum mEnumAttributes[1];
  56. static nsSVGEnumMapping sTypeMap[];
  57. static EnumInfo sEnumInfo[1];
  58. };
  59. NS_DEFINE_STATIC_IID_ACCESSOR(SVGComponentTransferFunctionElement, NS_SVG_FE_COMPONENT_TRANSFER_FUNCTION_ELEMENT_CID)
  60. } // namespace dom
  61. } // namespace mozilla
  62. nsresult NS_NewSVGFEFuncRElement(
  63. nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
  64. namespace mozilla {
  65. namespace dom {
  66. class SVGFEFuncRElement : public SVGComponentTransferFunctionElement
  67. {
  68. friend nsresult (::NS_NewSVGFEFuncRElement(
  69. nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
  70. protected:
  71. explicit SVGFEFuncRElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
  72. : SVGComponentTransferFunctionElement(aNodeInfo) {}
  73. public:
  74. virtual int32_t GetChannel() override { return 0; }
  75. virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
  76. virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
  77. };
  78. } // namespace dom
  79. } // namespace mozilla
  80. nsresult NS_NewSVGFEFuncGElement(
  81. nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
  82. namespace mozilla {
  83. namespace dom {
  84. class SVGFEFuncGElement : public SVGComponentTransferFunctionElement
  85. {
  86. friend nsresult (::NS_NewSVGFEFuncGElement(
  87. nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
  88. protected:
  89. explicit SVGFEFuncGElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
  90. : SVGComponentTransferFunctionElement(aNodeInfo) {}
  91. public:
  92. virtual int32_t GetChannel() override { return 1; }
  93. virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
  94. virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
  95. };
  96. } // namespace dom
  97. } // namespace mozilla
  98. nsresult NS_NewSVGFEFuncBElement(
  99. nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
  100. namespace mozilla {
  101. namespace dom {
  102. class SVGFEFuncBElement : public SVGComponentTransferFunctionElement
  103. {
  104. friend nsresult (::NS_NewSVGFEFuncBElement(
  105. nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
  106. protected:
  107. explicit SVGFEFuncBElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
  108. : SVGComponentTransferFunctionElement(aNodeInfo) {}
  109. public:
  110. virtual int32_t GetChannel() override { return 2; }
  111. virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
  112. virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
  113. };
  114. } // namespace dom
  115. } // namespace mozilla
  116. nsresult NS_NewSVGFEFuncAElement(
  117. nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo);
  118. namespace mozilla {
  119. namespace dom {
  120. class SVGFEFuncAElement : public SVGComponentTransferFunctionElement
  121. {
  122. friend nsresult (::NS_NewSVGFEFuncAElement(
  123. nsIContent** aResult, already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo));
  124. protected:
  125. explicit SVGFEFuncAElement(already_AddRefed<mozilla::dom::NodeInfo>& aNodeInfo)
  126. : SVGComponentTransferFunctionElement(aNodeInfo) {}
  127. public:
  128. virtual int32_t GetChannel() override { return 3; }
  129. virtual nsresult Clone(mozilla::dom::NodeInfo *aNodeInfo, nsINode **aResult) const override;
  130. virtual JSObject* WrapNode(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
  131. };
  132. } // namespace dom
  133. } // namespace mozilla
  134. #endif // mozilla_dom_SVGComponentTransferFunctionElement_h