Tuesday, February 27, 2018

RGB Color Viewer - 2 - c sharp

RGB color viewer in c#
(Displays RGB colors and let them pick)
(Written by me in c# 2010)
.
A few decades ago I made an application in html/JScript in windows 98 running over Pentium 2 for viewing all colors available in 24bit RGB. Result was excellent and exciting. I was able to watch all possible colors in one place so easily. Plus it was so colorful also. Then a few years ago I repeated that application in c# and this time I did that for viewing all 32bit ARGB colors. Result of this time was exciting again.
Every thing was going so fine and ok but suddenly a problem arises. Problem I was facing was that I was not able to find lighter or darker color easily for selected RGB color by scrolling Red, Green or Blue color values.  Then I stumbled upon HSB/HSL color space and my problem got solved. But then new problem started. This time problem was to get any color in RGB color space and then get it's lighter or darker shade in HSB/HSL color space. So I made an application in c# for doing so. During that process I made some other utility applications as well.
One of those application was to display HSB colors with ability to copy selected color to clipboard. In that application colors were displayed via 2 colored rectangles. First I called Z box and initially used that for displaying Hue of HSB color. Second I called XY box and initially used that for displaying Brightness and Saturation of HSB color. During that process I found that by changing assignments for XYZ axis in both boxes, color view in XY box becomes interestingly different.
After that I made another application, this time for RGB color space. And I am sharing code for this RGB color space application here.
..
Salient features of application:
In this application colors are displayed vie 2 color boxes. One is called Z box and other is called XY box. Initially Blue color is assigned to Z box. Green color is assigned to Y of XY box and Red color is assigned to X of XY box. Color assignment for XY and Z can be changed via 'Axis' menu. Color can be selected by mouse click, scrolling scroll bars or by entering values in Red, Green and Blue fields. Selected color's values are displayed in RGB and HSB section. Selected color can be copied to clipboard in decimal or hex format for bot RGB and HSB. All this is explained in 'How to use' and 'User Interface' of help menu'
.
Screen shots of 'RGB Color viewer' with description:
Following are screen shots of 'RGB Color viewer' at different stages with their description.
.
Application on Load:
'RGB Color viewer' looks like in the following image when it loads. Menus are on top line and status is at bottom line. Area in between them is divided in 2 columns.  In left column are 2 colored rectangles and 3 scroll bars. Rectangles display Red, Green and Blue part of RGB color. Scroll bars are for selecting value of respective color. In right column selected color information is displayed. At start Z is Blue, Y is Green and X is Red and their initial values are 175, 128, 128.
.
.

.
Help menu expanded:
'RGB Color viewer' looks like in the following image when help menu is clicked. Showing it's 5 options: About, Purpose, User interface, How to use and Copyright. Each option of help menu is shown and explained separately in following.
.
.

.
Help/About:
'RGB Color viewer' looks like in the following image when 'About' in 'Help' menu is clicked. This menu-item displays basic information about application and it's author.
.
.

.
Help/Purpose:
'RGB Color viewer' looks like in the following image when 'Purpose' in 'Help' menu is clicked. This menu-item displays text explaining purpose of the application.
.
.

.
Help/User interface:
'RGB Color viewer' looks like in the following image when 'User interface' in 'Help' menu is clicked. This menu option explains application's user interface as visible in following image.
.
.

.
Help/How to use:
'RGB Color viewer' looks like in the following image when 'How to use' in 'Help' menu is clicked. This menu option explains how to use this application as visible in following image.
.
.

.
Help/Copyright:
'RGB Color viewer' looks like in the following image when 'Copyright' in 'Help' menu is clicked. This menu-item displays copyright text for this application.
.
.

.
Help/Axis:
'RGB Color viewer' looks like in the following image when 'Axis' menu is clicked. Showing it's 6 options with all possible color combinations for xyz axis. Clicking on any of these options updates colors of xyz axis.
.
.

.
Colors for axis changed:
'RGB Color viewer' looks like in the following image when 'RGB (ZXY)' is clicked in 'Axis' menu. Colors for X, Y and Z axis are changed and Z and XY boxes are updated.
.
.

.
Help/Copy:
'RGB Color viewer' looks like in the following image when 'Copy' menu is clicked. This menu allows copying to clipboard RGB or HSB values in decimal or hex.
.
.

.
Outputs for all Axiz values:
I liked the look of colors in XY box when I changed axis values from 'Axis' menu and enjoyed as well. All options from 'Axis' menu gave good looking result. Screen shot of 'RGB Color viewer' for all axis values when values for Red, Green and Blue are set to 128 are displayed in following images.
.
XYZ:
'RGB Color viewer' looks like in the following image when axis is set to XYZ by clicking 'RGB (XYZ)' in 'Axis' menu.
.
.

.
XZY:
'RGB Color viewer' looks like in the following image when axis is set to XZY by clicking 'RGB (XZY)' in 'Axis' menu.
.
.

.
YXZ:
'RGB Color viewer' looks like in the following image when axis is set to YXZ by clicking 'RGB (YXZ)' in 'Axis' menu.
.
.

.
YZX:
'RGB Color viewer' looks like in the following image when axis is set to YZX by clicking 'RGB (YZX)' in 'Axis' menu.
.
.

.
ZXY:
'RGB Color viewer' looks like in the following image when axis is set to ZXY by clicking 'RGB (ZXY)' in 'Axis' menu.
.
.

.
ZYX:
'RGB Color viewer' looks like in the following image when axis is set to ZYX by clicking 'RGB (ZYX)' in 'Axis' menu.
.
.

.
[Note: During first posting] During development I gave this application 'Color-Model-RGB-Space-RGB-2' as name but during writing this post I used 'RGB-Color-Viewer-2' as it's name. In it's next version I will use 'RGB-Color-Viewer-x'' as it's name during development also.
[Note: 2018 02 27 Tue _ PST 05:52 PM] LoL by mistake during development (for changing name of project) I gave it 'RGB_Color_Viewer_01' name but in this post I used 'RGB-Color-Viewer-2' as it's name. I am not going to change anything (project's name or post's title) any more.
.
Enjoy Complete Source code of application written and compiled in visual studio 2010 Ultimate by me. Download it. Extract it. Read 'ReadMeFirst.txt' file and do as is explained in it.



Saturday, February 17, 2018

Pakistan International Highway

Pakistan International Highway - PIH
(Pakistan's proposed international level highway)
.
While watching travel videos, reading travel blogs and thinking and researching on highways in Pakistan and creating multilevel highway system for Pakistan in my mind an idea visited my mind to have an another type of highway called 'Pakistan International Highway' to connect Pakistan's neighboring countries with each-other via Pakistan.
Before I give details of idea first look at the map of Pakistan as shown in "Fig: 1". On one side of Pakistan is sea and on other sides are four countries. Through PIH we will connect all 4 neighboring countries and sea with each other.
Map of Pakistan
.
Now look at the abstract map of Pakistan as shown in "Fig: 2" I made to make things easy to make. On one side of Pakistan is sea and on other sides are four countries.
Map of Pakistan (abstract)
.
During process of understanding think Pakistan looks like a pentagon. A pentagon with a circle (cyan circle) in it's center and 5 other circles (black circles) one each on middle of it's each sides. All circles on center of pentagon's sides connected to the circle on pentagon's center.
Black circles on the sides of pentagon are international exit/entry check-points on the border. Cyan circle in the middle of pentagon is highway intersection, connecting all PIH sections 'sub-highways' together.
Now transform Pakistan's pentagon like abstract map  to the actual map of Pakistan and PIH will adjust according to this transformation also. Result will be actual highway on actual map. As simple as it is.
People with valid documents eg passport/visa(a kind of transit visa) etc will enter from one check-point and exit from other check-point without getting out of this highway system. There will be enough basic amenities like hotels, camping sites and petrol pumps etc beside this highway system to make sure there will be no need for highway users to get out of highway system. People with normal visa will be able to get out of highway system and re enter at specified/allowed points.
I made different ideas at different times about how this highway will be made:
First idea was to make this highway entirely as an underground highway. This was looking very secure but highly expensive idea.
Second idea was to make this highway as a bridge throughout it's length and cover it in an iron cage on it's left, right and top throughout it's length. This was also secure and expensive idea.
Third idea was to make this highway by utilizing already existing highways and roads. This was less secure and more cheap idea.
Fourth idea was to make this highway based on conveyor belt. This was also expensive and complicated idea with interesting possibilities.
Fifth, and last so far, idea was to make this highway of totally new roads with basic amenity centers beside it through out it's length. Irrespective of it's cost, so far this looks good/best to me.
All vehicles using PIH will need to have GPS system installed and enabled and running on them so that their current location can be known to PIH authority through out journey.
PIH users will need to pay some fees as per their use of PIH. Plus basic amenities beside PIH will not be for free either.
PIH users will also need international standard driving license and travel insurance for using PIH.
.

If there are any mistakes then I will surely remove them whenever found.

.
.


Friday, February 2, 2018

Happy 6000 PageViews - (2018 Feb 02 Fri)


C O N G R A T U L A T I O N S
Today
On 2018 Feb 02 Fri
my this Blog reached 6000 page views mark.
A lot of THANKS to
Visitors, Viewers, Readers and Wanderers.
Please keep visiting this blog
and
Tell others about it.
Congratulations to me also.