Hmmmm... Your suggestion is interesting but I don't know much about TBGRABitmap or if it can be applied to this case. What I have is a long text file that has information about various pixels in a TImage which is assigned to a bitmap and then to a TLazIntfImage (or TBGRABitmap). The number of entries in the text file don't usually equal the number of pixels in the image.
Each entry in the text file represents a pixel in the image and each entry provides x and y. An example of an entry is shown below. The second line in the sample entry gives a particular color. Lines 5 and 6 respectively provide x and y of the image pixel to be changed. The 7th line provides another color. The program uses these colors to produce a third color. The code I'm currently using looks something like the code shown below following the sample file entry.
I could have some part of the program count the number of entries in the file and then use that count number instead of useing while not eof(readfile). Can you think of a way to apply TBGRABitmap to this case?
Thank you so much for helping me. The last few times that I have asked for help on this forum I received some solutions that were of critical importance to me.
6
clWhite
337
148
94
18
clBlue
while not eof(readfile) do //or for i := to 1 to numberofentries do
begin
//the program reads each entry in the text file to get 2 colors along with x and y
//code which uses those 2 colors to produce a third color
lazcolor := TColorToFPColor(thirdcolor);
lazimage.colors[x,y] := lazcolor; //the line that sometimes fails but not always
end;