📄 textoverlay.c
字号:
/*****************************************************************************************/
//
// Name: BF561 EZ-KIT video streamer based on DMA interaction
//
/*****************************************************************************************
(C) Copyright 2003 - Analog Devices, Inc. All rights reserved.
File Name: TextOverlay.c
Date Modified: 8/26/04 TL Rev 1.1
Software: VisualDSP++3.5, Compiler 7.0.7.0, Assembler 2.6.5.3, Linker 3.4.0.0
Hardware: BF561 EZ-KIT Board (rev 1.2)
******************************************************************************************/
#include "font.h" // Font taken for the Textoverlay
#include "main.h"
/*****************************************************************************************/
// Program Define Section
/*****************************************************************************************/
/*****************************************************************************************/
// Program Variable Section
/*****************************************************************************************/
volatile unsigned short BGcolor = 0xFFFF; // Textbackground will be filled before placing text
unsigned short font_offset,font_image_size;
unsigned char *font, *font_w;
/*****************************************************************************************/
// Global and extern subroutines
/*****************************************************************************************/
/*****************************************************************************************/
// Program
/*****************************************************************************************/
void TextOverlay(void){
unsigned short color, error=0,posx,posy;
unsigned short lCnt,lCnt1,lCnt2,lCnt3;
clear_vmem(BGcolor); // fills the whole buffer with a color (Background color)
register_font(arial, arial_w); // handles the distance of the letters
put_string("Analog Devices Video HandlerAAAAAA", 0 ,0,0x00FF); // takes the actual string to print
}
//Clear display memory
void clear_vmem(unsigned short color){
unsigned short lCnt;
unsigned short error=0;
for (lCnt = 0; lCnt < sizeof(uiTextOverlay); lCnt++)
{
*(pMem+lCnt/2) = color;
}
}
//One pixel at position (x,y)
inline void plot_xy(unsigned short x,unsigned short y,unsigned short color){
*(pMem + ( ( y * (S1D_DISPLAY_WIDTH ) ) + x )) = color;
}
unsigned short put_char (unsigned char c, unsigned short x, unsigned short y, unsigned short color) {
unsigned short start_pos,lCntx,lCnty;
unsigned char value,mask = 0x80;
start_pos = font_offset + (c%16)*2 + (((c/16)+1)*512);
for (lCnty=16 ; lCnty > 0 ; lCnty-- ){
mask = 0x80;
value = font[start_pos];
for (lCntx=0 ; lCntx < font_w[c]+1 ; lCntx++ ){
if ( (value & mask)) plot_xy( x+lCntx, y+lCnty, color );
mask = mask >> 1;
if ( !mask ) {
mask = 0x80;
value = font[start_pos+1];
}
}
start_pos-=32;
}
return (font_w[c]+x);
}
void register_font(unsigned char *rfont,unsigned char *rfont_w) {
font_offset= rfont[10] + (rfont[11] << 8) + (rfont[12] << 16) + (rfont[13] << 24);
font_image_size = rfont[18] + (rfont[19] << 8) + (rfont[20] << 16) + (rfont[21] << 24);
font = &rfont[0];
font_w = &rfont_w[0];
}
// Writes a zero terminated string to the specified display position
unsigned short put_string(unsigned char *string, unsigned short x,unsigned short y,unsigned short color ) {
while(*string) {
x=put_char(*string,x,y,color);
string++;
}
return(x);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -