123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257 |
- deferred class CD_POLYGONS_BEZIER_REGIONS
- -- The functions "begin_***", "vertex" and "end" are use for many situations.
- -- "begin_***" is called once, "vertex" can be called many times, and
- -- "end_polygon" is called once to actually do something. If you call
- -- "begin_***" again before "end_polygon" the process is restarted, except for
- -- "begin_region" that can contains one or more polygons inside.
-
- inherit
- CANVAS_DRAW
- feature {ANY}
- begin_fill
- -- Starts defining a polygon to be drawn. Connects the last point to the
- -- first and fills the resulting polygon according to the current
- -- interior style. When the interior style "hollow" is defined then it
- -- behaves as if the mode were "begin_closed_lines".
- do
- int_canvas_begin (cnvs, 0)
- end
-
- begin_open_lines
- -- Starts defining a polygon to be drawn. Connects all the points
- -- at "end". Depends on line width and line style attributes.
- do
- int_canvas_begin (cnvs, 1)
- end
- begin_closed_lines
- -- Starts defining a polygon to be drawn. Connects all the points at
- -- "end" and connects the last point to the first. Depends on line width
- -- and line style attributes.
- do
- int_canvas_begin (cnvs, 2)
- end
- begin_clip
- -- Instead of creating a polygon to be drawn, creates a polygon to define
- -- a polygonal clipping region.
- do
- int_canvas_begin (cnvs, 3)
- end
- begin_bezier
- -- Defines the points of a bezier curve.
- -- See: "bezier_curve" and "add_bezier_curve".
- do
- int_canvas_begin (cnvs, 4)
- end
- begin_region
- -- Starts the creation of a complex region for clipping. All calls to
- -- "box", "sector", "chord", Filled Polygons and Text will be composed in
- -- a region for clipping. See Regions documentation.
- do
- int_canvas_begin (cnvs, 5)
- end
- begin_path
- -- Creates a path composed of several primitives that can be line draw,
- -- filled or used as clipping. Must call "path_set" to configure the
- -- action between sequences of "canvas_vertex".
- do
- int_canvas_begin (cnvs, 6)
- end
- end_polygon
- -- Ends the polygon's definition and draws it.
- do
- int_canvas_end (cnvs)
- end
- -- Vertex operations.
- vertex (x, y: INTEGER)
- -- Adds a vertex to the polygon definition.
- do
- int_canvas_vertex (cnvs, x, y)
- end
- vertex_real (x, y: REAL_64)
- -- As "vertex" but with REAL_64 coordinates.
- do
- int_canvas_c_double_vertex (cnvs, x, y)
- end
- wd_vertex (x, y: REAL_64)
- -- As "vertex" but with World coordinates.
- do
- int_wd_canvas_vertex (cnvs, x, y)
- end
- -- Path operations
- new_path
- -- Creates a new empty path. Useful if more than one path is configured.
- -- "begin_path" already creates a new path.
- do
- int_canvas_path_set (cnvs, 0)
- end
- move_to
- -- Moves the current position to the given coordinates. Must be followed
- -- by 1 call to "vertex", "vertex_real", or "wd_vertex".
- do
- int_canvas_path_set (cnvs, 1)
- end
- line_to
- -- Adds a line to the path from the current position to the given
- -- coordinates. The current position is updated to the given
- -- coordinates. If there is no current position, nothing is connected and
- -- only the current position is updated. Must be followed by 1 call to
- -- "vertex", "vertex_real", or "wd_vertex".
- do
- int_canvas_path_set (cnvs, 2)
- end
- arc
- -- Adds an arc to the path. If there is a current position adds also a
- -- line from the current position to the start of the arc. The end of the
- -- arc becomes the current position. Must be followed by 3 calls to
- -- "vertex", "vertex_real", or "wd_vertex". One for the center of the arc
- -- (xc,yc), one for the bounding rectangle size (w,h), and one for the
- -- start and end angles (angle1,angle2). Angles are in degrees and
- -- oriented counter-clockwise, but angle2 can be smaller than angle1 to
- -- describe a clockwise arc. When using integer coordinates angles must
- -- be multiplied by 1000.
- do
- int_canvas_path_set (cnvs, 3)
- end
- curve_to
- -- Adds a bezier curve to the path. If there is no current position, the
- -- first point will be used twice. The end point becomes the current
- -- position. Must be followed by 3 calls to "vertex", "vertex_real", or
- -- "wd_vertex". Must be first control point (x1,y1) + second control
- -- point (x2,y2) + end point (x3,y3).
- do
- int_canvas_path_set (cnvs, 4)
- end
- close
- -- Adds a line to the path that connects the last point with the first
- -- point of the path, closing it.
- do
- int_canvas_path_set (cnvs, 5)
- end
- fill
- -- Fills the path with the current fill attributes, then the path is
- -- discarded.
- do
- int_canvas_path_set (cnvs, 6)
- end
- stroke
- -- Strokes the path with the current line attributes, then the path is
- -- discarded.
- do
- int_canvas_path_set (cnvs, 7)
- end
- fill_and_stroke
- -- Fills the path with the current fill attributes, strokes the path with
- -- the current line attributes, then the path is discarded.
- do
- int_canvas_path_set (cnvs, 8)
- end
- clip
- -- Use the path as a clipping area to be intersected with the current
- -- clipping area, then the path is discarded.
- do
- int_canvas_path_set (cnvs, 9)
- end
-
- feature {}
- int_canvas_begin (wgt: POINTER; mode: INTEGER)
- external "plug_in"
- alias "{
- location: "${sys}/plugins"
- module_name: "iup"
- feature_name: "cdCanvasBegin"
- }"
- end
- int_canvas_end (wgt: POINTER)
- external "plug_in"
- alias "{
- location: "${sys}/plugins"
- module_name: "iup"
- feature_name: "cdCanvasEnd"
- }"
- end
- int_canvas_vertex (wgt: POINTER; x, y: INTEGER)
- external "plug_in"
- alias "{
- location: "${sys}/plugins"
- module_name: "iup"
- feature_name: "cdCanvasVertex"
- }"
- end
- int_canvas_c_double_vertex (wgt: POINTER; x, y: REAL_64)
- external "plug_in"
- alias "{
- location: "${sys}/plugins"
- module_name: "iup"
- feature_name: "cdfCanvasVertex"
- }"
- end
- int_wd_canvas_vertex (wgt: POINTER; x, y: REAL_64)
- external "plug_in"
- alias "{
- location: "${sys}/plugins"
- module_name: "iup"
- feature_name: "wdCanvasVertex"
- }"
- end
- int_canvas_path_set (wgt: POINTER; a: INTEGER)
- external "plug_in"
- alias "{
- location: "${sys}/plugins"
- module_name: "iup"
- feature_name: "cdCanvasPathSet"
- }"
- end
- end
- -- The MIT License (MIT)
- -- Copyright (c) 2016 by German A. Arias
- -- Permission is hereby granted, free of charge, to any person obtaining a copy
- -- of this software and associated documentation files (the "Software"), to deal
- -- in the Software without restriction, including without limitation the rights
- -- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- -- copies of the Software, and to permit persons to whom the Software is
- -- furnished to do so, subject to the following conditions:
- --
- -- The above copyright notice and this permission notice shall be included in
- -- all copies or substantial portions of the Software.
- --
- -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- -- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- -- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- -- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- -- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- -- SOFTWARE.
|