LineStyle and -thickness

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by StSchnell.

Hello community and Fred,
my wish for a future version of PureBasic is the possibility to set the style and the thickness of the line, in the 2D graphic.
I want to code a graphic tool for a program workflow, and I need different line styles (e. g. dash, dot, dash dot...) and thickness (e. g. 2 point for a line with an arrow...).
Bye
Stefan
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by tranquil.

Possible by a command like:

SetLineStyle %11001100 (one Byte)
and
SetLineStyleEx (with a word long style

with two constants to the line command as flags:
#LineStyle or #LineStyleEx

Cheers
Mike




Tranquilizer/ Secretly!
http://www.secretly.de
Registred PureBasic User
System: Windows 2000 Server, 512 MB Ram, GeForce4200 TI 128 MB DDR, Hercules Theater 6.1 DTS Sound
System 2: Mobile Pentium 4 2.4GHz 512 MB DDR GeForce4 420-32, Windows XP Home
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by El_Choni.

I can't test it right now, but maybe you can change that in Windows using API:

Code: Select all

StartDrawing(WindowOutput())
hDC = GetDC_(WindowID())
MyPen = CreatePen_(#PS_DOT, 1, $FF0000) ; Red dotted 1 unit wide pen
OldPen = SelectObject_(hDC, MyPen) ; look at WIN32.HLP
ReleaseDC_(WindowID(), hDC) ; to find out the correct constant names

; Do your drawing here

hDC = GetDC_(WindowID())
SelectObject_(hDC, OldPen)
DeleteObject_(MyPen)
ReleaseDC_(WindowID(), hDC)
StopDrawing()
If it doesn't work, try putting it before StartDrawing(). I hope it helps.

El_Choni
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by StSchnell.

Hi El_Choni,
tanks for your tip, the problem is not to use the paint commands
from the Win-API. I think about PB internal commands to do this,
because the handling of the paint functions from the Win-API, with
a lot of structures, is not very friendly for the usability.
Bye
Stefan
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by StSchnell.

Hi Mike,
that is allright, good suggestion.
Bye
Stefan
Post Reply