Changing the color of one pixel in a image loaded into TImage. lazarus / 39-Graphics ---------------------------------------------------------------------- T-bear · 2011-04-05 09:38 Is it possible to change the color of one pixel in the picture that is loaded into a TImage? Thanks! ---------------------------------------------------------------------- typo · 2011-04-05 09:44 Yes. Which pixel? ---------------------------------------------------------------------- T-bear · 2011-04-05 09:45 I dont know. Can i do that with coordinates or something? ---------------------------------------------------------------------- typo · 2011-04-05 09:47 Yes. Code: [Select]Image1.Canvas.Pixels[1,1] := clBlack; ---------------------------------------------------------------------- T-bear · 2011-04-05 09:48 Thanks ---------------------------------------------------------------------- T-bear · 2011-04-05 16:08 And can I Change the color of every pixel in the picture to one color without doing that pixel by pixel ---------------------------------------------------------------------- typo · 2011-04-05 17:37 Code: [Select]Image1.Canvas.Brush.Color := clBlack; Image1.Canvas.Pen.Color := clBlack; Image1.Canvas.Rectangle(0,0, Image1.Width, Image1.Height); ---------------------------------------------------------------------- T-bear · 2011-04-05 17:46 Thanks! Now i have just got a little problem. When the form is created it makes all the TImages to blue. That works fine. Code: [Select]Buttons[Counter].Canvas.Brush.Color := clBlue; Buttons[Counter].Canvas.Pen.Color := clBlue; Buttons[Counter].Canvas.Rectangle(0,0, Buttons[Counter].Width, Buttons[Counter].Height); But when i want to change the color when the image is clicked with this code Code: [Select]Buttons[H].Canvas.Brush.Color := BColor.ButtonColor; Buttons[H].Canvas.Pen.Color := BColor.ButtonColor; Buttons[H].Canvas.Rectangle(0,0, Buttons[H].Width, Buttons[H].Height); it doesnt work, and i get exeption class External SIGSEGV. And the code where it is in the row if not FUseParentCanvas and (FPicture.Graphic = nil) then   begin   //...   end; Whats going on now? Thanks! ---------------------------------------------------------------------- typo · 2011-04-05 17:52 Debug the code and find what line causes the error. ---------------------------------------------------------------------- T-bear · 2011-04-05 18:00 if not FUseParentCanvas and (FPicture.Graphic = nil) then  // I think it's this. This line is highlighted when i press ok at the errormessage.   begin     //...   end; The File is CustomImage.Inc and in a comment at the beginning it says " This file is part of the Lazarus Component Library (LCL)                   See the file COPYING.modifiedLGPL.txt, included in this distribution,    for details about the copyright.                                                                                                                 This program is distributed in the hope that it will be useful,        but WITHOUT ANY WARRANTY; without even the implied warranty of          MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                    "                                                                          I think tits the unit for ExtCtrls or something... ---------------------------------------------------------------------- typo · 2011-04-05 18:24 The problem is not on that file, but in your code. Try to understand why the operation indicated there could not be made and change your code in order to make it possible.