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

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Help ! ImageEnMView on ImageEnView

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Boban Posted - Nov 05 2012 : 20:51:54
Hi

What should I change in this code to add or to obtain a left vertikal and top border as shown on the right and bottom ?
----------------------------------------------------------------------
var
i:integer;
x, y:integer;
bmp:TIEBitmap;
begin

ImageEnView1.IEBitmap.Allocate(ImageEnMView1.ClientWidth + MaximumViewX, Form2.Image1.ClientHeight + MaximumViewY);
x := ImageEnMView1.CalcGridWidth() * (ImageEnMView1.ThumbWidth + ImageEnMView1.HorizBorder);
y := ImageEnMView1.CalcGridHeight() * (ImageEnMView1.ThumbHeight + ImageEnMView1.VertBorder);
ImageEnView1.Proc.ImageResize(x, y);
ImageEnView1.Proc.Fill(ColorDialog1.Color);

x := 0;
y := 0;
for i:=0 to ImageEnMView1.ImageCount-1 do
begin
bmp := ImageEnMView1.GetTIEBitmap(i);
bmp.RenderToTIEBitmapEx(Form2.Image1.IEBitmap, x, y, ImageEnMView1.ThumbWidth, ImageEnMView1.ThumbHeight, 0, 0, bmp.Width, bmp.Height, 255, rfTriangle);
ImageEnMView1.ReleaseBitmap(i);
inc(x, ImageEnMView1.ThumbWidth + ImageEnMView1.HorizBorder);
if x > ImageEnView1.IEBitmap.Width - ImageEnMView1.ThumbWidth then
begin
x := 0;
inc(y, ImageEnMView1.ThumbHeight + ImageEnMView1.VertBorder);
if y > ImageEnView1.IEBitmap.Height then
break;
end;
end;

ImageEnView1.Update;
end;
===========================================================================================


12   L A T E S T    R E P L I E S    (Newest First)
Boban Posted - Nov 14 2012 : 00:58:31
Hi William

I tried this in my error logs. I tried to correct, but I failed.

w2m Posted - Nov 13 2012 : 11:16:13
You are calling RenderToTIEBitmapEx so there is no way to add a softshadow to each thumbnail. You would have to apply a AImageEnView.Proc.AddSoftShadow(5, 4, 4, True) to each thumbnail then draw each thumbnail on a canvas.

So you would have to extract each bitmap from ImageEnView, create a thumbnail of specified dimensions, apply a softwhadow to the thumbnail, then draw each thumbnail in a canvas with spacing large enough so the shadow is visible.

Some along the lines of: (UNTESTED CODE)
x := ImageEnMView1.CalcGridWidth * (ImageEnMView1.ThumbWidth +   ImageEnMView1.HorizBorder);
  y := ImageEnMView1.CalcGridHeight * (ImageEnMView1.ThumbHeight + ImageEnMView1.VertBorder);
 // Create the main image bitmap
 Form2.Image1.IEBitmap.Allocate(x + ASpacing, y + 60);
 Form2.Image1.Proc.Fill(ColorDialog1.Color);
// get each image and process it
for i := 0 to ImageEnMView1.ImageCount-1 do
begin
  // Get the image from imageenview
  iBitmap := ImageEnMView1.GetBitmap[i];
  ImageEnView.ReleaseBitmap;
  // Create an ImageEnProc component
  iImageEnProc := TImageEnProc.Create(nil);
  // Set the attached bitmap
  iImageEnProc.AttachedIEBitmap := iBitmap;
  // Resamplethe bitmap to create a thumbnail
  iImangeEnProc.Proc.Resample();
  // add a softshadow to the bitmap
  iImangeEnProc.AddSoftShadow(5, 4, 4, True);
  // Draw each shadowed thumbnail on the base bitmap canvas
  Form2.Image1.IEBitmap.Canvas.Draw();
end;
 iImageEnProc.Free;
 Form2.Image1.Update;
end;

William Miller
Boban Posted - Nov 13 2012 : 09:35:55
Hi William

I thought we CheckBox component is only an option for setting the shadow of ImageEnMView thumbnails ImageEnView. Or it does not have the ImageEnMView. Whether it be in this code to do that option or something else? Greetings.

procedure CreateThumbnailGrid(var ImageEnMView1: TImageEnMView; Image1: TImageEnView; ColorDialog1: TColorDialog; Memo1: TMemo; ASpacing: integer);
var
h, i: Integer;
iIEBitmap: TIEBitmap;
x: Integer;
y: Integer;
begin
Screen.Cursor := crHourGlass;
try
Form2.Image1.Clear;

x := ImageEnMView1.CalcGridWidth * (ImageEnMView1.ThumbWidth + ImageEnMView1.HorizBorder);
y := ImageEnMView1.CalcGridHeight * (ImageEnMView1.ThumbHeight + ImageEnMView1.VertBorder);
Form2.Image1.IEBitmap.Allocate(x + ASpacing, y + 60);

Form2.Image1.Proc.Fill(ColorDialog1.Color);

x := 0;
y := Memo1.ClientHeight - ASpacing;

// Memo1
Form2.Image1.IEBitmap.Canvas.Font := Memo1.Font;
h := Form2.Image1.IEBitmap.Canvas.TextHeight('Test');
for i := 0 to Memo1.Lines.Count - 1 do
Form2.Image1.IEBitmap.Canvas.TextOut(x+ASpacing, i * h, Memo1.Lines[i]);

for i := 0 to ImageEnMView1.ImageCount - 1 do
begin
iIEBitmap := ImageEnMView1.GetTIEBitmap(i);
iIEBitmap.RenderToTIEBitmapEx(Form2.Image1.IEBitmap, x + ASpacing, y + ASpacing,
ImageEnMView1.ThumbWidth - ASpacing, ImageEnMView1.ThumbHeight - ASpacing, 0, 0,
iIEBitmap.Width - ASpacing, iIEBitmap.Height - ASpacing, 255, rfTriangle);
ImageEnMView1.ReleaseBitmap(i);
inc(x, ImageEnMView1.ThumbWidth + ImageEnMView1.HorizBorder);
if x > Form2.Image1.IEBitmap.Width - ImageEnMView1.ThumbWidth then
begin
x := 0;
inc(y, ImageEnMView1.ThumbHeight + ImageEnMView1.VertBorder);
if y > Form2.Image1.IEBitmap.Height + Memo1.ClientHeight then
break;
end;
end;
Form2.Show;
Form2.Image1.Update;
finally
Screen.Cursor := crDefault;
end;
end;
------------------------------------------------------------------
Here's looking from another program.

w2m Posted - Nov 13 2012 : 08:25:12
Thre is no such thing as a ImageEn checkbox component.

William Miller
Boban Posted - Nov 12 2012 : 19:15:34
Thank you William

How can I add a SoftShadow on the thumbnails to ImageEnView CheckBox component ?

w2m Posted - Nov 12 2012 : 17:57:08
You have to expand the height of the bitmap by the height of the text here:
ImageEnView1.IEBitmap.Allocate(x + 5, y + 55); // just a guess


William Miller
Boban Posted - Nov 12 2012 : 11:46:42
Thank you William
That's what I needed.

But again I was stuck when placing text from (Memo component) I got this look like the figure below the bottom of the picture is cropped. To the extent that the above is added to the text so the image cut down. Where now I made a mistake in this code?




procedure CreateThumbnailGrid(var ImageEnMView1: TImageEnMView; Image1: TImageEnView; ColorDialog1: TColorDialog; Memo1: TMemo; ASpacing: integer);
var
h, i: Integer;
iIEBitmap: TIEBitmap;
x: Integer;
y: Integer;
begin
Screen.Cursor := crHourGlass;
try
ImageEnView1.Clear;

x := ImageEnMView1.CalcGridWidth * (ImageEnMView1.ThumbWidth + ImageEnMView1.HorizBorder);
y := ImageEnMView1.CalcGridHeight * (ImageEnMView1.ThumbHeight + ImageEnMView1.VertBorder);
ImageEnView1.IEBitmap.Allocate(x + ASpacing, y + ASpacing);

ImageEnView1.Proc.Fill(ColorDialog1.Color);

x := 0;
y := Memo1.ClientHeight - ASpacing;

// Memo1
ImageEnView1.IEBitmap.Canvas.Font := Memo1.Font;
h := ImageEnView1.IEBitmap.Canvas.TextHeight('Test');
for i := 0 to Memo1.Lines.Count - 1 do
ImageEnView1.IEBitmap.Canvas.TextOut(3, i * h, Memo1.Lines[i]);

for i := 0 to ImageEnMView1.ImageCount - 1 do
begin
iIEBitmap := ImageEnMView1.GetTIEBitmap(i);
iIEBitmap.RenderToTIEBitmapEx(ImageEnView1.IEBitmap, x + ASpacing, y + ASpacing,
ImageEnMView1.ThumbWidth - ASpacing, ImageEnMView1.ThumbHeight - ASpacing, 0, 0,
iIEBitmap.Width - ASpacing, iIEBitmap.Height - ASpacing, 255, rfTriangle);
ImageEnMView1.ReleaseBitmap(i);
inc(x, ImageEnMView1.ThumbWidth + ImageEnMView1.HorizBorder);
if x > ImageEnView1.IEBitmap.Width - ImageEnMView1.ThumbWidth then
begin
x := 0;
inc(y, ImageEnMView1.ThumbHeight + ImageEnMView1.VertBorder);
if y > ImageEnView1.IEBitmap.Height + Memo1.ClientHeight then
break;
end;
end;

ImageEnView1.Update;
finally
Screen.Cursor := crDefault;
end;
end;
w2m Posted - Nov 08 2012 : 18:16:15
I do not understand what you are trying to describe.

The spaceing between all the cells is the same here.

Here is a method to draw the grid where you can set the spacing:
procedure CreateThumbnailGrid(var AImageEnMView: TImageEnMView; AImageEnView: TImageEnView; ASpacing: integer);
var
  i: Integer;
  iIEBitmap: TIEBitmap;
  x: Integer;
  y: Integer;
begin
  Screen.Cursor := crHourGlass;
  try
    AImageEnView.Clear;
    x := AImageEnMView.CalcGridWidth * (AImageEnMView.ThumbWidth + AImageEnMView.HorizBorder);
    y := AImageEnMView.CalcGridHeight * (AImageEnMView.ThumbHeight + AImageEnMView.VertBorder);
    AImageEnView.IEBitmap.Allocate(x + ASpacing, y + ASpacing);
    AImageEnView.Proc.Fill(clBlack);
    x := 0;
    y := 0;
    for i := 0 to AImageEnMView.ImageCount - 1 do
    begin
      iIEBitmap := AImageEnMView.GetTIEBitmap(i);
      iIEBitmap.RenderToTIEBitmapEx(AImageEnView.IEBitmap, x + ASpacing, y + ASpacing,
        AImageEnMView.ThumbWidth - ASpacing, AImageEnMView.ThumbHeight - ASpacing, 10, 10,
        iIEBitmap.Width - ASpacing, iIEBitmap.Height - ASpacing, 255, rfTriangle);
      AImageEnMView.ReleaseBitmap(i);
      inc(x, AImageEnMView.ThumbWidth + AImageEnMView.HorizBorder);
      if x > AImageEnView.IEBitmap.Width - AImageEnMView.ThumbWidth then
      begin
        x := 0;
        inc(y, AImageEnMView.ThumbHeight + AImageEnMView.VertBorder);
        if y > AImageEnView.IEBitmap.Height then
          break;
      end;
    end;
    AImageEnView.Update;
  finally
    Screen.Cursor := crDefault;
  end;
end;


To use it:
procedure TForm1.ThumbnailGrid1Click(Sender: TObject);
// Create a grid of thumbnails
var
  iSpacing: integer;
  sSpacing: string;
begin
  sSpacing := InputBox('Spacing', 'Enter Grid Spacing', '5');
  iSpacing := StrToIntDef(sSpacing, 5);
  CreateThumbnailGrid(ImageEnMView1, ImageEnView1, iSpacing);
end;


39.65 KB Spacing = 5


38.76 KB Spacing = 10

William Miller
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Boban Posted - Nov 07 2012 : 18:35:23
Hi William

It's okay but it works in my program i have set for vertikal and horizontal adjustement between the frames so that when you set the vertikal and horizontal spacing, then the left and right edges remains the same unchanged always the same width. Is this in the above code can be changed by setting the vertical and horizontal spacing automatically changes the left and upper edges to be the same as that between the frames? Thank you in advance.

w2m Posted - Nov 06 2012 : 07:01:59

39.66 KB
var
  i: integer;
  x, y: integer;
  bmp: TIEBitmap;
begin
  Screen.Cursor := crHourGlass;
  try
    ImageEnView1.Clear;
    x := ImageEnMView1.CalcGridWidth() * (ImageEnMView1.ThumbWidth + ImageEnMView1.HorizBorder);
    y := ImageEnMView1.CalcGridHeight() * (ImageEnMView1.ThumbHeight + ImageEnMView1.VertBorder);
    ImageEnView1.IEBitmap.Allocate(x + 5, y + 5);
    ImageEnView1.Proc.Fill(clBlack);
    x := 0;
    y := 0;
    for i := 0 to ImageEnMView1.ImageCount - 1 do
    begin
      bmp := ImageEnMView1.GetTIEBitmap(i);
      bmp.RenderToTIEBitmapEx(ImageEnView1.IEBitmap, x+5 , y+5 , ImageEnMView1.ThumbWidth- 5,
        ImageEnMView1.ThumbHeight - 5, 10, 10, bmp.Width-5, bmp.Height-5, 255, rfTriangle);
      ImageEnMView1.ReleaseBitmap(i);
      inc(x, ImageEnMView1.ThumbWidth + ImageEnMView1.HorizBorder);
      if x > ImageEnView1.IEBitmap.Width - ImageEnMView1.ThumbWidth then
      begin
        x := 0;
        inc(y, ImageEnMView1.ThumbHeight + ImageEnMView1.VertBorder);
        if y > ImageEnView1.IEBitmap.Height then
          break;
      end;
    end;
    ImageEnView1.Update;
  finally
    Screen.Cursor := crDefault;
end;

William Miller
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Boban Posted - Nov 06 2012 : 04:41:42
Hi

I miss the left vertical edge and the upper edge of the horizontal orange as it is one the right and on the bottom of the picture.
xequte Posted - Nov 06 2012 : 01:31:12
Hi

From a quick review of your code i don't see anything particularly wrong with it. What problem do you get with it?



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com