ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 acces to ieuimage
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

klausdoege

Germany
389 Posts

Posted - Sep 12 2012 :  03:41:07  Show Profile  Reply
Hello,
how can I access individual pixels of ieuimage ?

Klaus
www.klausdoege.de

w2m

USA
1990 Posts

Posted - Sep 12 2012 :  05:12:59  Show Profile  Reply
What do you mean access he pixels? Change a pixels color or transparency? Use scanline for some procedure?

William Miller
Go to Top of Page

klausdoege

Germany
389 Posts

Posted - Sep 12 2012 :  14:20:28  Show Profile  Reply
I will read the pixelcolor, but ieuimage.scanline is not available
could you make a Example

Klaus
www.klausdoege.de
Go to Top of Page

w2m

USA
1990 Posts

Posted - Sep 12 2012 :  17:15:11  Show Profile  Reply
Get the pixel colors and alpha values:

procedure TFormMain.ImageEnViewMouseMove(Sender: TObject; Shift: TShiftState; X, Y: integer);
begin
  iBX := ImageEnView.XScr2Bmp(X);
  iBY := ImageEnView.YScr2Bmp(Y);
  // Show current color and alpha values
  CurrentPenColor1.Color := ImageEnView.IEBitmap.Canvas.Pixels[iBX, iBY]
  CurrentBrushColor1.Color := ImageEnView.IEBitmap.AlphaChannel.Canvas.Pixels[iBX, iBY];
LabelAlpha1.Caption := 'Alpha: ' + IntToStr(ImageEnView.IEBitmap.Alpha[iBX, iBY]);
end;


Set the pixel colors and alpha values:

procedure TFormMain.ImageEnViewMouseMove(Sender: TObject; Shift: TShiftState; X, Y: integer);
begin
  iBX := ImageEnView.XScr2Bmp(X);
  iBY := ImageEnView.YScr2Bmp(Y);
 iPenTransparency := PenAlpha1.EditValue;
 iBrushTransparency := BrushAlpha1.EditValue;
 if (DrawButton.Down) and ImageEnView.MouseCapture then 
 // Paint color and alpha
 begin
   ImageEnView.Proc.SaveUndoCaptioned('PaintPen ' + IntToStr(ImageEnView.Proc.UndoCount + 1));
    Undo1.Hint := 'Paint Pen ' + IntToStr(ImageEnView.Proc.UndoCount + 1);
    iPoint.X := ImageEnView.XScr2Bmp(X);
    iPoint.Y := ImageEnView.YScr2Bmp(Y);
    ImageEnView.HighlightedPixel := iPoint;
    ImageEnView.IEBitmap.Canvas.Pixels[iBX, iBY] := dxPenColorGallery1.ColorValue;
    ImageEnView.IEBitmap.AlphaChannel.Canvas.Pen.Color := $02000000 or (iPenTransparency) or (iPenTransparency shl 8)
              or (iPenTransparency shl 16);
    ImageEnView.IEBitmap.AlphaChannel.Canvas.Brush.Color := $02000000 or (iBrushTransparency) or (iBrushTransparency shl 8) or (iBrushTransparency shl 16);
    ImageEnView.IEBitmap.AlphaChannel.Canvas.Pixels[iBX, iBY] := dxPenColorGallery1.ColorValue;
    ImageEnView.IEBitmap.Alpha[iBX, iBY] := iBrushTransparency;
    ImageEnView.Bitmap.Modified := True;
    ImageEnView.Update;
end;
end;


TIP: Look the the source code in the simple GDIPLus demo that shipped with my EBook.... or in the ImageEnViewDrawBackBuffer demo shipped with my EBook or my Icon editor in samples.
William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Go to Top of Page

klausdoege

Germany
389 Posts

Posted - Sep 13 2012 :  04:24:28  Show Profile  Reply
Hello William,
thank you for the detailed examples.
But it is already clear to me as I alter the colors in the current picture.
But I would like to access the image stored with ImageEnView.Proc.SaveUndoCaptioned(ieuimage),
the old color-value from the Undo image reads.
I hope understands something I mean.

Klaus
www.klausdoege.de
Go to Top of Page

w2m

USA
1990 Posts

Posted - Sep 13 2012 :  06:22:47  Show Profile  Reply
Klaus,

I do not understand what you are trying to tell me.


William Miller
Go to Top of Page

klausdoege

Germany
389 Posts

Posted - Sep 13 2012 :  08:43:07  Show Profile  Reply
William,

1. ImageEnView.IO.loadfromfile('cccc.xx')
2. ImageEnView.Proc.SaveUndoCaptioned(ieuimage)
3. ImageEnView.proc.blur(2.5);
4. I Paint on the image every what
5. Imageenview.pro.negative
.
.
But now, I would like to put back some pixel-areas again however.
An example would be:
for x:=10 to 100 do
ImageEnView.iebitmap.pixels[x,100] := Imagenview.ieuimage.pixels[x,100];
But the command Imagenview.ieuimage.pixels[x,100]; is not existing.
How I can realize this.

Klaus
www.klausdoege.de
Go to Top of Page

w2m

USA
1990 Posts

Posted - Sep 13 2012 :  10:31:04  Show Profile  Reply
Sorry Klaus, I still do not understand this. You load a file, save undo, blur the image, then paint on the image, then negative the image... then what? Do you want to reset the color of pixels 10 to 100? There is no such thing as ieuimage which has me confused...

oh... maybe you want to restore colors from part of the undoimage?

If that is the case I do not think it is possible with undo. Your best approach may be to create a TIEBitmap, copy the original image.IEBitmap to the TIEBitmap and then change the colors by accessing the temporary TIEBitmap?

var
iIEBitmap: TIEBitmap;
i: integer;
begin
  iIEBitmap := TIEBitmap.Create;
  try  
    ImageEnView.IO.loadfromfile('cccc.xx');
    // Copy the image to iIEBitmap 
    iIEBitmap.Assign(ImageEnView.IEBitmap);
    // Blur the image
    ImageEnView.Proc.Blur(2.5); 
    ...Paint on the image
    // Apply a negative filter
    ImageEnview.Proc.Negative;
    // Copy the pixel colors from iIEBitmap (the original image) to 
    // ImageEnView.IEBitmap
    for i := 10 to 100 do 
     ImageEnView.IEBitmap.pixels[i,100] := iIEBitmap.pixels[i,100]; 
    ImageEnView.Update;
  finally
    iIEBitmap.Free;
   end;
end;

end;


William Miller
Go to Top of Page

xequte

38609 Posts

Posted - Sep 13 2012 :  13:53:40  Show Profile  Reply
Hi

When you call ImageEnView.Proc.SaveUndoCaptioned('Contrasted', ieuImage), the original state of the image is saved to an internal object, which cannot be accessed externally, other than by calling Redo.



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

klausdoege

Germany
389 Posts

Posted - Sep 14 2012 :  07:06:47  Show Profile  Reply
William,
yes exactly that mean I.
Bad luck that not on the undoimage can be grabbed.
Redo brings back everything, I would not like that in this case.
Nevertheless thank you for your effort

Klaus
www.klausdoege.de
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: