Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004005OCamlOCaml generalpublic2006-04-16 16:112012-09-11 14:54
ReporterFrederic 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionwon't fix 
PlatformOSOS Version
Product Version3.09.0 
Target Version4.00.1+devFixed in Version 
Summary0004005: Graphics.lineto forgets drawing one pixel
DescriptionAccording 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.
TagsNo tags attached.
Attached Filesgz file icon error.tar.gz [^] (1,697 bytes) 2006-04-16 16:11

- Relationships

-  Notes
(0008067)
doligez (administrator)
2012-09-11 14:54

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

- Issue History
Date Modified Username Field Change
2006-04-16 16:11 Frederic New Issue
2006-04-16 16:11 Frederic File Added: error.tar.gz
2006-08-29 17:48 doligez Status new => acknowledged
2012-07-11 16:43 doligez Target Version => 4.01.0+dev
2012-07-31 13:37 doligez Target Version 4.01.0+dev => 4.00.1+dev
2012-09-11 14:54 doligez Note Added: 0008067
2012-09-11 14:54 doligez Status acknowledged => resolved
2012-09-11 14:54 doligez Resolution open => won't fix


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker