• Welcome to Vampyre Imaging Library Forum. Please login or sign up.
 

Post reply

Other options

Shortcuts: ALT+S save/post or ALT+P preview

Topic summary

Posted by davem
 - 20 April 2010, 16:10:02
Quote from: Galfar on 20 April 2010, 15:33:20
What about calling Canvas.Release or Canvas.Refresh after the pixels are set?


Canvas.Refresh did not help. I haven't tried Canvas.Release.
Posted by Galfar
 - 20 April 2010, 15:33:20
What about calling Canvas.Release or Canvas.Refresh after the pixels are set?
Posted by davem
 - 20 April 2010, 10:12:50
Hmm, Synchronize seems to solve the issue. But I don't know why.  :-\
Posted by davem
 - 20 April 2010, 09:48:03
  I got very interesting problem. I manipulate an image using TImageData however then I need to add a text and modify a few pixels manually. So I do this:

        ImgBitmap:=TImagingBitmap.Create;
        ImgBitmap.AssignFromImageData(MainImage);

        // add text (just an example)
        ImgBitmap.Canvas.TextOut(x,y,'some text');

        // set some colors (just an example)
        ImgBitmap.Canvas.Pixels[x,y]:=col;

        // save the changes back to ImageData
        ImgBitmap.AssignToImageData(MainImage);
        ImgBitmap.Free;

  However, my problem is that in some cases (let's say every fifth case) the changes of colors are not visible on the picture when I save it. It seems to me that the Canvas/Handle hasn't been updated yet at the moment I assign the bitmap back to ImageData. Sometimes the part of the image is even partially black. Does anyone have any idea what can be done? I tried to put sleep behind, I tried to use a CriticalSection (it is multithreading appl), I tried to Lock the canvas (although the ImgBitmap is not shared) however nothing works. I also tried to run only one thread but it was the same. Does anyone have any idea?
SMF spam blocked by CleanTalk