Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graphics.lineto forgets drawing one pixel #4005

Closed
vicuna opened this issue Apr 16, 2006 · 1 comment
Closed

Graphics.lineto forgets drawing one pixel #4005

vicuna opened this issue Apr 16, 2006 · 1 comment
Milestone

Comments

@vicuna
Copy link

vicuna commented Apr 16, 2006

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.

File attachments

@vicuna
Copy link
Author

vicuna commented Sep 11, 2012

Comment author: @damiendoligez

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).

@vicuna vicuna closed this as completed Dec 11, 2015
@vicuna vicuna added the wontfix label Mar 14, 2019
@vicuna vicuna added this to the 4.00.1 milestone Mar 14, 2019
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant