Vector Curve Designer (RAD Tool)

Share your advanced PureBasic knowledge/code with the community.
User avatar
Paul
PureBasic Expert
PureBasic Expert
Posts: 1243
Joined: Fri Apr 25, 2003 4:34 pm
Location: Canada
Contact:

Re: Vector Curve Designer (RAD Tool)

Post by Paul »

IceSoft wrote: Sun Jan 29, 2023 7:48 pm @Paul can you add this debug line before Select point (e.g.: line 1069) ?

Code: Select all

          Debug "Point(" +Str(cursorx) + "," +Str(cursory)+ ")"        
          Select Point(cursorx, cursory)
Should be always >= 0
Hi IceSoft,
When the cursor is moved around in the drawing area (without any resizing of the form), if cursorx or cursory >699 then Point() fails
Image Image
User avatar
IceSoft
Addict
Addict
Posts: 1616
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Re: Vector Curve Designer (RAD Tool)

Post by IceSoft »

Paul wrote: Sun Jan 29, 2023 10:34 pm Hi IceSoft,
When the cursor is moved around in the drawing area (without any resizing of the form), if cursorx or cursory >699 then Point() fails
@Paul
Can you add/replace (line 1067) this snippet plz and tell me what happens

Code: Select all

  
        cursorx = GetGadgetAttribute(canvas, #PB_Canvas_MouseX)
        cursory = GetGadgetAttribute(canvas, #PB_Canvas_MouseY)
        If Not moveinprogress And cursorx < 699 And cursory < 699  ; < line 1067 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
          If StartDrawing(ImageOutput(imgLayers(zoomlevel)))    
Belive!
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
User avatar
Paul
PureBasic Expert
PureBasic Expert
Posts: 1243
Joined: Fri Apr 25, 2003 4:34 pm
Location: Canada
Contact:

Re: Vector Curve Designer (RAD Tool)

Post by Paul »

Hi IceSoft, actually I think it should be...

Code: Select all

If Not moveinprogress And cursorx<width_viewport And cursory<height_viewport
If I hardcode 700 (not 699) it only fixes the problem until a background image is loaded, then a new number is required which is generated in your InitializeCanvas() procedure.

I would also suggest changing line 126

Code: Select all

szIcon=24

to this so the icons are drawn the proper size for the higher DPI monitor with scaling.

Code: Select all

szIcon=24*DesktopResolutionX()


The drawing canvas is not scaled properly either but I won't complain about that :wink:
Image Image
User avatar
IceSoft
Addict
Addict
Posts: 1616
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Re: Vector Curve Designer (RAD Tool)

Post by IceSoft »

Paul wrote: Mon Jan 30, 2023 12:11 am

Code: Select all

If Not moveinprogress And cursorx<width_viewport And cursory<height_viewport
I would also suggest changing line 126

Code: Select all

szIcon=24

to this so the icons are drawn the proper size for the higher DPI monitor with scaling.

Code: Select all

szIcon=24*DesktopResolutionX()
The drawing canvas is not scaled properly either but I won't complain about that :wink:
Good points.
@netmaestro can add this lines.
Belive!
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8425
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: Vector Curve Designer (RAD Tool)

Post by netmaestro »

Recommended modifications re DPI Aware bug have been made and code in original post is updated. Version is now 1.1.01 thanks Paul.
BERESHEIT
User avatar
IceSoft
Addict
Addict
Posts: 1616
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Re: Vector Curve Designer (RAD Tool)

Post by IceSoft »

@netmaestro
Next feature wish:
The normal view is always "normal size" and the small view is more a lupe (which is always on => the lupe icon is no longer needed)
Belive!
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
User avatar
IceSoft
Addict
Addict
Posts: 1616
Joined: Thu Jun 24, 2004 8:51 am
Location: Germany

Re: Vector Curve Designer (RAD Tool)

Post by IceSoft »

I add a github repository for this nice tool:
https://github.com/aismann/PureBasic_examples

Add some new features too:
[FEATURES]
- Add a magnifier
- [Space] Enable/Disable the red 4 circles (for a better view)
- [RMB] Enable/Disable the red curve in the magnifier
- [RMB Dopple Click] same like 'Commit This Curve'

[Design]
- UI 'compacted'

Screenshot:
Image
Belive!
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
Post Reply