April 29, 2024, 08:00:04 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Changing brightness of a background image???

Started by Egil, March 11, 2015, 05:42:05 AM

Previous topic - Next topic

0 Members and 5 Guests are viewing this topic.

ckoehn

I'm waiting for your code... :)

So much to learn, so little time....

Later,
Clint

Egil

Quote from: LarryMc on March 14, 2015, 07:59:34 AM
Egil:
I'm pretty sure this is exactly what you were looking for.

Sounds great Larry!
Looking forward to see your code. ;D ;D

And just for the record, the code I posted is an early prototype. Use of the present map size was choosen to simplify the scaling for the HFDL application. Sometime in the future, I probably have to change that scheme, especially if I decide to use calibrated from Google or Open Streetmaps.
Google have a size restriction for their downloadable maps, max size is 1280 x 950 pixels.  Have not yet found the correct values for Open Steetmap. But anyway I am not allowed to download a simple calibrated map, showing the whole world, from any of them.
The map I use now, is open source, and I can do whatever I do with it. But at the cost of very large map files.

But there are plenty of tasks to do before I have to decide to stick to the present map, or make it possible to download restricted size maps from whithin the program...

Now I turn the computer fully off, and go back to my guests...
Support Amateur Radio  -  Have a ham  for dinner!

LarryMc

Something has come up and I've got to quick working on this.
In the attached zip is all the files needed to create the included modified mapview exe file.

I've added a menu with options to lighten/darken the background image; should have zero affect on anything else drawn on the window but I haven tried it yet.
Also added menu option to show how zoom in/out on an image is done.
This zooming is not compatible with Egil's scrolling scheme but it possiblibly can be adaptd with some careful thouth and work.

This uses the DeVil image library. the 3 dll files have to always be in the same folder at the exe that uses them.
the contents of the include and libs folders have to be placed in the iwbdev include and libs folders in order to be able to compile.

For some reason I I haven't as yet gotten the initial image to scale to the full image fitting the client area as yet.
However, double clicking tin the client area perform's Egil's zoom to the proper location on the earth map on the first double click.  Haven't checked a 2nd double click.

If you are in a double click zoom clicking a light/dark shade will currently take you out of double click zoom.  That's because I'm currently trying to do too many things in the one Imaage update() function.

Maybe one of you will want to pick this up and see what you can do with it.  This library will handle a lot of different file types but it converts all of them into bitmaps internally.

And it appears to me that this can be done with any image library of your choosing that allows you to adjust the contrast of the image like this.;

Sorry I couldn't stay on this right now.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Egil

Thanks Larry!

I will study your code very carefully, but not until tomorrow ...
It's been a long weekend with very little sleep, so tonight I am going two take it easy. But we had a great weekend!
Support Amateur Radio  -  Have a ham  for dinner!

LarryMc

Had a little time and I figured out how to make the initial image scale properly.

Also, I've learned enough that your(Egil) life will be much, much simpiler if you stick to your current one level of zoom you've already implemented.

I'll try to get a cleaned up source file posed within the next 18-24 hours that will work a little better.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Egil

March 16, 2015, 06:45:21 AM #30 Last Edit: March 16, 2015, 06:48:51 AM by Egil
I tried using the DeVil image library three years ago, when I first started to experiment with these ideas. At that time I used MiniBASIC for coding. I found it very difficult to load a large image and show it in a smaller client area when IL was used.
MiniBasic had the  same functionality as IWB, scaling down an image automaticly when showing it in a client area smaller than the image. But when using IL this functionality was lost. I also had some problems with the image color balance when trying the program on a small netbook running XP.

It seem to behave the same way now, using IL and Larry's code on my Win7/64 system.

I will use the next couple of days to experiment a little with the suggestions you guys have come up with, to decide what method to use.

If I manage to make a map viewing system that can be easily manipulated, and plot position data onto in a  fast and easy way, I plan to use the same setup for three different applications. The one I am working on now, plotting plane positions retrieved from the PC-HFDL Arinc decoding software, another one plotting amateur radio satellite orbits and the third, for finding amateur radio callsign prefixes, and calculating antenna beamheadings and distances from your own position to the countries using these prefixes, and maybe add "greysone" plotting.

I attach an image showing a "side effect" of the decoding hobby. It is a screendump published by another decoding hobbyist (I beleive he is in Germany), showing what impact the fighting in Ukraine has on international air traffic...
This map is produced by a freeware program called "PosFix".


Regards,
Egil.

Support Amateur Radio  -  Have a ham  for dinner!

LarryMc

I've been up all night and have learned some more.
From the previous code I posted you know I'm using the DeVil free lib.

Here's the difficult part. Development of DeVil stopped in March 2009 and a lot of the on-line documentation and forum support has disappeared.  The docs that are available are what I'd call 'skimpy' because all the commands are not covered.  
Todd Riggins way, way back wrote wrappers for the original IBasic and he combined some of the DeVil functions into a single command.  With those wrappers and his example I only knew how how to use one image at a time at a time.  Years ago I had used this library to make an image editor for my genealogy work and it worked pretty good since I only dealt with one image at a time.

Anyway, with Egil's program, with this lib and the example I had to work with, I had to figure out how do I have one image and scale it two different sizes considering the scaling normally accomplished with SHOWIMAGE doesn't work because the library forces you to convert all images to bitmaps internally and autoscaling just doesn't work.

The real problem is that the way Todd wrote his wrappers there is no way to tell the difference between multiple images. If you load a 2nd image it over writes the first internally.

So, right now I've got a scheme that when you start the program it loads the image, applies the scaling and displays the image. Then when you switch to zoom it deletes the image, reloads with no scaling and displays the zoomed portion of the image.  Then it reverses the process when switching out of zoom mode.

When in zoom mode and panning there is no need to reload.  I wound up at this point through a bunch of trial and error attempts.  I can get this back to one image but when I zoom in the image becomes way too pix-elated so it is going to take two images. So I'm leaving my current in place

After getting that working it was time to get the scaling working with this code..  I put all the code in for a trackbar control but it was a whole lot of stuff for just a little functionality so I took it back out.  I added 2 entities  to the popup menu.  The problem here is that the command to adj the contrast of an image is a value RELATIVE to it's current contrast and not an ABSOLUTE value.  So, there is no way for me to set the contrast in zoom mode and then have that same contrast appear in the non-zoom mode image and vice-versa.
While looking in the only docs in a section  that uses commands that aren't used in the only example I had to go by I was led to believe that the lib was capable of handling multiple images at one time.  I looked in the include files and the commands were there.  I started search high and low.  On sourceforge I found an index page with all the commands listed. Of course, when I clicked the links I got a 404 error; no such page.

Then I had some luck. On the CodingMonkeys site(which I happen to own;duh) there was an old example that was set up to use only use one image but the setup was structured using the commands I need (for the most part)

This is how I believe it will allow me to solve my problems.
1. I only have to load each image one time per app run
2. Contrast adj will be made to both images at the same time regardless of which is showing
3. When app is closed image is saved so contrast is saved for next run. could be saved as alt image to orig for restore feature.

All this considered it's going to take me a while to sort through this so I'm sure not not going to meet my previously set deadline.  Especially after staying up all night and a personal issue I'm dealing with.

But I'll get something to you guys as soon as I can.  I'm personally interested in seeing this work.

P.S Hope all this rambling makes sense.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

LarryMc

Quote from: Egil on March 16, 2015, 06:45:21 AM
It seem to behave the same way now, using IL and Larry's code on my Win7/64 system.
Are you saying your image dosen't look right on your computer?

This what it looks like on mine.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Egil

This is what your code looks like with me. The first one is when the program is started, and the second is the result of doubleclicking approximately on Barrow, Alaska.


Regards,
Egil.
Support Amateur Radio  -  Have a ham  for dinner!

Egil

QuoteOn the CodingMonkeys site(which I happen to own;duh) there was an old example....

There are tons of good examples on CodingMonkeys. I have learnt a lot by studying some of them.
I feel that the site deserves much more attention by active users. For me the IB Code Archive has been a real goldmine.


Regards,
Egil.
Support Amateur Radio  -  Have a ham  for dinner!

LarryMc

I thought I had explained in the post that that's what that version looked like.

Sorry

The attached is a newer mapview.exe.
Replace the one you just ran and see.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

LarryMc

When you run it
zoom somewhere
right click to bring up popup menu
click on either inc or dec contrast
image will lighten each time

