Silverfrost Forums

Welcome to our forums

set_smoothing_mode@

13 Jan 2014 12:58 #13532

Hello Paul, it seems to me that 'rotate_font@' doesn't work when using 'set_smoothing_mode@. I have attached a short program that demonstrates the problem:

      WINAPP
      module dwdata
      integer    :: xres=400
      integer    :: yres=250
      integer    :: mydc=10
      integer    :: smoothing=0
      real*8     :: rotation = 0.d0
      real*8     :: x8 = 60.d0
      real*8     :: y8 = 50.d0
      integer*4  :: colour = 16742400  
      character (len=26) :: title = 'Smoothing mode not set yet'                                    

      end module dwdata
!===============================================
      program smoothing_mode_bug
!===============================================
      use dwdata

      external plot
      integer plot, a

      a=winio@('%ww[no_border]&')
      a=winio@('%bg[btnface]&')
      a=winio@('%ca[smoothing_mode_bug]&')
!      a=winio@('%ob%`gr%cb&',xres,yres,mydc)
      a=winio@('%ob[no_border]&')
      a=winio@('%pv%^`gr[white, user_resize, rgb_colours]&', xres, yres, mydc, plot)
      a=winio@('%cb')

      end                          
!===============================================
      integer function plot()
!===============================================
      use dwdata

      C_EXTERNAL SET_SMOOTHING_MODE@ '__set_smoothing_mode'(VAL):integer 

      integer*4          :: clearwin_info@, smooth
      character(len=20)  :: clearwin_string@
     
      if (clearwin_string@('call_back_reason') == 'RESIZE') then
        xres   = clearwin_info@ ('graphics_width')
        yres   = clearwin_info@ ('graphics_depth')
      elseif (clearwin_string@('call_back_reason') == 'MOUSE_LEFT_CLICK') then
        rotation = 0.d0
      elseif (clearwin_string@('call_back_reason') == 'MOUSE_MIDDLE_CLICK') then
        if (smoothing == 0) then
          smoothing = 5
          title = 'Smoothing_mode = 5'   
        else
          smoothing = 0
          title = 'Smoothing_mode = 0'
        endif
        smooth = set_smoothing_mode@(smoothing)
        if (smooth == 0) then
        endif
      elseif (clearwin_string@('call_back_reason') == 'MOUSE_RIGHT_CLICK') then
        rotation = -45.d0
      endif

      call rotate_font
      
      plot = 2
      
      end
!===============================================
      subroutine rotate_font
!===============================================
      use dwdata

      C_EXTERNAL DRAW_CHARACTERSD@      '__win_draw_text_d'(INSTRING,VAL,VAL,VAL)
      C_EXTERNAL DRAW_FILLED_RECTANGLE@'__win_fill_rectangle_l' (VAL,VAL,VAL,VAL,VAL)

      C_EXTERNAL SELECT_FONT@ '__select_font' (INSTRING)
      C_EXTERNAL SIZE_IN_PIXELS@ '__size_in_pixels' (VAL,VAL)      
      C_EXTERNAL BOLD_FONT@ '__bold_font' (VAL)
      C_EXTERNAL ROTATE_FONT@ '__rotate_font' (VAL)

      integer*4 :: rgb@

      call draw_filled_rectangle@ (0, 0, xres, yres, rgb@(255,255,255))

      call select_font@ ('Arial')        
      call size_in_pixels@(20, 0)
      call bold_font@(1)                                  
      call rotate_font@(rotation)                             

      call draw_charactersd@(title, x8, y8, colour)
      
      end subroutine rotate_font
!===============================================
      RESOURCES
      1 24 default.manifest

As long as i do not use the 'set_smoothing_mode@' command all works fine. A left mouse button click writes the character horizontally and a right mouse button click writes the character under an angle of 45°. When activating the smoothing mode with a middle mouse button click the original positions of the character are 'lost' after a right mouse button click which comes along with a rotation of the chosen font. The changing of the smoothing mode back to 'Zero' with a further middle mouse button click will be ignored by the program.

13 Jan 2014 1:05 #13533

Hello Paul, some lines have not been transmitted. Here comes the rest:

When activating the smoothing behaviour with a middle mouse button click the original positions of the characters are 'lost' after a right mouse button click which comes along with a rotation of the chosen font.

The changing of the smoothing mode back to 'Zero' with a further middle mouse button click will be ignored by the program.

Many thanks in advance for your assistance.

13 Jan 2014 5:38 #13537

You will need to download the latest dlls. Font rotation was not provided in the initial release. Download from www.silverfrost/beta/clearwin64.exe.

14 Jan 2014 9:55 #13542

I have downloaded the clearwin64.exe and replaced the files salflibc.dll and salflibc.lib in the folder where i compile and link my short test program. But the problem still exists. What does i make wrong, Paul?

14 Jan 2014 5:59 #13547

I don't have the documentation with me but from memory rotate_font@ takes real*4 and it could be a REF. Have a look at clearwin.ins.

15 Jan 2014 7:46 #13550

I have had a closer look at your code and it seems OK. Try using draw_characters@, without the D. Also, if you are not using meta files, you should be able to avoid GDI+ for the character drawing only.

I will run your code when I get the opportunity.

15 Jan 2014 9:48 #13554

Using 'DRAW_CHARACTERS@' makes no difference.

15 Jan 2014 11:01 #13555

In the meantime i have run another example, listed below

      WINAPP
      INCLUDE <clearwin.ins>
      C_EXTERNAL SET_SMOOTHING_MODE@ '__set_smoothing_mode'(VAL):integer 
      INTEGER i,ictrl,s_width,s_depth,g_width,g_depth,colour,smooth
!--- Get width and height of screen      
      s_width = clearwin_info@('SCREEN_WIDTH')
      s_depth = clearwin_info@('SCREEN_DEPTH')
!--- Size of graphics area
      g_width = 2.0*s_width/3.0
      g_depth = 2.0*s_depth/3.0
!--- Graphics window
      i=winio@('%ww%ca[WINDOWS FONTS]&')
      i=winio@('%mn[&Exit]&','EXIT')
      i=winio@('%gr[black,rgb_colours]&',g_width,g_depth)
      i=winio@('%lw',ictrl)
!--- Select Windows font 'Modern' (default attributes)
!--- Draw in intense white
      smooth = set_smoothing_mode@(5)
      CALL select_font@('Modern')
      CALL draw_characters@('1: select_font:modern', 350,380,RGB@(255,255,255))
!--- Multiply size of font by 2                          
!--- Draw in yellow
      CALL scale_font@(2.0D0)
      CALL draw_characters@('2: This is scale_font', 300,300,RGB@(255,255,0))
!--- Underline font
!--- Draw in intense cyan
      CALL underline_font@(1)
      CALL draw_characters@('3: This is underline_font', 280,200,RGB@(0,255,255))
!--- Italic font         
!--- Draw in intense green
      CALL italic_font@(1)
      CALL draw_characters@('4: This is italic_font', 300,100,RGB@(0,255,0))
!--- Specify the size of the font in pixels
!--- Draw in cyan
      CALL size_in_pixels@(20,10)
      CALL draw_characters@('5: This is size_in_pixels', 350,50,RGB@(127,0,127))
!--- Specify the size of the font in points
!--- Draw in intense blue
      CALL size_in_points@(20,10)
      CALL draw_characters@('6: This is size_in_points', 10,50,RGB@(0,0,255))
!--- Rotate the font by 70.0 degrees
!--- Draw in intense magenta
!!      CALL rotate_font@(70.0D0)
!!      CALL draw_characters@('7: This is rotate_font:70', 80,450,RGB@(255,0,255))
!--- Undo underline font
!--- Draw in intense cyan
      CALL underline_font@(0)
      CALL draw_characters@('8: This is undo underline_font', 150,450,RGB@(0,255,255))
!--- Embolden the font
!--- Draw in intense white
      CALL bold_font@(1)
      CALL draw_characters@('9: This is bold_font', 220,350,RGB@(255,255,255))
!--- User selected font, default colour black (0) 
!--- Draw in intense white
      colour=0
      CALL choose_font@(colour)
      CALL draw_characters@('10: This is choose_font', 300,450,colour)
      END

which i have taken from the manual 'ftn95.chm'. After adding the line 'smooth=set_smoothing_mode@(5)' no text will be drawn on the drawing surface after having selected a suitable font. The same strange behaviour occurs when adding the line 'smooth=set_smoothing_mode@(0)'.[/code]

15 Jan 2014 12:26 #13557

I also confirm that rotation does not work with smoothing

21 Jan 2014 8:11 #13582

Hello Paul, i'm in need of a solution for the above mentioned problems. Can you tell me what priority the problems do have for you?

21 Jan 2014 9:28 #13584

I plan to look at it today.

21 Jan 2014 10:01 #13585

The first program works OK for me. I think that I am using the same salflibc.dll as the one that is available as a beta download but I will do a new build and upload, hopefully later today.

In the second program, the problem appears to be the name of the font 'Modern'. Other fonts work OK. In this program the drawing point for CHOOSE_FONT@ needs to be adjusted. Rotated text also appears when the commented-out lines are restored.

21 Jan 2014 4:29 #13592

I have uploaded new DLLs to http://www.silverfrost.com/beta/clearwin64.exe and http://www.silverfrost.com/beta/salflibc.exe.

22 Jan 2014 8:48 #13596

I have used the new salflibc.dll and salflibc.lib but the problem is still the same. Please run the first example. After having started the program you will see the character string 'Smoothing mode not set yet'. A right mouse button click will rotate the character string at the same position. Then a middle mouse button click will activate the smoothing mode and displays the character string 'Smoothing_mode=5' at the top left corner of the drawing surface. This is the problem.

22 Jan 2014 8:57 #13597

The problem of the second example still exists. When using the statement 'smooth = set_smoothing_mode@(5)' just behind 'i=winio@('%lw', ictrl) and activating the statements 'CALL rotate_font@(70.0D0)' and 'CALL draw_characters@('7: This is rotate_font:70', 80,450,RGB@(255,0,255))' the font rotation will not be displayed on the current drawing surface.

22 Jan 2014 11:09 #13599

I have uploaded the DLLs again to the same place.

For me the samples were 'working' but the origin for drawing rotated characters was wrong. I have now fixed this.

If this still does not work for you (and you have checked that there are no local copies of old DLLs) then please let me know what operating system you are using. I am using Windows 7 at the moment.

22 Jan 2014 11:25 #13600

Hello Paul, at the first glance my problems are gone. Thanks for your assistance.

Please login to reply.