Clipboard Tomfoolery
smee, build 5
Build 5 of SMEE is a small hack thrown together which allows you to paste images in the system clipboard into your tile set.
Bask in its slipshod glory!
Most of the changes are in TileSelector, primarily the inner ImageTransferHandler class.
In the screenshot to the left, I've pasted in a couple tiles from selections in Windows Paint. To add the clipboard contents to the tile set, mouseover the tile set and hit CTRL+V (new tiles are placed into the first "empty" slot, or failing that, more slots are created.) Mouseover a specific tile and hit DEL to erase that tile. It was quick work, but the idea has potential.
You can, for example, remap tiles to a limited extent by deleting a tile, such as I did with the simple grass tile, substituting a little tree instead.
A bit of an irk is that Java doesn't seem to handle transparency when pasting in images. You can sidestep the issue somewhat if you copy regions to the clipboard from a graphic where a specific RGB combination is used for transparency only. There is a small block of code I've commented out in the ImageTransferHandler that zeroes out the alpha on an RGB of (0,0,0).
Paletted images don't react very well to this. You can't check for palette indices to convert to zero alpha, since the image handed to you seems to be in 24-bit regardless of the actual image's bit-depth. That may vary according to your desktop bit depth, but I didn't delve too deeply into the matter.
If you want to paste in tiles with transparency from an 8-bit image, I'd say your best bet would be to load the image in question into your favorite image editing tool and edit the palette entry for the transparent color to be (255,0,255). Then modify the commented block in ImageTransferHandler to zero out the alpha on RGBs of (255,0,255).
That color is fairly standard to indicate transparency in the higher bit-depths, and most images, even old school 8-bit (technically 6-bit) ones, aren't going to be using it. And even if they do use (63,0,63), chances are fairly good Java's conversion to RGB will produce 63*4=252 for each maxed out component, yielding (252,0,252).
At any rate, Java has some "issues." Ultimately, it may prove more advantageous to create my own image cutting & importing component. I have a few ideas about how to make the process pretty dreamy. But that's a topic for another day!
The screenshot to the right was the product of my sleep-deprived brain causing me to take the screenshot from the left and paste it in as a tile. I hope you're not tripping on mushrooms while reading this, because it will BLOW YOUR MIND.
While I'm putting together some better material on the use of custom events and event listeners, which I'll unleash over the weekend, I'm going to wind down my pace a little and polish SMEE for the remainder of the week. Finish off the New Map dialog, add proper filters to the Load and Save dialogs, spiff up the UI a little, implement some more intelligent error handling, etc. I'll also add a few more simple convenience features, such as a recently opened files history.
Tally ho!

