From 8f407f8a1ab2adf08c438f40cd797fef8a810dae Mon Sep 17 00:00:00 2001 From: dscho Date: Fri, 5 Oct 2001 20:19:35 +0000 Subject: extracted font routines from example --- example.c | 61 +++---------------------------------------------------------- 1 file changed, 3 insertions(+), 58 deletions(-) (limited to 'example.c') diff --git a/example.c b/example.c index da01d7a..64e4d6c 100644 --- a/example.c +++ b/example.c @@ -139,59 +139,6 @@ void doptr(int buttonMask,int x,int y,rfbClientPtr cl) /* aux function to draw a character to x, y */ #include "radon.h" -int drawchar(unsigned char* buffer,int rowstride,int bpp,int x,int y,char c) -{ - int i,j,k,width,height; - unsigned char d; - unsigned char* data=bdffontdata+bdffontmetadata[c*5]; - width=bdffontmetadata[c*5+1]; - height=bdffontmetadata[c*5+2]; - x+=bdffontmetadata[c*5+3]; - y+=bdffontmetadata[c*5+4]-height+1; - - for(j=0;joldx,y1=cd->oldy,x2,y2; if(cl->screen->cursorIsDrawn) rfbUndrawCursor(cl); - cd->oldx+=drawchar(cl->screen->frameBuffer, - cl->screen->paddedWidthInBytes,bpp,cd->oldx,cd->oldy, - key); - bdfbbox(key,&x1,&y1,&x2,&y2); + cd->oldx+=rfbDrawChar(cl->screen,&radonFont,cd->oldx,cd->oldy,key,0xffffff); + rfbFontBBox(&radonFont,key,&x1,&y1,&x2,&y2); rfbMarkRectAsModified(cl->screen,x1,y1,x2-1,y2-1); } } @@ -299,7 +244,7 @@ int main(int argc,char** argv) rfbScreen->httpDir = "./classes"; initBuffer(rfbScreen->frameBuffer); - drawstring(rfbScreen->frameBuffer,maxx*bpp,bpp,20,100,"Hello, World!"); + rfbDrawString(rfbScreen,&radonFont,20,100,"Hello, World!",0xffffff); /* This call creates a mask and then a cursor: */ /* rfbScreen->defaultCursor = -- cgit v1.2.3