Allegro.pas and Canvas lazarus / 39-Graphics ---------------------------------------------------------------------- eoneuk · 2014-12-14 13:07 Is it possible to use Allegro.pas to draw either pixels or shapes directly on a canvas? I can use Allegro, but it is in its own separate window.  I want to use it within a form. Was not successful in finding any information either on the internet or in this forum.  Any help or guidance will be appreciated. Ed ---------------------------------------------------------------------- User137 · 2014-12-14 16:11 I can't imagine that it would. Allegro was originally made for games, and Canvas based techniques are nearly always too slow for that. I don't know details of the pascal's allegro, if it is just a wrapper to old DOS-based library? ---------------------------------------------------------------------- Never · 2014-12-14 16:56 i'm pretty sure you can do what you want since Allegro supports several different types of bitmaps [ http://allegro-pas.sourceforge.net/docs/4/intro.html ] @Ñuño Martínez can assist you more have a look here [ http://www.pascalgamedevelopment.com/showthread.php?5100-Show-a- bitmap-on-a-TPaintBox&highlight=allegro+canvas ] ---------------------------------------------------------------------- Ñuño_Martínez · 2014-12-18 10:15 Somebody called me?  About Allegro.pas 4 In short: Yes, it is possible. The long answer: There's an example in subdirectory "examples/lazarus" but it is not fast because it just copies each pixel.  Actually that example is very uneficent and I'm sure it can be improved a lot (IIRC there are a way to write directly in to the TImage data, which should be lot faster as you can avoid screen update until you finished the work). Theoretically, there are some Allegro's functions that allows to "transport" an Allegro bitmap to a structure that can be used directly by desktop API.  Unfortunately I wasn't able to make it run on Free Pascal, and I have no idea why.  Also, it would force to use OS dependent code (it's not the same Windows than Linux than MacOS...) and I really hate to use and write OS dependent code, so I didn't tried again. About Allegro.pas 5 beta (and SVN) Actually I have no idea if it's possible.  Allegro 5 defines a whole new API, that includes multiple window management, and I'm not familiar and comfortable with it (that explains why Allegro.pas 5 is still unfinished and unstable),  Anyway, I think it should be possible.  Allegro 5 allows to use OpenGL, so if you create an OpenGL context in your TForm may be you're able to use Allegro.pas to upload textures to the OpenGL server. A sort of disclaimer I really want to work more on Allegro.pas (both versions 4 and 5), but sadly I'm very busy right now.  Anyway I do some upgrades time to time uploading them to the SVN repository (TRUNK for version 4, BRANCHES/5 for version 5), and I'm glad that people uses it and asks about problems, because it helps me to improve the library.  So keep up the work, and may be we found an improvement and a new version of Allegro.pas would be released soon. ---------------------------------------------------------------------- marcov · 2014-12-18 11:21 What is the attraction of Allegro? I never really understood that. ---------------------------------------------------------------------- Ñuño_Martínez · 2014-12-18 16:16 I'm not sure that I've understood your question. Allegro 4 had an "old school API" (bitmaps, sprites, MIDI ...), and it's simpler than SDL. Also deployment is simpler as only one dynamic library file is needed. Allegro 5 has a modern style API (hardware accelerated graphics, state-based implementation, event-based responses...), but also simpler than SDL (in my humble opinion, but I still prefer the old API).  Deployment, though, is much more complex on Windows as there are different compilation options than results on different dynamic library file distribution (different quantity and naming).