freezy / dmd-extensions

A toolbox for virtual pinball dot matrix displays.
GNU General Public License v2.0
126 stars 54 forks source link

Rotate option (low priority!) - enhancement req #8

Closed CarnyPriest closed 7 years ago

CarnyPriest commented 8 years ago

Hi. Finally, finally, I got around to playing more extensively with the tool. Works beautifully for mirroring PinballFX2 on a Pinball 2000 style cabinet. It's a more elegant solution than what I was doing before, mirroring and playing back the floating DMD via the localhost loopback via ffmpeg streaming.

I have a couple of other projects that use a similar mirroring solution. Using dmdext instead would require being able to rotate the virtual dmd.

Use case 1: I have a project that mirrors VPM and dB2S output onto mini virtual DMDs on the playfield apron. It would be easy enough to re-orient the DMD monitor as portrait and rotate the DMD via script or registry. On the other hand, I don't know about dB2S on the third screen (Funhouse, Earthshaker, etc.). Maybe by going into the dB2S designer tool and re-doing these backglasses. That's a bridge too far, I think.

Use case 2: SlamIt: Big Score - I mirror from the DMD on the playfield to the third monitor. Playfield monitor must be oriented in landscape but can be rotated in-game to portrait. Dmdext can grab the image but it would be rotated and the virtual dmd is defined as a fixed 4:1 aspect ratio. In other words, the virtual would be displayed with the sides squashed in.

I'm not a developer. However, I would not mind taking a crack at a solution. Might be a while because I'm trying to switch my cab project to getting hardware toys installed. Don't do it just for me is what I'm saying. But if it's a quick one. Great!

freezy commented 8 years ago

Everything in dmdext is modular, so this is pretty easy. You can even take the existing TransformationProcessor and add a Rotation parameter. Define a RotationParameter enum in the same file that contains something like NoRotation, Rotate90CW, Rotate90CCW and Rotate180. In the Process method, you would then rotate the pixels according to the parameter.

Then you'll need to link it up to the console app, but this is trivial, check how it works for the other parameters. You basically add it to BaseOptions and apply it in the mirror and play command.

CarnyPriest commented 8 years ago

Thanks. I figured it would not be too tough. I've got an "OK" solution for now working with ffmpeg, but I think dmdext would be much better. I'll take a look and give it a try at some point. Working on assembling my pin2dmd setup at the moment.

CarnyPriest commented 8 years ago

Hi, I "am" running into trouble implementing rotation. First of all, I'm trying to force the image to rotate, but it seems like it always returns an unrotated image. So I have not even stepped off of square one. You might be able to see what I've been trying to do with the commented out code in the attached TransformationProcessor.cs file.

I've tried doing transformations in sequence with and without an interim file. I've tried stacking transform instructions in TransformGroup and TransformCollection. I haven't tried using a transformation matrix but I figured I'm missing something pretty easy due to my total lack of experience with .NET.

I'm hoping you can provide a hint. Otherwise, I 'think' I've got the user input for rotate attached correctly. I'm just trying to do left 90 deg and right 90 deg. I can't think of use case for 180 deg, and if anyone had to have it, it would be the same as enabling flip-x and flip-y simultaneously.

TransformationProcessor.cs.txt

freezy commented 7 years ago

Okay if we close this?