if you get out of zoom right now nothing has changed and won't change as far as contrast
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Egil

Quote from: LarryMc on March 16, 2015, 09:31:30 AM
I thought I had explained in the post that that's what that version looked like.

You had explained it... but when I saw your pictures, the enthusiast in me took over, and forgot all about it.... ;D
When trying your new exe we get the same pictures!

Great work Larry, I really appreciate it!


Regards,
Egil


Support Amateur Radio  -  Have a ham  for dinner!

LarryMc

so, read my last novel and give me some time and I think we can whip this thing.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Egil

Quote from: LarryMc on March 16, 2015, 10:25:32 AM
so, read my last novel ....

I just did (again), and I like the way you think. It's a little different from what I had in mind, but that's no problem.
And for the deadline you mention... For me this is a "having fun" project, so there is no hurry.


Egil
Support Amateur Radio  -  Have a ham  for dinner!

Egil

LarryMc:

A couple of friends passed by here today, and dropped in for a cup of coffee. They are both C++ programmers, and was very interrested in the mapview program.
When I told them that you were working with the deVil library, they both said that we will be bether off with a more up to date, and still actively maintained graphic library.
They reccommended Freeimage: http://freeimage.sourceforge.net/, which they use at the company they work for.
It is free, and open source, and the last update was only a couple of days ago.

I will download it and study the documentation, to see if this library is easier to implement with IWB.


Regards,
Egil.

Support Amateur Radio  -  Have a ham  for dinner!

LarryMc

I glanced at it but I'm zero help at converting from c++ to IWB.
If you are prolific at converting then I'd tend to agree with your friends in the long term.

However, last night before I went to bed I believe I finally figured out DeVil handles multiple images.
And it appears it will be rather easy (and simple) to solve all my issues.
After some breakfast I'm going to start modifying your mapviewer to see how it goes.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

LarryMc

Problems solved!!!
DeVil allows me to load multiple images.
The process that allows that facilitates the ability to select one loaded image and do whatever you want to it and then select the other and do to it as you will in any sort of random order.

So, I loaded the world.jpg into both internal images and scaled the one to show the whole world.
Based upon Egil's 'scaled' flag I convert the proper image to a bitmap and display it on the screen.
Since one of the 2 images is always selected it made the contrast code easy, again based on the 'scaled' flag.
When the contrast option is clicked I apply the adjustment directly to the currently selected(and visible image) and then select the non visible image, apply the same adjustment and then reselect the visible image  without ever switching the visible image.  Works like a champ.

To see it work simply unzip and replace the mapview.iwb file in my original upload with this one.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Egil

March 18, 2015, 02:18:12 AM #43 Last Edit: March 18, 2015, 06:27:04 AM by Egil
Now it works much better than I ever expected Larry!

Leaving for Oslo right now, but I'll return tonight (it's 0920 local time now), and will check it out more then.

Was going to Oslo this morning for a meeting, but as soon as I got out of the plane in Oslo, I received a message saying that the meeting had been postponed...
Had to wait several hours for a plane back home. I just hate days like this. >:(


Regards,
Egil.
Support Amateur Radio  -  Have a ham  for dinner!

talun

Hi Larry,

   the file mapview.zip contains only the compiled version and not the source code.....

bye

Sergio

LarryMc

I really just meant to post the exe but just wrote the wrong words; but no harm.
The source code is going to change in the next few minutes.
I've started working on how to put the little airplanes on the screen with what I have learned.

Egil:
Approx how many data points are to expecting to have displayed on the screen and how often are you expecting all the data points to be updated?
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Brian

Larry,

If you look at flightradar.com, as I have just done done, and zoom out to show the whole world,
it was showing 1,500 of 11,742 possible aeroplanes!

So, quite a lot, and if you do load flightradar up, you will see that the displayed planes
are sized according to the plane's size, and even shows little helicopters as well

Brian

LarryMc

And Egil is wanting to plot all that  AND ground stations?
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Brian

Larry,

Well, I did include everything, ground stations, aircraft on the ground, etc, just to see how many,
so just tracking in-flight planes, and maybe just around northern europe, may be easier

And it depends on what radar beacons you are tracking, as well

Brian

LarryMc

I created a little plane pic and  used a random num generator for pos
It puts a 1,000 and 10,000 on there instantaneously.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library