Silverfrost Forums

Welcome to our forums

%gr[smooth4] or %gt[smooth8] not working

12 Nov 2017 5:19 #20740

The following code runs fine. However if the smooth4 or smooth8 option for the %gr are used, parts of the drawing are not show. I am using the latest release of the compiler.

  program main
  implicit none
  integer view_graphics_cb
  integer i
  i = view_graphics_cb()
  end program main

  integer function view_graphics_cb()
  implicit none
  include<windows.ins>
  integer i
  integer, parameter :: gw = 400, gh = 400
    i = winio@('%gr&',gw,gh)
!$$$$$$     i = winio@('%gr[smooth4]&',gw,gh)     !Use one of these instead of the line above
!$$$$$$     i = winio@('%gr[smooth8]&',gw,gh)
    call SET_LINE_WIDTH@(1)
    call SET_LINE_STYLE@(PS_SOLID)
    call draw_ellipse@(gw/2, gh/2 + 0,  20, 20, rgb@(0,0,0))
    call draw_ellipse@(gw/2, gh/2 + 20, 20, 20, rgb@(0,0,0))
    call draw_filled_rectangle@(gw/2 - 50, 60,    gw/2 + 50, 70, rgb@(0,0,0))
    call draw_filled_rectangle@(gw/2 - 50, gh-60, gw/2 + 50, gh-70, rgb@(0,0,0))
    call draw_line_between@(gw/2, 60,    gw/2, gh/2-20, rgb@(0,0,0))
    call draw_line_between@(gw/2, gh-60, gw/2, gh/2+40, rgb@(0,0,0))
    i = winio@(' ')
    view_graphics_cb = 1
  end function view_graphics_cb
12 Nov 2017 6:46 #20741

A better example, looks like a coordinate problem to me. Both the calls to draw_filled_rectangle@ define the same rectangle (I think ! - it's been a long day).

  integer function view_graphics_cb() 
  include<windows.ins> 
  integer i 
  integer, parameter :: gw = 400, gh = 400 
    i = winio@('%gr[smooth4]&',gw,gh)
    call SET_LINE_WIDTH@(1)
    call draw_rectangle@(150,  60, 250, 70,  rgb@(0,0,0)) 
    
!    call draw_filled_rectangle@(150, 340, 250, 330, rgb@(0,0,0))   !#### This does not work with [smooth4]
    call draw_filled_rectangle@(150, 330, 250, 340, rgb@(0,0,0))    !#### This does work with [smooth4]

    i = winio@(' ') 
    view_graphics_cb = 1 
  end function view_graphics_cb

draw_rectangle@ has the same issue.

Ken

12 Nov 2017 9:57 #20742

John, it's the order in which the coordinates are entered. One line defines Bottom Left and Top Right corners, whilst the other defines Top Left and Bottom Right. In only one case is the solid rectangle drawn:-

http://www.tr5mx.co.uk/Presentation2.jpg

Both work without the smooth4 option.

13 Nov 2017 7:16 #20745

Ah yes. This can be fixed but for the moment it is necessary to draw from the top left to the bottom right otherwise the width and/or height turns out to be negative.

13 Nov 2017 8:39 #20746

This has now been fixed for the next release of the ClearWin+ library.

13 Nov 2017 1:17 #20749

Thanks Paul, it took me longer to understand what was going wrong than it did for you to fix! Ken

Please login to reply.