Questions about chdk source code ... for Devs. - page 2 - General Discussion and Assistance - CHDK Forum

Questions about chdk source code ... for Devs.

  • 15 Replies
  • 9852 Views
*

Offline m2tk

  • **
  • 50
  • Sheet happens ...
Re: Questions about chdk source code ... for Devs.
« Reply #10 on: 16 / April / 2008, 13:22:01 »
Advertisements
Q: are we able to make a transparent texts?
i mean really transparent, not the screen as a background.
sth like overlaping texts when bottom one is visible when top has a transparent background?
S5IS 1.01bc

*

Offline GrAnd

  • ****
  • 916
  • [A610, S3IS]
    • CHDK
Re: Questions about chdk source code ... for Devs.
« Reply #11 on: 16 / April / 2008, 15:50:08 »
Q: are we able to make a transparent texts?
i mean really transparent, not the screen as a background.
sth like overlaping texts when bottom one is visible when top has a transparent background?

If I understand your question you asking about drawing the text without overriding Canon text/icons?
I think it's impossible by hardware. There are two plains/layers: the image (live or preview picture) and bitmap (texts and icons). They overlays by hardware. If you want mix two layers of text you have to do it manually in bitmap buffer.
CHDK Developer.

*

Offline m2tk

  • **
  • 50
  • Sheet happens ...
Re: Questions about chdk source code ... for Devs.
« Reply #12 on: 17 / April / 2008, 14:49:43 »
Q: how to find an index of specific char in the array of chars? is there some func or do i need to use loops? any use of strchr()?

char_idx = stridx("ABCDEF", "D"); //char_idx = 3

sth like int idx = string.indexOf(char) in java

and Q2: how to pass\return string filename from fselect.c to mbox.c and back to fselect.c?
« Last Edit: 17 / April / 2008, 14:54:56 by m2tk »
S5IS 1.01bc

*

Offline GrAnd

  • ****
  • 916
  • [A610, S3IS]
    • CHDK
Re: Questions about chdk source code ... for Devs.
« Reply #13 on: 17 / April / 2008, 16:27:54 »
Q1: Hm... Yes, strchr().

Quote
Name
strchr, strrchr - locate character in string

Synopsis
char *strchr(const char *s, int c);
char *strrchr(const char *s, int c);

Description
The strchr() function returns a pointer to the first occurrence of the character c in the string s.
The strrchr() function returns a pointer to the last occurrence of the character c in the string s.

Return Value
The strchr() and strrchr() functions return a pointer to the matched character or NULL if the character is not found.

So it will return 0, if char is not found. It return value is not 0 and you want to know the index of char instead of having pointer to char, you can subtract the result and the string starting address.


Q2: Via pointer argument or global variable.
CHDK Developer.


*

Offline m2tk

  • **
  • 50
  • Sheet happens ...
Re: Questions about chdk source code ... for Devs.
« Reply #14 on: 20 / April / 2008, 14:15:09 »
hi,
as i can see frame buffer holds pixel color,
each cell can hold 1 of 256 different colors.

so if we know which are transparent and how to sum them we could make an overlaying of the icons and texts,
but how to find out what is the current color palette and how colors are build up?
i found at least 6 different color palettes.

palettes no. 2 and 3 seems the same (different transparent backgrounds)

Q: btw. why there are two frame_buffers [2] ?

edit: found three more...
« Last Edit: 20 / April / 2008, 14:24:33 by m2tk »
S5IS 1.01bc

*

Offline GrAnd

  • ****
  • 916
  • [A610, S3IS]
    • CHDK
Re: Questions about chdk source code ... for Devs.
« Reply #15 on: 20 / April / 2008, 15:23:14 »
as i can see frame buffer holds pixel color,
each cell can hold 1 of 256 different colors.

The palette itself is a kind of 16 color. As you can see it is diagonal symmetric. And it seems that each pixel is coded by nibble, not by byte. So the resolution is the same as for image buffer - 720x240. When we use the same nibbles (i.e. 0x11, 0x22, etc.), the color looks solid. Whet nibbles are different, it seems there is a dithering of colors.


Q: btw. why there are two frame_buffers [2] ?

Because one of them is active, and the other is non-visible. When Canon's firmware wants to draw something, it draws in the non-visible buffer and then exchanges (flips) the buffers. This helps to avoid flickering.
But CHDK does not know which buffer is active/non-visible at the moment, so CHDK draws in the both simultaneously.

CHDK Developer.

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal