cd_canvas_control.e 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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 {NONE}
  42. -- Internals
  43. int_canvas_clear (data: POINTER)
  44. external
  45. "C inline use %"eiffel-iup.h%""
  46. alias
  47. "cdCanvasClear ($data);"
  48. end
  49. int_canvas_flush (data: POINTER)
  50. external
  51. "C inline use %"eiffel-iup.h%""
  52. alias
  53. "cdCanvasFlush ($data);"
  54. end
  55. int_canvas_save_state (data: POINTER): POINTER
  56. external
  57. "C inline use %"eiffel-iup.h%""
  58. alias
  59. "return cdCanvasSaveState ($data);"
  60. end
  61. int_canvas_restore_state (data, state: POINTER)
  62. external
  63. "C inline use %"eiffel-iup.h%""
  64. alias
  65. "cdCanvasRestoreState ($data, $state);"
  66. end
  67. int_canvas_release_state (state: POINTER)
  68. external
  69. "C inline use %"eiffel-iup.h%""
  70. alias
  71. "cdReleaseState ($state);"
  72. end
  73. end
  74. -- The MIT License (MIT)
  75. -- Copyright (c) 2016,2019 by German A. Arias
  76. -- Permission is hereby granted, free of charge, to any person obtaining a copy
  77. -- of this software and associated documentation files (the "Software"), to deal
  78. -- in the Software without restriction, including without limitation the rights
  79. -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  80. -- copies of the Software, and to permit persons to whom the Software is
  81. -- furnished to do so, subject to the following conditions:
  82. --
  83. -- The above copyright notice and this permission notice shall be included in
  84. -- all copies or substantial portions of the Software.
  85. --
  86. -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  87. -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  88. -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  89. -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  90. -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  91. -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  92. -- SOFTWARE.