You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 4005 Reporter: Frederic Status: closed (set by @xavierleroy on 2015-12-11T18:08:05Z) Resolution: won't fix Priority: normal Severity: minor Version: 3.09.0 Target version: 4.00.1+dev Category: ~DO NOT USE (was: OCaml general) Monitored by: Frederic
Bug description
According to the lastest documentation of OCaml, Graphics.get_image's parameters must be the same as for Graphics.fill_rect. However, this code :
let _ =
let () = Graphics.open_graph "" in
let ii = Graphics.get_image 0 0 10 10 in
let () = Graphics.fill_rect 0 0 10 10 in
let () = Graphics.draw_image ii 0 0 in
begin
Printf.printf "%s %s\n[Enter] " Sys.os_type Sys.ocaml_version;
flush stdout;
ignore (read_line ());
end
doesn't behave as expecting (i.e. drawing a rectangle with Graphics.foreground color and restoring the default screen). On OCaml Win32 3.09.0 we see at the end one line whereas there are two lines on OCaml Unix 3.09.1.
If the goal of this function is to leave the screen with one or two lines, after launching this program on Unix and Win32, we must then have the same screen at the end.
If Graphics.get_image have to cover the same space as Graphics.fill_rect, the rectangle drawn by Graphics.fill_rect on Win32 must not be translated by one pixel (see err_fill_rect.ml), and Graphics.draw_rect must also be corrected too.
For any w >= 0 and h >= 0, all the pixel have the Graphics.foreground color on Unix 3.09.1, this is not true on Win32 3.09.0 (for example, take w = 3 and h = 5).
The problem probably comes from Graphics.lineto (see err_lineto.ml for details).
The third file test.ml try to find the dimension of any rectangle, useful to determine precisely which function we may use instead of Graphics.fill_rect.
Quite frankly, the Graphics module is not intended for serious work. You can work around this problem by making your get_image and draw_image slightly larger (probably, one pixel in every direction would work).
Original bug ID: 4005
Reporter: Frederic
Status: closed (set by @xavierleroy on 2015-12-11T18:08:05Z)
Resolution: won't fix
Priority: normal
Severity: minor
Version: 3.09.0
Target version: 4.00.1+dev
Category: ~DO NOT USE (was: OCaml general)
Monitored by: Frederic
Bug description
According to the lastest documentation of OCaml, Graphics.get_image's parameters must be the same as for Graphics.fill_rect. However, this code :
let _ =
let () = Graphics.open_graph "" in
let ii = Graphics.get_image 0 0 10 10 in
let () = Graphics.fill_rect 0 0 10 10 in
let () = Graphics.draw_image ii 0 0 in
doesn't behave as expecting (i.e. drawing a rectangle with Graphics.foreground color and restoring the default screen). On OCaml Win32 3.09.0 we see at the end one line whereas there are two lines on OCaml Unix 3.09.1.
If the goal of this function is to leave the screen with one or two lines, after launching this program on Unix and Win32, we must then have the same screen at the end.
If Graphics.get_image have to cover the same space as Graphics.fill_rect, the rectangle drawn by Graphics.fill_rect on Win32 must not be translated by one pixel (see err_fill_rect.ml), and Graphics.draw_rect must also be corrected too.
For any w >= 0 and h >= 0, all the pixel have the Graphics.foreground color on Unix 3.09.1, this is not true on Win32 3.09.0 (for example, take w = 3 and h = 5).
The problem probably comes from Graphics.lineto (see err_lineto.ml for details).
The third file test.ml try to find the dimension of any rectangle, useful to determine precisely which function we may use instead of Graphics.fill_rect.
File attachments
The text was updated successfully, but these errors were encountered: