Visual Basic

Smalltalk
Here you can post everything which doesn't fit into the other forums!
User avatar
Greyhead
GP2 Star
Posts: 1160
Joined: 01.01.2007, 16:17
Location: Sheffield, England
Contact:

Visual Basic

Post by Greyhead »

Anyone know anything about this?

Basically I've hit upon an idea that will make it easier to come up with car bitmaps, I've had a quick look at using Visual Basic to apply it. I'm fairly sure it can be done but I don't really know how to go about it as I've never used it before.

As some of you may know, I use Paint.NET and the quadrilateral reshape plug-in effect to build up car bitmaps and the reshape each texture to fit the standard GP2 bitmap. However the reshape effect isn't all that accurate. So instead it'd be more accurate to resize groups of pixels within each texture, then resize the whole texture to fit. However this is hugely time-consuming and very dull.

Now I know you can resize images using Visual Basic (although I don't actually know how), but is it possible to resize individual parts of a bitmap, then use those parts to build up a new bitmap?

I realise this all sounds a bit complicated and I probably haven't explained it very well but if anyone can help I'd be very grateful.
Wander over to http://www.facebook.com/PixelDreamsGP2 and click "Like" for updates and screenshots from the world of PixelDreams!
User avatar
rremedio
GP2 Legend
Posts: 1559
Joined: 14.01.2007, 15:05

Re: Visual Basic

Post by rremedio »

I need to take a look at my books. I work with Visual Basic (the Slot Editor was made using VB.net, while the physics editor was made using VB6) but I've never used it to edit image files.

Anyway, I've tried to reshape images with several programs, including Photoshop and Paint Shop Pro, and they never give great results, so I think it's not an easy thing to do. But maybe it's worth a try.
"The Fox provides for himself. but God provides for the Lion"
Image
Early 90s F1 forever!
User avatar
Greyhead
GP2 Star
Posts: 1160
Joined: 01.01.2007, 16:17
Location: Sheffield, England
Contact:

Re: Visual Basic

Post by Greyhead »

It's VB.Net I've got, can't get my head around it though...
Wander over to http://www.facebook.com/PixelDreamsGP2 and click "Like" for updates and screenshots from the world of PixelDreams!
User avatar
rremedio
GP2 Legend
Posts: 1559
Joined: 14.01.2007, 15:05

Re: Visual Basic

Post by rremedio »

VB.net is more powerful, however, I've dropped using it becouse it's too hard on my poor system. Anyway, writing code for both is quite similar and maybe I can help. In fact, the slot editor was written with Visual C++. net, and not VB.net as I've said before. It would be good if you explain what inaccuracies bothers you most (pixel positions, wrong colours, etc), if we find patterns, we surely can make something about it.

I know about a nice image handling framework for Ruby (another programming language, much easier to code than VB). I've never tried it, but I'm interested on it for a long time, I'm sure it could be helpful.
"The Fox provides for himself. but God provides for the Lion"
Image
Early 90s F1 forever!
User avatar
Greyhead
GP2 Star
Posts: 1160
Joined: 01.01.2007, 16:17
Location: Sheffield, England
Contact:

Re: Visual Basic

Post by Greyhead »

Basically with Quadrilateral Reshape on Paint.NET, it doesn't "snap" to the grid so you can reshape the same thing twice and both times it'll look different. You can't be pixel-perfect with it.
Wander over to http://www.facebook.com/PixelDreamsGP2 and click "Like" for updates and screenshots from the world of PixelDreams!
User avatar
rremedio
GP2 Legend
Posts: 1559
Joined: 14.01.2007, 15:05

Re: Visual Basic

Post by rremedio »

Greyhead wrote:Basically with Quadrilateral Reshape on Paint.NET, it doesn't "snap" to the grid so you can reshape the same thing twice and both times it'll look different. You can't be pixel-perfect with it.
I get it. I'll do some research tomorrow, I'm sure something may be done.
Greyhead wrote: Now I know you can resize images using Visual Basic (although I don't actually know how), but is it possible to resize individual parts of a bitmap, then use those parts to build up a new bitmap?
I don't know how to do it, but I'm sure it can be done. Google will help :)
"The Fox provides for himself. but God provides for the Lion"
Image
Early 90s F1 forever!
User avatar
Greyhead
GP2 Star
Posts: 1160
Joined: 01.01.2007, 16:17
Location: Sheffield, England
Contact:

Re: Visual Basic

Post by Greyhead »

Much appreciated!
Wander over to http://www.facebook.com/PixelDreamsGP2 and click "Like" for updates and screenshots from the world of PixelDreams!
User avatar
rremedio
GP2 Legend
Posts: 1559
Joined: 14.01.2007, 15:05

Re: Visual Basic

Post by rremedio »

I think I've found something useful. Can you post an example file with a bitmap before reshaping?
"The Fox provides for himself. but God provides for the Lion"
Image
Early 90s F1 forever!
User avatar
Greyhead
GP2 Star
Posts: 1160
Joined: 01.01.2007, 16:17
Location: Sheffield, England
Contact:

Re: Visual Basic

Post by Greyhead »

Here's the example shape. It's the texture where the front wheel of a touring car would be.

The blue one is what it should look like after reshaping. The purple one is the original shape before reshaping.

Also after reshaping it needs resizing to 80x44 pixels.

What I've started to do is take each vertical line of pixels in the purple shape and then resize each one so it matches the corresponding vertical line in the blue shape. Obviously this takes a hell of a long time and I just wondered if there was a way of getting VB (or C++, or anything else) to do it for me.

The idea is that we could have a routine that takes all the textures and reshapes and resizes them without the time-consuming hassle of doing it manually or using the quadrilateral reshape in Paint.NET.
Attachments
Texture after reshaping
Texture after reshaping
Shape after.jpg (1.09 KiB) Viewed 17489 times
Texture before reshaping
Texture before reshaping
Shape before.jpg (1.29 KiB) Viewed 17489 times
Wander over to http://www.facebook.com/PixelDreamsGP2 and click "Like" for updates and screenshots from the world of PixelDreams!
User avatar
rremedio
GP2 Legend
Posts: 1559
Joined: 14.01.2007, 15:05

Re: Visual Basic

Post by rremedio »

I didn't make any codding yet, but I guess I know what to do. Just to make it more clear to me, for instance: this front wheel texture, in different car models, it will have different shapes (before reshaping) or you produce bitmaps always with the same shapes?

edit: if your textures always the same sizes (e.g.: the front wheels always have the same size of the purple shape), it will be easy to do something that reshapes vertical line by vertical line as you said. If the original sizes change too much, it will be more complicated, but I'm sure it can be done too.

Update: Early tests were made and results are promising. I can't emulate the "quadrilateral reshape" so we could reshape things to any shape we want, but we can resize parts of the bitmap and blend them again so we have the correct shape required for the gp2 bitmap. I just need the complete list of shapes and sizes you work with, so I can decide the best way to implement it.

Regards
"The Fox provides for himself. but God provides for the Lion"
Image
Early 90s F1 forever!
User avatar
Greyhead
GP2 Star
Posts: 1160
Joined: 01.01.2007, 16:17
Location: Sheffield, England
Contact:

Re: Visual Basic

Post by Greyhead »

The purple shape is fixed by the carshape. It comes from the touring car saloon, so basically for every touring car saloon the shape will be the same, it's just what's painted on it that's different.

The blue shape is derived from the original GP2 bitmap. It's the width it is because it's the same width as the purple shape, in order to make it easier to reshape line-by-line.
Wander over to http://www.facebook.com/PixelDreamsGP2 and click "Like" for updates and screenshots from the world of PixelDreams!
User avatar
rremedio
GP2 Legend
Posts: 1559
Joined: 14.01.2007, 15:05

Re: Visual Basic

Post by rremedio »

Greyhead wrote:The purple shape is fixed by the carshape. It comes from the touring car saloon, so basically for every touring car saloon the shape will be the same, it's just what's painted on it that's different.

The blue shape is derived from the original GP2 bitmap. It's the width it is because it's the same width as the purple shape, in order to make it easier to reshape line-by-line.
Yes, I understand that. I will need to hardcode the shaped required by GP2. Do you have something I can use as a test project? Maybe some old files not yet reshaped from a full car? I can think about some ways to implement it, but it would be easier to choose if I have a full car.
"The Fox provides for himself. but God provides for the Lion"
Image
Early 90s F1 forever!
User avatar
Greyhead
GP2 Star
Posts: 1160
Joined: 01.01.2007, 16:17
Location: Sheffield, England
Contact:

Re: Visual Basic

Post by Greyhead »

Here's a couple of PDN files: the Super 2000 saloon file contains all the shapes of the textures from the saloon carshape (the template layers), how they reshape them (the reshape layers) and the size each reshaped texture needs to be to fit together in the GP2 bitmap.

The GP2 bitmap file contains all the shapes that make up the original GP2 bitmap.
Attachments
Saloon textures.zip
(47.52 KiB) Downloaded 563 times
Wander over to http://www.facebook.com/PixelDreamsGP2 and click "Like" for updates and screenshots from the world of PixelDreams!
User avatar
Greyhead
GP2 Star
Posts: 1160
Joined: 01.01.2007, 16:17
Location: Sheffield, England
Contact:

Re: Visual Basic

Post by Greyhead »

Here's a complete car:
Attachments
Vauxhall.zip
(141 KiB) Downloaded 526 times
Wander over to http://www.facebook.com/PixelDreamsGP2 and click "Like" for updates and screenshots from the world of PixelDreams!
User avatar
rremedio
GP2 Legend
Posts: 1559
Joined: 14.01.2007, 15:05

Re: Visual Basic

Post by rremedio »

Great, now I have everything I need.

Easy to understand why reshaping everything line by line it's so annoyning.
"The Fox provides for himself. but God provides for the Lion"
Image
Early 90s F1 forever!
Post Reply