SynthMaker

png transparency and mouse events.

Archive · 2006 17 old posts

From the original SynthMaker forum (2004–2014), with its members’ names and dates.

aiit ·

I want to use a .png file for some gui elements because of its transparency capabilities.

Let’s say I wanted to use a star.

Is there any way to know whether the mouse is on the transparent part or not?

Colour Matrix? 😕

sambean ·

Try the 'get pixel' module maybe? Never used it before, but it may be able to extract the alpha level..

Sam

aiit ·

🙂 😀 Yea.

255 or Zero.

Thnx

infuzion ·

I feel a cool GUI comming on...

aiit ·

another Question.

any suggestions for a drag-able .png that rotates as you drag and follows a static set of coordinates.

rudimentary jpg below.

im going to start playing around with a couple of ideas.

if you guys have time some feedback could be cool and much appreciated.

infuzion ·

I know you use the Rotate primitive; look inside SM's knobs how they do it. It seems a bit mystic when I muck with it more than tweaking another module.

skOre ·

Yes, its all about rotate and its center.

skOre ·

Yet if you really want it to follow a line, you would have to go way deeper. Coordinates however would be from your lines function and if you attended math classes you know how to get the proper pointing direction for the arrow 😉

infuzion ·

I thought a simple rotate would do, if you know where the center is; SM's knobs' line will point to the center always; just we always use the circle vs line. Just change the "marker" to line.

oddson ·

There's more to this than meets the eye...

Here's as far as I got... OSM

I haven't tried to make it track a path because i couldn't solve how to get it to spin and be controlled only by the area covered by the png (with or without the transparency issue).

The lack of any way to make a boolean switch for the mouse events stopped me.

I've tried a bunch of other approaches and they all have problems.

I don't know if this will help at all but I've learned a few things about the graphics model in SM along the way.

infuzion ·

If I was handed the above example, I'd assume the triangle always points to the center, & travels along a 90 degree arc. Therefore, I'd hack the SM knob example, replace the "line" graphic with the triangle, & limit the rotation from whatever to whatever.

Shifrin ·

I've not really looked at this [or anything else for a while 🙁 ] but is the problem more to do with the mouse area than actually drawing the rotating triangle? As in you'd only want the 'triangle' itself to be the mouse area and *not* the entire 'knob' as it were!?

Shif.

infuzion ·

The mousearea problem seems to be solved by the transparent Alpha channel in the PNG... I know exactly what he wants... just a matter of having time to do it.

aiit, do you have Early Adoptors access? cheers

oddson ·

Shifrin wrote: I've not really looked at this [or anything else for a while 🙁 ] but is the problem more to do with the mouse area than actually drawing the rotating triangle? As in you'd only want the 'triangle' itself to be the mouse area and *not* the entire 'knob' as it were!?

Shif.

I tried that and got really ulgy results... the position of the .png jumped around as the mouse area read its position and fedback to itself. So to solve it I moved the control back a level to the whole module area with the intention of filtering out any mouse events not generated above the image itself... only to find the selector (needed for an event filter) doesn't transmit mouse events...

Just try to move the logic down to the module of the png and you'll see what I mean... unless someone smarter than me can make it work.

oddson ·

infuzion wrote: I thought a simple rotate would do, if you know where the center is; SM's knobs' line will point to the center always; just we always use the circle vs line. Just change the "marker" to line.

I didn't notice in the graphic example that the track appears to be a circular arc and the triangle is pointing to the centre of a circle...

If this is intended then infusion has got the right idea.... make a giant knob with a triangle position marker... you'd still have to deal with making it only respond to mouse events over the marker.

infuzion ·

oddson wrote: ... you'd still have to deal with making it only respond to mouse events over the marker.

I'd just fake it by estimating a square on top of the arrow. No one will really notice unless the graphic is big.

Shifrin ·

I've put together one solution to this, seems to work great for me. Posted it in the Examples forum as this threads title doesn't indicate what we're actually discussing 😉

ArcSlider...

Shif.

Wrote something here? To have a post removed or your name hidden, write to [email protected].

Before your first post

A few rules keep this a friendly place. You agree to them once.

Shown next to what you post, here and in the app. It doesn’t have to be your real name: 3–24 lower-case letters, digits or _ (capitals become lower case, spaces become _).

    Then your post goes up straight away.

    Delete this reply?

    Open it in SynthMaker?

    It goes on the track you’re editing there, in place of that track’s sound, and into My sounds. Your other tracks stay as they are.

    Want to keep that track’s sound? Start a new song in SynthMaker first (Song › New song), then open this.

    Report this reply?

    Only the developer reads reports. The person isn’t told who reported them.

    What’s wrong with it?

    Block this person?

    You won’t see their posts and replies here any more. They aren’t told, and you can unblock them at any time.

    People you’ve blocked

    Their posts and replies are hidden from you. Unblock someone to see them again.

    The community rules

    A few rules keep this a friendly place. Everyone agrees to them once, before their first post.