Define a bitmap inside the code lazarus / 39-Graphics ---------------------------------------------------------------------- Giuseppe Ridinò · 2004-04-26 20:50 I've got a problem and I hope you can give me a solution (I know that this problem may sound trivial,... but it ain't to me)  :oops: : How can I define a simple image without loading it from a file?  :arrow: For example: 1. I have a tile image, sized MxN 2. Each tile is taken from a small set of bitmaps, (let's say 1..Nt) 3. When my image should change I will copy the appropiate bitmap to the changed set.  :!: The point is that I don't want to load the bitmaps from a file, but I want to define them in the code, as a constant or in other way, something like: BitMap1: array[1..8,1..8] = (....); Any suggestion? Thanks in advance ---------------------------------------------------------------------- Giuseppe Ridinò · 2004-05-22 14:42 Please help me! I tryed the following: const   Data: array[0..7,0..7] of LongWord = (     ($0000FF, $0000FF,..... ),     .....   ) In this way I define the 8x8 icon with the needed Tcolors. Then I tryed: Icon:=TBitmap.Create; Icon.ReleaseHandle; Icon.Handle:=CreateBitMap(8,8,1,1,@Data); The application is compiled and runs, but when I try to copy this Icon using Image.Picture.Bitmap.Canvas.CopyRect I get wrong (... I mean unexpected for me) results. What's wrong? Thanks in advance for any help! ---------------------------------------------------------------------- Marc · 2004-05-25 10:45 Can you use a Imagelist ? ---------------------------------------------------------------------- RudieD · 2006-04-26 12:40 Last time I tried the ImageList, I could not replace the Bitmaps during runtime. I'll try it over the weekend again. If you don't want to change them during runtime, it works fine. ---------------------------------------------------------------------- Giuseppe Ridinò · 2006-04-27 10:06 Eheheh... this topic is a bit old! I will check these functionality ASAP since I think I will need them to recode my applications. ;-) ---------------------------------------------------------------------- Anonymous · 2006-04-27 12:28 Hello- I wrote some code that auto-generates a bitmap image: http://www.sph.sc.edu/comd/rorden/mricron/bounty/ I am not sure if this is what you want. For Windows, I was able to generate a Bitmap directly, but for universal code that works in Linux and Windows, I needed to use IntfGraphics and initially load a sample bitmap from a file. I doubt this is the most elegant solution, but maybe it is a starting point.