123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424 |
- deferred class CD_CANVAS_COORDINATE_SYSTEM
- inherit
- CANVAS_DRAW
- feature {ANY}
- get_size_pixels: TUPLE[INTEGER, INTEGER]
-
- local
- p: POINTER
- ix, iy: INTEGER
- tup: TUPLE[INTEGER, INTEGER]
- do
- int_canvas_get_size(cnvs, $ix, $iy, p, p)
- tup := [ix, iy]
- Result := tup
- end
- get_size_millimeters: TUPLE[REAL_64, REAL_64]
-
- local
- p: POINTER
- ix, iy: REAL_64
- tup: TUPLE[REAL_64, REAL_64]
- do
- int_canvas_get_size(cnvs, p, p, $ix, $iy)
- tup := [ix, iy]
- Result := tup
- end
- update_y_axis (y: INTEGER): INTEGER
-
-
-
- local
- yc: INTEGER
- do
- yc := y
-
- Result := int_canvas_update_y_axis(cnvs, $yc)
- end
- invert_y_axis (y: INTEGER): INTEGER
-
-
- do
- Result := int_canvas_invert_y_axis(cnvs, y)
- end
- convert_mm_to_pixels (mmx, mmy: REAL_64): TUPLE[INTEGER, INTEGER]
-
-
- local
- px, py: INTEGER
- tup: TUPLE[INTEGER, INTEGER]
- do
- int_canvas_mm_to_pixels(cnvs, mmx, mmy, $px, $py)
- tup := [px, py]
- Result := tup
- end
- convert_mm_to_pixels_real (mmx, mmy: REAL_64): TUPLE[REAL_64, REAL_64]
-
-
- local
- px, py: REAL_64
- tup: TUPLE[REAL_64, REAL_64]
- do
- int_canvas_c_double_mm_to_pixels(cnvs, mmx, mmy, $px, $py)
- tup := [px, py]
- Result := tup
- end
- convert_pixels_to_mm (px, py: INTEGER): TUPLE[REAL_64, REAL_64]
-
-
-
-
- local
- mmx, mmy: REAL_64
- tup: TUPLE[REAL_64, REAL_64]
- do
- int_canvas_pixels_to_mm(cnvs, px, py, $mmx, $mmy)
- tup := [mmx, mmy]
- Result := tup
- end
- convert_pixels_to_mm_real (px, py: REAL_64): TUPLE[REAL_64, REAL_64]
-
-
-
-
- local
- mmx, mmy: REAL_64
- tup: TUPLE[REAL_64, REAL_64]
- do
- int_canvas_c_double_pixels_to_mm(cnvs, px, py, $mmx, $mmy)
- tup := [mmx, mmy]
- Result := tup
- end
- set_origin (x, y: INTEGER)
-
-
-
-
-
- do
- int_canvas_origin(cnvs, x, y)
- end
- set_origin_real (x, y: REAL_64)
-
- do
- int_canvas_c_double_origin(cnvs, x, y)
- end
- get_origin: TUPLE[INTEGER, INTEGER]
-
- local
- x, y: INTEGER
- do
- int_canvas_get_origin(cnvs, $x, $y)
- Result := [x, y]
- end
- get_origin_real: TUPLE[REAL_64, REAL_64]
-
- local
- x, y: REAL_64
- do
- int_canvas_c_double_get_origin(cnvs, $x, $y)
- Result := [x, y]
- end
-
- set_transform (matrix: TUPLE[REAL_64, REAL_64, REAL_64, REAL_64, REAL_64, REAL_64])
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- local
- m: ARRAY[REAL_64]
- do
- create m.make_filled((0).to_double, 1, 6 + 1)
- m.put(matrix.real_64_item(1), 1)
- m.put(matrix.real_64_item(2), 2)
- m.put(matrix.real_64_item(3), 3)
- m.put(matrix.real_64_item(4), 4)
- m.put(matrix.real_64_item(5), 5)
- m.put(matrix.real_64_item(6), 6)
- int_canvas_transform(cnvs, get_pointer(m.to_c))
- end
- get_transform: TUPLE[REAL_64, REAL_64, REAL_64, REAL_64, REAL_64, REAL_64]
-
-
- local
- p: POINTER
- m: MANAGED_POINTER
- do
- p := int_canvas_get_transform(cnvs)
- if p /= default_pointer then
- create m.make_from_pointer(p, 6)
- Result := [m.read_real_64(0), m.read_real_64(1), m.read_real_64(2), m.read_real_64(3), m.read_real_64(4), m.read_real_64(5)]
- else
- io.put_string("Something goes wrong %N")
- Result := [(0).to_double, (0).to_double, (0).to_double, (0).to_double, (0).to_double, (0).to_double]
- end
- end
- apply_transform_multiply (matrix: TUPLE[REAL_64, REAL_64, REAL_64, REAL_64])
-
- local
- m: ARRAY[REAL_64]
- do
- create m.make_filled((0).to_double, 1, 4 + 1)
- m.put(matrix.real_64_item(1), 1)
- m.put(matrix.real_64_item(2), 2)
- m.put(matrix.real_64_item(3), 3)
- m.put(matrix.real_64_item(4), 4)
- int_canvas_transform_multiply(cnvs, get_pointer(m.to_c))
- end
- apply_transform_translate (dx, dy: REAL_64)
-
- do
- int_canvas_transform_translate(cnvs, dx, dy)
- end
- apply_transform_scale (sx, sy: REAL_64)
-
- do
- int_canvas_transform_scale(cnvs, sx, sy)
- end
- apply_transform_rotate (angle: REAL_64)
-
-
- do
- int_canvas_transform_rotate(cnvs, angle)
- end
- transform_point (x, y: INTEGER): TUPLE[INTEGER, INTEGER]
-
- local
- tx, ty: INTEGER
- do
- int_canvas_transform_point(cnvs, x, y, $tx, $ty)
- Result := [tx, ty]
- end
- transform_point_real (x, y: REAL_64): TUPLE[REAL_64, REAL_64]
-
- local
- tx, ty: REAL_64
- do
- int_canvas_c_double_transform_point(cnvs, x, y, $tx, $ty)
- Result := [tx, ty]
- end
- feature {NONE}
- int_canvas_get_size (wgt: POINTER; x, y, xm, ym: POINTER)
- external
- "C inline use %"eiffel-iup.h%""
- alias
- "cdCanvasGetSize ($wgt, $x, $y, $xm, $ym);"
- end
- int_canvas_update_y_axis (wgt, y: POINTER): INTEGER
- external
- "C inline use %"eiffel-iup.h%""
- alias
- "return cdCanvasUpdateYAxis ($wgt, $y);"
- end
- int_canvas_invert_y_axis (wgt: POINTER; yc: INTEGER): INTEGER
- external
- "C inline use %"eiffel-iup.h%""
- alias
- "return cdCanvasInvertYAxis ($wgt, $yc);"
- end
- int_canvas_mm_to_pixels (wgt: POINTER; mm_x, mm_y: REAL_64; cx, cy: POINTER)
- external
- "C inline use %"eiffel-iup.h%""
- alias
- "cdCanvasMM2Pixel ($wgt, $mm_x, $mm_y, $cx, $cy);"
- end
- int_canvas_c_double_mm_to_pixels (wgt: POINTER; mm_x, mm_y: REAL_64; cx, cy: POINTER)
- external
- "C inline use %"eiffel-iup.h%""
- alias
- "cdfCanvasMM2Pixel ($wgt, $mm_x, $mm_y, $cx, $cy);"
- end
- int_canvas_pixels_to_mm (wgt: POINTER; p_x, p_y: INTEGER; cx, cy: POINTER)
- external
- "C inline use %"eiffel-iup.h%""
- alias
- "cdCanvasPixel2MM ($wgt, $p_x, $p_y, $cx, $cy);"
- end
- int_canvas_c_double_pixels_to_mm (wgt: POINTER; p_x, p_y: REAL_64; cx, cy: POINTER)
- external
- "C inline use %"eiffel-iup.h%""
- alias
- "cdfCanvasPixel2MM ($wgt, $p_x, $p_y, $cx, $cy);"
- end
- int_canvas_origin (wgt: POINTER; x, y: INTEGER)
- external
- "C inline use %"eiffel-iup.h%""
- alias
- "cdCanvasOrigin ($wgt, $x, $y);"
- end
- int_canvas_c_double_origin (wgt: POINTER; x, y: REAL_64)
- external
- "C inline use %"eiffel-iup.h%""
- alias
- "cdfCanvasOrigin ($wgt, $x, $y);"
- end
- int_canvas_get_origin (wgt, x, y: POINTER)
- external
- "C inline use %"eiffel-iup.h%""
- alias
- "cdCanvasGetOrigin ($wgt, $x, $y);"
- end
- int_canvas_c_double_get_origin (wgt, x, y: POINTER)
- external
- "C inline use %"eiffel-iup.h%""
- alias
- "cdfCanvasGetOrigin ($wgt, $x, $y);"
- end
- int_canvas_transform (wgt, m: POINTER)
- external
- "C inline use %"eiffel-iup.h%""
- alias
- "cdCanvasTransform ($wgt, $m);"
- end
- int_canvas_get_transform (wgt: POINTER): POINTER
- external
- "C inline use %"eiffel-iup.h%""
- alias
- "return cdCanvasGetTransform ($wgt);"
- end
- int_canvas_transform_multiply (wgt, m: POINTER)
- external
- "C inline use %"eiffel-iup.h%""
- alias
- "cdCanvasTransformMultiply ($wgt, $m);"
- end
- int_canvas_transform_translate (wgt: POINTER; dx, dy: REAL_64)
- external
- "C inline use %"eiffel-iup.h%""
- alias
- "cdCanvasTransformTranslate ($wgt, $dx, $dy);"
- end
- int_canvas_transform_scale (wgt: POINTER; sx, sy: REAL_64)
- external
- "C inline use %"eiffel-iup.h%""
- alias
- "cdCanvasTransformScale ($wgt, $sx, $sy);"
- end
- int_canvas_transform_rotate (wgt: POINTER; ang: REAL_64)
- external
- "C inline use %"eiffel-iup.h%""
- alias
- "cdCanvasTransformRotate ($wgt, $ang);"
- end
- int_canvas_transform_point (wgt: POINTER; x, y: INTEGER; tx, ty: POINTER)
- external
- "C inline use %"eiffel-iup.h%""
- alias
- "cdCanvasTransformPoint ($wgt, $x, $y, $tx, $ty);"
- end
- int_canvas_c_double_transform_point (wgt: POINTER; x, y: REAL_64; tx, ty: POINTER)
- external
- "C inline use %"eiffel-iup.h%""
- alias
- "cdfCanvasTransformPoint ($wgt, $x, $y, $tx, $ty);"
- end
- end
|