|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
Kenneth_Smith
Joined: 18 May 2012 Posts: 697 Location: Hamilton, Lanarkshire, Scotland.
|
Posted: Mon Nov 26, 2018 1:11 am Post subject: Draw_rectangle@ with %gr smooth4 or smooth8 options |
|
|
Below is a link to a simple drawing program which behaves as expected, drawing lines, circles, rectangles etc.
http://www.tr5mx.co.uk/canvas2.f95
If the %gr options smooth4 or smooth8 are included, there is a problem when drawing a non-filled rectangle. The drawn element does not appear immediately, and will only appear after another element e.g. a line or circle is drawn.
Ken |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Mon Nov 26, 2018 8:55 am Post subject: |
|
|
Ken
I think that the trick is probably to call set_graphics_selection@ as in the following sample which is similar to yours.
Code: | !FTN95$WINAPP
!------------------------------------------------------------------
module gr7data
character*32 cstat
end module gr7data
!---------------------------------------------------------------
program gr7
use gr7data
integer i,winio@,RGB@
integer,external::gr_func
cstat=' '
i=winio@('%ww&')
i=winio@('%ca[Box Selection]&')
i=winio@('%mn[E&xit]&','EXIT')
i=winio@('%bg&',RGB@(240,240,240))
i=winio@('%ob&')
i=winio@('%^gr[colour=#f0f0f0,box_selection,smooth8]&',300,300,gr_func)
i=winio@('%cb&')
i=winio@('%ff %nl&')
i=winio@('%ob[status]%20st%cb',cstat)
end
!-----------------------------------------------------------
integer function gr_func()
use clrwin
use gr7data
integer x1,y1,x2,y2,nstat,a,b
integer,parameter::MK_SHIFT=4,MK_CONTROL=8,RED=255
call get_mouse_info@(x1,y1,nstat)
write(cstat(1:30),'(3I7)') x1,y1,nstat
call window_update@(cstat)
if(clearwin_string@('CALLBACK_REASON') == 'MOUSE_LEFT_CLICK')then
call set_line_width@(2)
call get_graphics_selected_area@(x1,y1,x2,y2)
call set_graphics_selection@(0)
if(iand(nstat,MK_SHIFT)==MK_SHIFT) then
call draw_rectangle@(x1,y1,x2,y2,RED)
else if(iand(nstat,MK_CONTROL)==MK_CONTROL) then
a=0.5*(x2-x1)
b=0.5*(y2-y1)
call draw_ellipse@(x1+a,y1+b,a,b,RED)
else
call draw_line_between@(x1,y1,x2,y2,RED)
endif
call set_graphics_selection@(1)
endif
gr_func=2
end
!-----------------------------------------------------------
|
|
|
Back to top |
|
|
Kenneth_Smith
Joined: 18 May 2012 Posts: 697 Location: Hamilton, Lanarkshire, Scotland.
|
Posted: Mon Nov 26, 2018 3:19 pm Post subject: |
|
|
Thanks Paul, I forgot about that example. Modified your example to demonstrate issue as below, and uncommenting the call to set_graphics_selection@ the problem goes away.
Ken
Code: | program gr7
integer i,winio@,RGB@
integer,external::gr_func
i=winio@('%ww&')
i=winio@('%ca[Box Selection]&')
i=winio@('%mn[E&xit]&', 'EXIT')
i=winio@('%bg&', RGB@(240,240,240))
i=winio@('%^gr[colour=#f0f0f0,box_selection,smooth8]', 300, 300, gr_func)
end
!-----------------------------------------------------------
integer function gr_func()
use clrwin
integer x1, y1, x2, y2, nstat, a, b
integer, parameter :: RED=255
if (clearwin_string@('CALLBACK_REASON') == 'MOUSE_LEFT_CLICK') then
call set_line_width@(2)
call get_graphics_selected_area@(x1, y1, x2, y2)
print *,x1,y1,x2,y2
call draw_rectangle@(x1,y1,x2,y2,RED)
! call set_graphics_selection@(1)
endif
gr_func=2
end |
|
|
Back to top |
|
|
John-Silver
Joined: 30 Jul 2013 Posts: 1520 Location: Aerospace Valley
|
Posted: Mon Dec 03, 2018 6:53 am Post subject: |
|
|
Paul, your example above, is it in the HELP manual somewhere ? _________________ ''Computers (HAL and MARVIN excepted) are incredibly rigid. They question nothing. Especially input data.Human beings are incredibly trusting of computers and don't check input data. Together cocking up even the simplest calculation ... " |
|
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
|