BBC BASIC for Windows
« Antialiased line problem »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 11:57pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Antialiased line problem  (Read 328 times)
Joe68
New Member
Image


member is offline

Avatar




PM


Posts: 19
xx Antialiased line problem
« Thread started on: Feb 21st, 2015, 4:21pm »

I wrote a simple program to display an analogue clock.
I am trying to improve it using antialiased lines from GDIPLIB (e.g. for the hands) but I can't get this to work.

As far as I can see, my code is in accordance with that shown in the BB4W Help, but I keep receiving 'Syntax error' each time the program reaches
FN_gdipcreatepen(PenColour%,PenStyle%,PenWidth%)
Can anyone please show me where I am going wrong?

Here is a sample of a test program I used to try to discover my error:

MODE 8

INSTALL @lib$+"GDIPLIB"
PROC_gdipinit

PenColour%=&FFFFFFFF
PenStyle%=&12
PenWidth%=5
PRINT PenColour%

FN_gdipcreatepen(PenColour%,PenStyle%,PenWidth%)

PROC_gdipline(pen%,100,100,500,200)

END

Thanks in advance for the help.
Joe.
User IP Logged

Joe
VBI
Guest
xx Re: Antialiased line problem
« Reply #1 on: Feb 21st, 2015, 6:48pm »

As specified in the related help documentation, FN_gdipcreatepen has a return value for your newly created pen, so you need to supply a variable to store it in the usual way. This value is then required as Pen% by PROC_gdipline, so that it knows which pen it is being asked to draw with.

Your example, modified -

Code:
      INSTALL @lib$+"GDIPLIB"
      PROC_gdipinit
      
      MODE 8
      
      PenColour%=&FFFFFFFF
      PenStyle%=&12
      PenWidth%=5
      PRINT PenColour%
      
      pen%=FN_gdipcreatepen(PenColour%,PenStyle%,PenWidth%)
      
      PRINT pen%
      
      PROC_gdipline(pen%,100,100,500,200)
      
      PROC_gdipexit
      
      END
 


Hope that helps.
« Last Edit: Feb 21st, 2015, 6:53pm by VBI » User IP Logged

Joe68
New Member
Image


member is offline

Avatar




PM


Posts: 19
xx Re: Antialiased line problem
« Reply #2 on: Feb 21st, 2015, 8:54pm »

Thank you very much, your mod works perfectly.
I didn't find this specifically stated in the Help, and being rather new to programming I didn't realise where the 'pen' variable in the line drawing command was coming from!
Always nice to be shown a new trick! smiley
User IP Logged

Joe
Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls