Hi, it looks like I have opened a can of worms again!
It was just a thought to try it as I wasn't sure how the program grabbed the sprites. It is not a major headache as I am pleased with the outcome of the colouring of the sprites, I was just looking at how to improve on the app, especially now David Gervais has added some great icons
Not even sure if a white sprite with grey edges would work and if the whole sprite would still change colour and look ok. I need to test this really, was going to do it last night but by 4am I was goosed!
I thought the program may test the picture to fill by checking every pixel which was not black and then store that area surrounded by the black pixels, so putting an image through the program whould still store the same size sprites etc but include the other shaded pixels.
I was thinking back to my original program with the slow flood fill, I have a function which checked the image to do just this and was thinking about the sprite grabbing tool.
Here is the function:
// grab Memory Block pixels into an array from screen to store each fill area as a seperate value
function StoreFillPixels ( memBlockInput, img_width, img_height, colour_back )
for y = 0 to img_height
for x = 0 to img_width
pixelStore [ img_width, img_height ] = 0
next x
next y
for i = 0 to 20000
pixelStoreStack [ i ] = 0
next i
newFillAreaRow = 0
for rows = 1 to img_height
for columns = 1 to img_width
colour_test = GetPixel ( memBlockInput, columns-1, rows-1, img_width )
if colour_test = colour_back
colourAbove = 0
colourLeft = 0
if rows > 1 then colourAbove = pixelStore [ columns, rows - 1 ]
if columns > 1 then colourLeft = pixelStore [ columns - 1 , rows ]
if colourAbove = 0 and colourLeft = 0
newFillAreaRow = newFillAreaRow + 1
fillAreaNum = newFillAreaRow
pixelStoreStack [ newFillAreaRow ] = rows
else
if colourLeft <> 0 and colourAbove <> 0
if colourLeft = colourAbove
fillAreaNum = colourLeft
else
newColour = colourAbove
oldColour = colourLeft
// Checks rows/columns for new number that should be same as current fill and changes to this
for rowsAgain = pixelStoreStack [ oldColour ] to rows
for columnsAgain = 1 to img_width
if pixelStore [ columnsAgain, rowsAgain ] = oldColour
pixelStore [ columnsAgain, rowsAgain ] = newColour
if rowsAgain < pixelStoreStack [ newColour ] then pixelStoreStack [ newColour ] = rowsAgain
endif
next columnsAgain
next rowsAgain
fillAreaNum = newColour
endif
else
fillAreaNum = colourLeft + colourAbove
endif
endif
pixelStore [ columns, rows ] = fillAreaNum
endif
next columns
next rows
endfunction
I'll explain what it did:
function StoreFillPixels ( memBlockInput, img_width, img_height, colour_back )
The memBlockInput was the image loaded in and stored as a memblock, the image width and height speak for themselves, however a 2D array was created of the same size of the image after checking the width and height of the image loaded into it.
Array is - pixelStore [ img_width, img_height ]
The colour_back was the colour to check on the image as the fill colour and this was the top left pixel of the image put into the program which was always white as I never drew a black line in the top corner of the image.
The function then went through the memblock one pixel after another checking each one, the one above and the one to the left to find the fill areas, storing a value into the array.
The array ended up being filled with each fill area having it's own number and a black pixel having zero stored at that point on the array.
This wasn't very fast and as you know the fill speed was also the issue, however I was thinking if this function checked the image but instead of testing for the white pixels, it could check for every pixel other than black which would be the line, it could still store the same information but an image could be checked with shades on it for the anti-alaising.
It all got a bit too much then and I couldn't grab the areas for the sprites etc and as you know Jim the tool to do this not in the program is much better to save speed. Pre-rendered.
The other problem then is if I do manage to store the sprites with shading around the edges, then I would still need the shaded red image from the output, not shaded around the edges to check the areas in the game to colour the sprites.
Think maybe it is all getting too complicated for a program that works really well already with the routines in place now!
I might be looking into this too much
It is however a good discussion and giving lots to think about
Quote: "
I'm actually working on a sprite editor thing in AGKv2, basically a mobile version of the editor I use for a pixel heavy game project - I'm gonna make the first worthwhile sprite editor for tablets
"
That sounds like a good project you got going there, from looking around the forums recently, there is some good work coming out of AppGameKit
Programming - AMOS on the AMIGA! / DBPro / Python / A bit of C C++ / now also AGK2! - Graphics - Deluxe Paint on the Amiga / Paintshop Pro / Photoshop / Lightroom / Grafx2
Previously worked for Prisma Software producing childrens educational software on the Amiga - Titles - Pepe's Garden - Paint Pot / Kids Academy range - Paint Pot II / Shopping Basket / Which Where What? / Blobs / Alvin's Puzzles