Support

If you have a problem or need to report a bug please email : support@dsprobotics.com

There are 3 sections to this support area:

DOWNLOADS: access to product manuals, support files and drivers

HELP & INFORMATION: tutorials and example files for learning or finding pre-made modules for your projects

USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here

NEW REGISTRATIONS - please contact us if you wish to register on the forum

Users are reminded of the forum rules they sign up to which prohibits any activity that violates any laws including posting material covered by copyright

Bitmap knobs strange scaling/fuzziness

For general discussion related FlowStone

Bitmap knobs strange scaling/fuzziness

Postby natbuk » Wed Nov 12, 2014 4:58 pm

Hi.

Hoping one of you gurus can help.

Just trying out Flowstone - downloaded it yesterday. I like the potential I'm seeing so far, and was close to buying it, but having some bother with bitmap-blitted knobs.

I have 31 of, 64x64 knob pics made in a vertically joined, rotating, sequence made with Knobman. They look fine in gfx package, and fine if I draw the whole thing statically in Flowstone (i.e. the long strip).

when I load them in as a bitmap, I then use the following to attempt to make a rotating knob:

knobNumPics = 31
knobHeight = ( (@picKnob.height/knobNumPics)).to_int
knobHeight = 64
cell = ((knobNumPics - 0.45 ) * @meterVal ).to_int

srcRect = [0,bmpVertStart,64, 64 ]
output 1, cell

v.drawBitmapSection @picKnob, srcRect,[0,0, 20, 20 ]

This works, in that a fuzzy version of the knob is drawn, and does rotate as expected, but (seemingly) due to the stupid grid-based scaling of srcRect/drawBitmapSection compared with drawBitmap, the pixel-to-pixel mapping I was expecting is lost.

Is this just a (severe) limitation or is there something I've misunderstood? (hoping the latter).

I guess I could load in 31 separate bitmaps (groan) and make it work that way.

What is it with this grid-based scaling thing and why is it there? Just seems silly when dealing with bitmaps.

Many thanks in advance

n.
natbuk
 
Posts: 3
Joined: Wed Nov 12, 2014 1:02 am

Re: Bitmap knobs strange scaling/fuzziness

Postby KG_is_back » Wed Nov 12, 2014 7:14 pm

Fuzziness may happen because of interpolation, if the bitmap is not perfectly aligned with screen pixels. Normally Grid in FS is 8*8 pixels. Check if the X and Y offset of the bitmap is integer when you multiply it by 8.
KG_is_back
 
Posts: 1196
Joined: Tue Oct 22, 2013 5:43 pm
Location: Slovakia

Re: Bitmap knobs strange scaling/fuzziness

Postby Exo » Wed Nov 12, 2014 8:21 pm

Hi natbuk, welcome!

Try scaling up in multiples of 8, for example 16 or 24.
Also the grid pixel size can be changed in the options if you like, although I have never felt a need to do that.
Flowstone Guru. Blog and download site for Flowstone.
Best VST Plugins. Initial Audio.
Exo
 
Posts: 426
Joined: Wed Aug 04, 2010 8:58 pm
Location: UK

Re: Bitmap knobs strange scaling/fuzziness

Postby tulamide » Thu Nov 13, 2014 12:18 am

natbuk wrote:Hi.

Hoping one of you gurus can help.

Just trying out Flowstone - downloaded it yesterday. I like the potential I'm seeing so far, and was close to buying it, but having some bother with bitmap-blitted knobs.

I have 31 of, 64x64 knob pics made in a vertically joined, rotating, sequence made with Knobman. They look fine in gfx package, and fine if I draw the whole thing statically in Flowstone (i.e. the long strip).

when I load them in as a bitmap, I then use the following to attempt to make a rotating knob:

knobNumPics = 31
knobHeight = ( (@picKnob.height/knobNumPics)).to_int
knobHeight = 64
cell = ((knobNumPics - 0.45 ) * @meterVal ).to_int

srcRect = [0,bmpVertStart,64, 64 ]
output 1, cell

v.drawBitmapSection @picKnob, srcRect,[0,0, 20, 20 ]

This works, in that a fuzzy version of the knob is drawn, and does rotate as expected, but (seemingly) due to the stupid grid-based scaling of srcRect/drawBitmapSection compared with drawBitmap, the pixel-to-pixel mapping I was expecting is lost.

Is this just a (severe) limitation or is there something I've misunderstood? (hoping the latter).

I guess I could load in 31 separate bitmaps (groan) and make it work that way.

What is it with this grid-based scaling thing and why is it there? Just seems silly when dealing with bitmaps.

Many thanks in advance

n.

Just a quick visit, because I don't have much time. There are some issues with the code you posted.

Code: Select all
knobHeight =  (  (@picKnob.height/knobNumPics)).to_int
knobHeight = 64
The second assignment overwrites the first. If you know that the height is 64, you don't need the first line. If you don't know, you have to get rid of the second. Also, the first one uses grid units (.height), and I assume the second one pixel values.

Code: Select all
cell = ((knobNumPics - 0.45 ) * @meterVal ).to_int
What's @meterVal? Why are you outputting cell?

Code: Select all
v.drawBitmapSection @picKnob, srcRect,[0,0, 20, 20   ]
Here you're drawing (converted to pixels, assuming default grid of 8 px per grid unit) from the bitmap the section 0, bmpVertStart * 8, 512, 512 to 0, 0, 160, 160
Is this really what you wanted?

In general, to convert to pixels, if you prefer calculating them instead of grid units, there are the view properties 'gridStep' and 'defaultGridStep'. The first one returns the current grid step (= grid step value with respect to the current zoom level), the second one the grid step at standard zoom (which is 8 pixels, if you didn't change it)
Also, the bitmap object alternatively offers size values in pixels. Instead of .width, .height just use .widthPixels, .heightPixels.

Converting pixel to grid (ignoring zoom):
bitmap.widthPixels / v.defaultGridStep

Converting grid to pixel(ignoring zoom):
bitmap.width * v.defaultGridStep

Tell me if something's unclear.
"There lies the dog buried" (German saying translated literally)
tulamide
 
Posts: 2714
Joined: Sat Jun 21, 2014 2:48 pm
Location: Germany

Re: Bitmap knobs strange scaling/fuzziness

Postby Nubeat7 » Thu Nov 13, 2014 11:38 am

i've tested the knobs with jknobmaker once, works all fine, you also need to take care of the startangles, watch this thread..

viewtopic.php?f=3&t=1129
User avatar
Nubeat7
 
Posts: 1347
Joined: Sat Apr 14, 2012 9:59 am
Location: Vienna


Return to General

Who is online

Users browsing this forum: No registered users and 65 guests