flat assembler
Message board for the users of flat assembler.

Index > IDE Development > Need Color Selector Design

Author
Thread Post new topic Reply to topic
AsmGuru62



Joined: 28 Jan 2004
Posts: 1409
Location: Toronto, Canada
AsmGuru62
Hi everyone,

I am into Color Management in my IDE and I need a nicely looking
Color Selector thingy. At first I wanted to use the standard Windows
Color Dialog, but it looks dated (is it 1995 again?).

So, I am looking to design a custom made selector, where I can pick
any color from a full range of Win32 COLORREF element. I have something
in mind and it goes like that:

1. A square control with each side = 256 pixels
2. A slider on the side of the control - also it has 0-255 range

This way each of two sides of the control represent a color
component and slider is a third component. I can assign component
to a slider, say RED, then the other two components (GREEN,BLUE) will be
automatically placed on sides of the control (and mixed on its surface).

So, by clicking on the surface of the square I can get the mix of
two colors from the sides plus the color from slider. This way I plan
to get the full COLORREF for every color possible in Windows.

Of course, I can use the slider and see the color change as I slide.
Or I can leave slider alone and drag mouse within the surface.

This is basic design.
Does anyone have any ideas?
Maybe some existing color selectors I can 'steal' design from? Smile
Any screenshots are welcome, of course!
Post 22 Jun 2011, 16:11
View user's profile Send private message Send e-mail Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3500
Location: Bulgaria
JohnFound
I have to design one for FreshLib as well. But it is not with great priority for me. The problem of the color selector is actually "3D navigation problem". There are many approaches to solve this problem. IMHO the windows selector is not the worst of them.
Several considerations:
1.It is good to have option for manual encoding - if you know what you need. Moreover it is good to support several models: RGB, HSL (HSV)
2. What about alpha-channel?
3. It looks that HSL color model is more "human-centric", so maybe the visual picker is better to be HSV oriented.
Post 22 Jun 2011, 16:29
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1409
Location: Toronto, Canada
AsmGuru62
Thanks.
Manual will be there - user can type values in.
I will take a look at HSV design.
Post 22 Jun 2011, 16:57
View user's profile Send private message Send e-mail Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 764
Location: Massachusetts, USA
bitshifter
The good thing about using the "dated" API color box
is that everyone will be farmilliar with what/how it works.
This is good reason to stick with standard API boxes.

If you want to mod the box, supply hook when creating it.
Then you can tweak it until your heart (or eyes) are content.
Post 22 Jun 2011, 17:20
View user's profile Send private message Reply with quote
asmhack



Joined: 01 Feb 2008
Posts: 431
asmhack
chill you don't have to design a new color box from the scratch, for an IDE.
Code:
fOrMat Pe Gui
entry @@entry
include 'win32a.inc'

section '' import data code writable readable executable
library kernel32,'kernel32',comdlg32,'comdlg32'
include 'api\kernel32.inc'
include 'api\comdlg32.inc'

@@entry:
mov    [cc.lpCustColors],cc.lpCustColors
mov    [cc.lStructSize],9*4 Wink
mov    [cc.Flags],$2 ;CC_FULLOPEN
invoke ChooseColor,cc
;test   eax,eax
;jz     cancel

invoke ExitProcess,0

struc CHOOSECOLOR
{ .lStructSize     dd $0
  .hwndOwner       dd $0
  .hInstance       dd $0
  .rgbResult       dd $0 ;COLOR
  .lpCustColors    dd $0
  .Flags           dd $0
  .lCustData       dd $0
  .lpfnHook        dd $0
  .lpTemplateName  dd $0 }

  cc CHOOSECOLOR 
    











Image
who will guess from witch app is the above screnshot.?? Razz
Post 23 Jun 2011, 00:28
View user's profile Send private message Reply with quote
madmatt



Joined: 07 Oct 2003
Posts: 1045
Location: Michigan, USA
madmatt
Here is a small masm example I converted to fasm that may help you develop your own color picker. Unfortunately, no comments in the code.


Description: Color Box
Download
Filename: Colors.zip
Filesize: 7.25 KB
Downloaded: 225 Time(s)

Post 23 Jun 2011, 11:34
View user's profile Send private message Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1409
Location: Toronto, Canada
AsmGuru62
It is more fun to create it than use some other code!
Post 23 Jun 2011, 13:11
View user's profile Send private message Send e-mail Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3500
Location: Bulgaria
JohnFound
An idea. As long as in the 1pixel field is very hard to select one particular color, it can be done with "magnifying glass" type navigation. When the cursor enters the 256x256 field zoom window appears under the cursor and the pixels are displayed as a 8x8 squares.
Post 23 Jun 2011, 13:25
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1409
Location: Toronto, Canada
AsmGuru62
I like that idea!
Post 23 Jun 2011, 17:36
View user's profile Send private message Send e-mail Reply with quote
Enko



Joined: 03 Apr 2007
Posts: 678
Location: Mar del Plata
Enko
Image

For my abandoned IconEditor project I had to create to custom window controls. One for color picker and the other for the HUE color selection.

In the source, there are 3 windows procs. Main windows, the HUE selector and the Color Picker.


Description:
Download
Filename: IconEditor.7z
Filesize: 21.75 KB
Downloaded: 230 Time(s)

Post 23 Jun 2011, 23:47
View user's profile Send private message Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1409
Location: Toronto, Canada
AsmGuru62
Good stuff, Enko! Thanks.
Post 24 Jun 2011, 13:02
View user's profile Send private message Send e-mail Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.