Re: Suggestion for syntax-colored editors
- Posted by Derek Parnell <ddparnell at bigpond.com> May 18, 2004
- 556 views
Pete Lomax wrote: > > On Tue, 18 May 2004 04:23:11 -0700, Tommy Carlier > <guest at RapidEuphoria.com> wrote: > > > > >posted by: Tommy Carlier <tommy.carlier at pandora.be> > > > >I see syntax-coloring being used in MEditor, and in the IDE, and probably > >also in > other apps. I have a little suggestion. > > > >Blitting bitmaps is faster than drawing text. Why not generate a large bitmap > >and > draw all the standard keywords in their appropriate color on this bitmap, and > then > if you need to draw such a keyword, just blit it from the bitmap to the > editor? Wouldn't > this make the syntax coloring faster? > > I pass. Post a demo which proves it faster. ) > Maybe then I'll believe you. It certainly is faster and it reduces flickering on slower machines. Have a look at ex12.exw in the win32lib demo folder. > I took on Mike's editor and have done very little with the core > innards, such as display, concentrated more on up-front additions. > > To draw this to its logical conclusion, you need a bitmap for every > character in every colour, along with the several (standard keywords) > you mention side-by-side in one block, plus what next?- one for every > variable name in the current source perhaps? No you don't. You can use wPuts() and drawText() etc... on bitmaps (Pixmap) just the same as on a Window. The thing is it draws all this text and lines into RAM without rendering it on the display. When the RAM image of a display is ready you can call repaintFG() of the display window and its w32HPaint handler can call copyBlt() to blast it onto the screen all at once. Very fast. > MEditor is open source; feel free to modify it and just send the whole > kit and cabooble back; I'll sort it out no worries. If only I had time -- Derek Parnell Melbourne, Australia