|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
FLEXPLAN3D
Joined: 25 Feb 2011 Posts: 27
|
Posted: Wed Feb 14, 2024 5:40 pm Post subject: smooth lines (antialiasing) |
|
|
The Gdi+ api provides antialiasing functions and these can be accessed under Clearwin for graphic regions (%gr). However, these do not appear to extend to windows created by %dw or windows created by the api function createwindow.
Is there an alternative method to achieve smooth lines ?
See example below -
PROGRAM main
include <windows.ins>
INTEGER iw,winio@
integer ctrl
integer :: parameter, width = 600, height = 600
iw=winio@('%ca[smooth lines]&')
c set up the surface to draw onto. Remove [smooth4] to see what anti-aliasing has given you
iw=winio@('%gr[smooth8]&', width, height)
call draw_line_between@(10,0,12,500,0)
iw=winio@(' ')
c***using %dw winstead
idc=get_bitmap_dc@(1000,800)
i=winio@('%dw %bt[ok]&',idc)
call set_smoothing_mode@(5)
call MoveToEx(idc,10, 0,iold)
call LineTo(idc,12,500 )
i=winio@(' ')
END PROGRAM main |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7931 Location: Salford, UK
|
Posted: Wed Feb 14, 2024 5:59 pm Post subject: |
|
|
I don't think there is. What would you want to do that can't be done with %gr? |
|
Back to top |
|
|
FLEXPLAN3D
Joined: 25 Feb 2011 Posts: 27
|
Posted: Wed Feb 14, 2024 8:15 pm Post subject: |
|
|
Paul
I would like to use line smoothing with windows created with the api createwindow function because my window procedure looks at the messages, wparam and lparam in more detail than I can achieve with calls to clearwin_string@(call_back_reason).
If I could get hold of these values in the %^gr call back function then I may be able to achieve what I want to do,
To show what I mean here is a small extract from my windows procedure
case WM_HSCROLL:
switch (LOWORD (wParam))
{case SB_THUMBTRACK:
xPos=HIWORD(wParam);
break;
case SB_LINEUP:
if (xPos > 0)xPos--;
break;
case SB_LINEDOWN:
if (xPos <100)xPos++;
break;
case SB_PAGELEFT:
if (xPos > 0)xPos=0;
break;
case SB_PAGERIGHT:
if (xPos <100)xPos=100;
break;
default:
break;
}
SetScrollPos(hWnd,SB_HORZ,xPos,TRUE);
// send message to flexplan3d fortran routine
pushwinstack((LONG) hWnd,(LONG)message,(LONG)wParam,(LONG) lParam); |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7931 Location: Salford, UK
|
Posted: Thu Feb 15, 2024 8:16 am Post subject: |
|
|
My first thought is that you could try using winio@ with %mg for WM_HSCROLL but there are other possibilities.
Some controls have direct access to the scroll bars. For example, %gr has the options [hscroll] and [vscroll] (see item 441 in cwplus.enh).
%dw uses a handle to a device context (HDC). For GDI+ you would need to call GdiplusStartup and then CreateFromHDC in order to create a GpGraphics pointer from the HDC. This could then be used in calls to the GDI+ primitives that draw lines etc.. In short, at lot of work. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|