cd_canvas_control.e 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. deferred class CD_CANVAS_CONTROL
  2. inherit
  3. CANVAS_DRAW
  4. feature {ANY}
  5. clear
  6. -- Cleans the active canvas using the current background color. This
  7. -- action is interpreted very differently by each driver. Many drivers
  8. -- simply draw a rectangle with the current background color. It is NOT
  9. -- necessary to call "clear" when the canvas has just been created, as at
  10. -- this moment it is already clean. Most file-based drivers do not
  11. -- implement this function.
  12. do
  13. int_canvas_clear (cnvs);
  14. end
  15. flush
  16. -- Has a different meaning for each driver. It is useful to send
  17. -- information to buffered devices and to move to a new page or layer. In
  18. -- all cases, the current canvas attributes are preserved.
  19. do
  20. int_canvas_flush (cnvs);
  21. end
  22. save_state: POINTER
  23. -- Saves the state of attributes of the active canvas. It does not save
  24. -- play callbacks, polygon creation states (begin/vertex/vertex/...), the
  25. -- palette, complex clipping regions and driver internal attributes.
  26. do
  27. Result := int_canvas_save_state (cnvs);
  28. end
  29. restore_state (state: POINTER)
  30. -- Restores the attribute state of the active canvas. It can be used
  31. -- between canvases of different contexts. It can be used several times
  32. -- for the same state.
  33. do
  34. int_canvas_restore_state (cnvs, state);
  35. end
  36. release_state (state: POINTER)
  37. -- Releases the memory allocated by the "save_state" function.
  38. do
  39. int_canvas_release_state (state);
  40. end
  41. feature {}
  42. -- Internals
  43. int_canvas_clear (data: POINTER)
  44. external "plug_in"
  45. alias "{
  46. location: "${sys}/plugins"
  47. module_name: "iup"
  48. feature_name: "cdCanvasClear"
  49. }"
  50. end
  51. int_canvas_flush (data: POINTER)
  52. external "plug_in"
  53. alias "{
  54. location: "${sys}/plugins"
  55. module_name: "iup"
  56. feature_name: "cdCanvasFlush"
  57. }"
  58. end
  59. int_canvas_save_state (data: POINTER): POINTER
  60. external "plug_in"
  61. alias "{
  62. location: "${sys}/plugins"
  63. module_name: "iup"
  64. feature_name: "cdCanvasSaveState"
  65. }"
  66. end
  67. int_canvas_restore_state (data, state: POINTER)
  68. external "plug_in"
  69. alias "{
  70. location: "${sys}/plugins"
  71. module_name: "iup"
  72. feature_name: "cdCanvasRestoreState"
  73. }"
  74. end
  75. int_canvas_release_state (state: POINTER)
  76. external "plug_in"
  77. alias "{
  78. location: "${sys}/plugins"
  79. module_name: "iup"
  80. feature_name: "cdReleaseState"
  81. }"
  82. end
  83. end
  84. -- The MIT License (MIT)
  85. -- Copyright (c) 2016 by German A. Arias
  86. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  87. -- of this software and associated documentation files (the "Software"), to deal
  88. -- in the Software without restriction, including without limitation the rights
  89. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  90. -- copies of the Software, and to permit persons to whom the Software is
  91. -- furnished to do so, subject to the following conditions:
  92. --
  93. -- The above copyright notice and this permission notice shall be included in
  94. -- all copies or substantial portions of the Software.
  95. --
  96. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  97. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  98. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  99. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  100. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  101. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  102. -- SOFTWARE.