Custom Colors : standardizing a semi-transparent grey - page 10 - General Discussion and Assistance - CHDK Forum
supplierdeeply

Custom Colors : standardizing a semi-transparent grey

  • 106 Replies
  • 33185 Views
*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: Custom Colors : standardizing a semi-transparent grey
« Reply #90 on: 01 / November / 2014, 16:50:17 »
Advertisements
The user adjustable colors are stored as two Canon color values (background & foreground) - once set they no longer get adjusted as the mode changes. They are the output of the MAKE_COLOR macro so are fixed values.

Ideally the user should be able to select colors that adjust for mode on the fly, or fixed Canon colors if they prefer. We need some way of handling this for the conf colors.

Phil.
I understand. conf.menu_color need fix values. We use an index of chdk colors for that:
Code: [Select]
#define CHDK_COLOR_... ( 0..18 )
For safety split type color to type color for canon palette colors and for chdk colors. The previous color macros works now only for chdk colors:
Code: [Select]
//index of fg or bg
typedef unsigned char   chdk_color_id;
//mixed fg_index and bg_index
typedef unsigned short  chdk_color;
 
#define MAKE_CHDK_COLOR(bg, fg)  ((chdk_color)((((chdk_color_id)(bg))<<8)|((chdk_color_id)(fg))))
#define FG_COLOR_ID(bgfg)     ((chdk_color_id)(bgfg & 0xFF))
#define BG_COLOR_ID(bgfg)     ((chdk_color_id)(bgfg >> 8))
Building drawing colors required always function make_color() or make_color_bg(). A function should be better for integrate in module part.
Code: [Select]
color function make_color_bf(chdk_color_id bg, chdk_color_id fg) {
return ([chdk_colors + bg]<<8)|[chdk_colors + fg];
}

color function make_color(chdk_color bgfg) {
return make_color_bg(BG_COLOR_ID(bgfg), FG_COLOR_ID(bgfg));
}

I use an other concept on rewriting gps part (new: single task and splitting drawings as preparing for module building):
Code: [Select]
//use script_colors[NUM_SCRIPT_COLORS][2] from gui_draw.c
#define GPS_COLOR( x )  ( script_colors [( x )][camera_info.state.mode_rec] )

enum {
    GPS_COLOR_TRANSPARENT,
    GPS_COLOR_BLACK,
    GPS_COLOR_WHITE,
    GPS_COLOR_RED,
    GPS_COLOR_RED_DK,
    GPS_COLOR_RED_LT,
    GPS_COLOR_GREEN,
    GPS_COLOR_GREEN_DK,
    GPS_COLOR_GREEN_LT,
    GPS_COLOR_BLUE,
    GPS_COLOR_BLUE_DK,
    GPS_COLOR_BLUE_LT,
    GPS_COLOR_GREY,
    GPS_COLOR_GREY_DK,
    GPS_COLOR_GREY_LT,
    GPS_COLOR_YELLOW,
    GPS_COLOR_YELLOW_DK,
    GPS_COLOR_YELLOW_LT,
    GPS_COLOR_GRAY_DK_TRANS,
} gps_colors;
using:
Code: [Select]
compass.col2 = MAKE_COLOR(GPS_COLOR(GPS_COLOR_BLACK), GPS_COLOR(GPS_COLOR_BLACK));
questions:
- Why named COLOR_GRAY_DK_TRANS? The now used color value is LT_TRANS.
- Why we not also replace the ICON and HISTO color constants with defined colors?

rudi

Thanks for that, there's some interesting ideas here. I started working on it so I'll see where this helps.

The DK_TRANS name was chose because a transparent light grey made the OSD text too hard to read against a bright image behind it. A transparent dark grey was chosen instead.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

Re: Custom Colors : standardizing a semi-transparent grey
« Reply #91 on: 01 / November / 2014, 17:03:11 »
The DK_TRANS name was chose because a transparent light grey made the OSD text too hard to read against a bright image behind it. A transparent dark grey was chosen instead.
Also,  I think both msl and I tweaked the values to exactly match the transparent grey used by Canon for their shooting mode value ( like the P letter in the upper right hand corner of the LCD ).
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: Custom Colors : standardizing a semi-transparent grey
« Reply #92 on: 01 / November / 2014, 22:48:48 »
Here's a patch that re-writes the CHDK color / palette handling to allow each camera to have different color sets for record and playback mode (as suggested in previous posts).

