Printing Inverted Characters - General Discussion and Assistance - CHDK Forum

Printing Inverted Characters

  • 6 Replies
  • 6614 Views
Printing Inverted Characters
« on: 04 / February / 2008, 15:26:42 »
Advertisements
With twin-camera  stereo rigs, one of the cameras is sometimes inverted in order to get the lenses closer together.

So, I need to print inverted characters   :)

All character and string printing routines ultimately call a 'draw_pixel' routine.

That routine can be user-specified (such as 'draw_pixel_buffered') or it can be 'draw_pixel_std'

In the 'draw_char' routine in gui_draw.c, I have simply changed the order of printing the character rows from 0 to 15 to 15 to 0.

My displayed text strings have not changed at all !

Do you know why ?

Also, what is the purpose of the second buffer  in the character routines, it does not seem to be used ?


Thanks.


David

*

Offline GrAnd

  • ****
  • 916
  • [A610, S3IS]
    • CHDK
Re: Printing Inverted Characters
« Reply #1 on: 05 / February / 2008, 01:49:08 »
Did you try using "draw_pixel" proc like the following?

Code: [Select]
static void draw_pixel_inverted(unsigned int offset, color cl) {
    [color=green]offset = screen_size - offset;[/color]
    frame_buffer[0][offset] = frame_buffer[1][offset] = cl & 0xff;
}
CHDK Developer.

Re: Printing Inverted Characters
« Reply #2 on: 05 / February / 2008, 04:12:12 »
Did you try using "draw_pixel" proc like the following?

Code: [Select]
static void draw_pixel_inverted(unsigned int offset, color cl) {
    [color=green]offset = screen_size - offset;[/color]
    frame_buffer[0][offset] = frame_buffer[1][offset] = cl & 0xff;
}



I will try that.

Why are there two frame-buffers, what does the buffer starting at the location pointed-to by buffer[1] do ?

*

Offline GrAnd

  • ****
  • 916
  • [A610, S3IS]
    • CHDK
Re: Printing Inverted Characters
« Reply #3 on: 05 / February / 2008, 04:48:41 »
It is unknown which frame buffer is active now. So, CHDK just draws the same pixels to the both.
CHDK Developer.


Re: Printing Inverted Characters
« Reply #4 on: 06 / February / 2008, 05:06:26 »
Did you try using "draw_pixel" proc like the following?


It worked very well, thanks.

I changed the 'draw-pixel' procedure depending on the status of the orientation sensor.

One other question regarding video frame buffers .........

What is the function of the following ?  :-

vid_get_viewport_live_fb
vid_get_bitmap_fb
vid_get_viewport_fb
vid_get_viewport_fb_d


What is difference between 'viewport'   and 'bitmap'  ?


Thanks.


David

*

Offline GrAnd

  • ****
  • 916
  • [A610, S3IS]
    • CHDK
Re: Printing Inverted Characters
« Reply #5 on: 06 / February / 2008, 05:15:59 »
*_bitmap - OSD buffer
*_viewport - buffer of live/preview picture

vid_get_viewport_live_fb - buffer of live picture when shoot button is not pressed.
vid_get_viewport_fb - buffer of live picture when shoot button is (half-)pressed.
vid_get_viewport_fb_d - buffer of picture in play mode
CHDK Developer.

Re: Printing Inverted Characters
« Reply #6 on: 22 / September / 2008, 16:05:37 »
Hi GrAnd,

I tried to use vid_get_viewport_fb_d in PLAY mode on SD1000, but I believe that this address is valid only when you turn the camera on, switch from REC to PLAY mode, or after you press MENU button in PLAY mode. If you move to next image on the SD card in PLAY mode, some other memory location is used for a display viewport buffer.

I tried to hook on histogram code to display some true color images on a viewport using hiker_jon's load_viewport code; it works fine the first time, but nothing happens after I move to another image in PLAY mode; if I press MENU, or switch from PLAY to REC and back, it works again. Do you have any ideas what memory locations are used for viewport when we scroll through photos in play mode? Thanks for any suggestions.

 

Related Topics