Draggable handles

Discussions related to graphics (2D and 3D), animation and games programming
KenDown
Posts: 184
Joined: Wed 04 Apr 2018, 06:36

Draggable handles

Post by KenDown »

Apologies if this has been dealt with before.

I notice in many programs (such as PowerPoint) that when you click on an object - a picture or a block of text - it is surrounded by a rectangle with small squares in each corner and at the mid-points of the sides. You can drag these "handles" to alter the size and proportions of the rectangle.

Is there any simple way of providing and interpreting such a rectangle?

DDRM
Posts: 221
Joined: Mon 02 Apr 2018, 18:04

Re: Draggable handles

Post by DDRM »

I don't know of an automated way, but when I want drag boxes I use xor plotting, so that it's easy to move/resize them. I often want to drag a box round something, and this approach works very well for that. What you want is a bit different, but should be doable that way?

KenDown
Posts: 184
Joined: Wed 04 Apr 2018, 06:36

Re: Draggable handles

Post by KenDown »

To do that for a simple rectangle is one thing; to do a rectangle and eight small squares (plus calculating the mid-point of the sides) would involve a degree of overheads that would make it rather slow and clunky. Plus interpreting the mouse position and which directions movement is constrained in (ie. the middle side handles are constrained to horizontal dragging). Hmmmm.

In addition, what I want is to drag and resize jpeg pictures. It happens very smoothly in PowerPoint; I doubt similar smoothness could be achieved in BB4W.

RichardRussell
Posts: 593
Joined: Tue 15 Oct 2019, 09:10

Re: Draggable handles

Post by RichardRussell »

KenDown wrote:
Sat 28 Nov 2020, 20:36
I doubt similar smoothness could be achieved in BB4W.
So use BBCSDL instead. It has exactly the features you need:
  • GPU-accelerated 2D graphics.
  • GPU-accelerated image resizing.
  • Built-in support for vSync.
resulting in it being both extremely fast and super-smooth.
I am suffering from 'cognitive decline' and depression. If you have a comment about the style or tone of this message please report it to the moderators by clicking the exclamation mark icon, rather than complaining on the public forum.

KenDown
Posts: 184
Joined: Wed 04 Apr 2018, 06:36

Re: Draggable handles

Post by KenDown »

That thought had already occurred to me - but I immediately ran up against a problem (for which my ignorance is, no doubt, to blame). How do I display a .jpg picture in SDL? Please?

RichardRussell
Posts: 593
Joined: Tue 15 Oct 2019, 09:10

Re: Draggable handles

Post by RichardRussell »

KenDown wrote:
Fri 04 Dec 2020, 20:28
How do I display a .jpg picture in SDL?
*DISPLAY (OSCLI "DISPLAY...") will display BMPs, GIFs, PNGs and JPGs (at least), but is slow.

*MDISPLAY (OSCLI "MDISPLAY...") is faster, but still not great.

For your application I was anticipating that you would use the imglib library for maximum speed (plus it supports non-integer coordinates and scaling, which you may need as you implied you wanted extreme 'smoothness').

Note that although there is a compatible IMGLIB library for BB4W, it is not hardware-accelerated so is nowhere near as fast as the BBCSDL version. Compare aliens.bbc running on both platforms for a stark demonstration of the difference.
I am suffering from 'cognitive decline' and depression. If you have a comment about the style or tone of this message please report it to the moderators by clicking the exclamation mark icon, rather than complaining on the public forum.

KenDown
Posts: 184
Joined: Wed 04 Apr 2018, 06:36

Re: Draggable handles

Post by KenDown »

Unfortunately the IMGLIB library is not listed in the Help for BB4W, so I was unaware of its existence. In fact, looking in the LIB directory, it does not appear to be installed along with BB4W 6.13a. I notice that there is some discussion about changes you introduced (which sound very useful) but there is no list of functions and procedures provided by the library nor any statements about what it can do.

In fact, I notice that IMGLIB does not feature in the SDL help, though it is present in the SDL LIB directory.

I know it is a lot to ask, but is there any possibility that the Help files could be updated?