The CHDK colors are mapped to Canon colors through lookup tables that get selected based on mode (record / playback). There are 20 colors available for CHDK (including transparent dark grey).

This is a significant change, so is likely to have issues & bugs.

The record & playback palettes set up for cameras that don't use custom colors should be close to the current version; but may not be exactly the same.

All user adjustable colors will be reset when first running this version. Reverting back to the trunk (1.3) version may result in incorrect colors until the colors are reset.

The user adjustable colors can be set to either the CHDK colors, or actual Canon colors - the color selection UI has been updated to handle this.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

Re: Custom Colors : standardizing a semi-transparent grey
« Reply #93 on: 01 / November / 2014, 23:58:45 »
This is a significant change, so is likely to have issues & bugs.
I'm taking a really big breath and diving in ...

Update :  colors on the A560 are mostly okay with a few misses.   I'll see if I can figure out how to correct them.
« Last Edit: 02 / November / 2014, 00:23:55 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: Custom Colors : standardizing a semi-transparent grey
« Reply #94 on: 02 / November / 2014, 00:30:03 »
This is a significant change, so is likely to have issues & bugs.
I'm taking a really big breath and diving in ...

Update :  colors on the A560 are mostly okay with a few misses.   I'll see if I can figure out how to correct them.

See the new platform_palette.c file.

If you can let me know what the mistakes are I can see if it affects other cameras.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

Re: Custom Colors : standardizing a semi-transparent grey
« Reply #95 on: 02 / November / 2014, 00:43:36 »
See the new platform_palette.c file. If you can let me know what the mistakes are I can see if it affects other cameras.
Will do. 

FWIW - the existing colors were not great so you may very well have reproduced them accurately.  Sorry - I did not intend to imply there were mistakes.   

And mine is a $15 eBay purchase. The LCD on those old cams are now painful to look at regardless.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: Custom Colors : standardizing a semi-transparent grey
« Reply #96 on: 02 / November / 2014, 05:57:39 »
Update new palette patch.

This re-defines the 'color' data type into two types:
- color (unsigned char) for a single color
- twoColors (unsigned short) for combined background & foreground colors

Corresponding code cleanup for usage of above.

This is mainly for readability of the code.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

*

Offline msl

  • *****
  • 1280
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: Custom Colors : standardizing a semi-transparent grey
« Reply #97 on: 02 / November / 2014, 07:57:41 »
Thanks for your great work. I have seen no significant problems, tested with new_palette version 1.

There is a small problem with the override state color (also in version 2).

gui_osd.c:  line 150

'conf.osd_color_override' instead of 'conf.osd_color_warn'

msl
CHDK-DE:  CHDK-DE links


Re: Custom Colors : standardizing a semi-transparent grey
« Reply #98 on: 02 / November / 2014, 09:42:24 »
Updated version of platform_palette.c for the A560 attached.

The colors all look about as good as I think they are going to get.

One strange thing though - the text in the file select box (the one that lets you pick the script file) is yellow on transparent grey in both shooting and playback mode.  I've never seen that before and it's very hard to read.  I tried using the "Reset All Colors" and "Reset Options to Default..." but no luck.  The pop up box when you select options is all wrong too so I'm guessing this has something to do with it being in a module?

Update : I just checked - it does the yellow text thing with or without my changes to the platform_palette.c file.  Does that in the A1200 too. Something to do with this change I suspect :

Code: [Select]
//-------------------------------------------------------------------
@@ -429,8 +429,8 @@
     char buf[100];
     struct tm *time;
     unsigned long sum_size;
-    color cl_markered = (camera_info.state.mode_rec)?COLOR_YELLOW:0x66;
-    color cl_marked, cl_selected;
+    color cl_markered = COLOR_YELLOW;
+    twoColors cl_marked, cl_selected;
 
     if (gui_fselect_readdir)
     {
« Last Edit: 02 / November / 2014, 10:35:54 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline rudi

  • ***
  • 129
  • A590IS_101B, SX260HS_100B
Re: Custom Colors : standardizing a semi-transparent grey
« Reply #99 on: 02 / November / 2014, 15:17:42 »
Hi Phil,
very good solution and so fast!
I see at this time color problems only in message box and file selector.

rudi

 

Related Topics