From: Bee on 20 Mar 2010 21:05 Is there an API that will do a color replace? e.g. ReplaceColor picBox, vbRed, VbGreen Not necessarily a call like this but this is the idea. I need something faster than SetPixel, GetPixel If not, is there some ASM code I can work into my VB6 app?
From: Larry Serflaten on 20 Mar 2010 22:26 "Bee" <Bee(a)discussions.microsoft.com> wrote > Is there an API that will do a color replace? > e.g. ReplaceColor picBox, vbRed, VbGreen > Not necessarily a call like this but this is the idea. > I need something faster than SetPixel, GetPixel > If not, is there some ASM code I can work into my VB6 app? Have you searched google? http://www.vbaccelerator.com/home/vb/tips/Replace_One_Colour_With_Another_in_a_Picture/article.asp ???
From: Bee on 20 Mar 2010 22:44 Yeah, but I am not a Brit. So I spell color correctly. lol Thanks! "Larry Serflaten" wrote: > > "Bee" <Bee(a)discussions.microsoft.com> wrote > > Is there an API that will do a color replace? > > e.g. ReplaceColor picBox, vbRed, VbGreen > > Not necessarily a call like this but this is the idea. > > I need something faster than SetPixel, GetPixel > > If not, is there some ASM code I can work into my VB6 app? > > Have you searched google? > > http://www.vbaccelerator.com/home/vb/tips/Replace_One_Colour_With_Another_in_a_Picture/article.asp > > ??? > > > . >
From: Martin Trump on 21 Mar 2010 12:02 Bee wrote: > Is there an API that will do a color replace? > e.g. ReplaceColor picBox, vbRed, VbGreen > Not necessarily a call like this but this is the idea. > I need something faster than SetPixel, GetPixel > If not, is there some ASM code I can work into my VB6 app? > The other answer here is probably the right one but there is a more pedestrian way which has worked for me. 1. Read in a .bmp file in binary to a byte array 2. The first 54 bytes are the header. From that you can find the height and width allowing access the colour info. Change that as you wish, save it, then load it back into a PictureBox. Three gotchas. The dimensions are stored LS byte first. Lines are padded to a multiple of four bytes. The picture is stored upside down. Just obtaining the colours from a 100k pixel image takes ~40msec on my m/c. in the IDE, maybe twice as long for the complete colour replacement job. Martin
|
Pages: 1 Prev: VB6 and KBasic Next: Should my properties be a method or set by a method |