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
 ImageEnVect draw in unit of 0.001mm

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
Kostas Posted - Aug 10 2011 : 07:43:28
Hello,

How can I draw a circle with diameter=45.356mm X=747,865mm Y=69,956mm
is there an example?

Thanks Kostas
6   L A T E S T    R E P L I E S    (Newest First)
Kostas Posted - Aug 15 2011 : 03:57:25
Hi fabrizio,

a thousand thanks for the great help.
Now everything works perfectly and very quickly.
ImageEnVect needs only 16 ticks to draw everything.

Have a nice day.
Kostas
fab Posted - Aug 14 2011 : 15:21:01
Please look at the corrections I have done on the first post. You have to divide dpi by 25.4 not, by 2.54 (your measures are in mm not in cm).
With this correction a 50x50mm image will have 500x500 pixels, while a 500x500mm will have 5000x5000 pixels.
If you need larger bitmaps you have to write this before resize:

ImageEnVect1.LegacyBitmap:=false; // means: don't use TBitmap

Or reduce the DPI value.
Kostas Posted - Aug 14 2011 : 14:20:30
Hi fabrizio,

The result looks good now.
But is it the right way?

If i set TargetExtent = 500.0 mm
gets the error "EOutOfResources"

{----------------------------}
{}procedure TForm1.DrawTarget;
{----------------------------}
const
  dpi = 254;
  multi = dpi / 2.54;
  TargetExtent = 50.0; //50.0mm

var h, tx:integer;

begin
  tx := Round(TargetExtent * multi);

  ImageEnVect1.RemoveAllObjects;

  ImageEnVect1.Proc.ImageResize(tx ,tx); <---------

  //draw a box
  h := ImageEnVect1.AddNewObject;
  ImageEnVect1.ObjKind[h] := iekBOX;
//  ImageEnVect1.ObjPenWidth[h] := Round(0.05 * multi);
  ImageEnVect1.SetObjRect(h, Rect(0, 0, tx, tx));

  AddRingEx(0.0, 0.0, 45.5, TargetExtent);
  AddRingEx(0.0, 0.0, 40.5, TargetExtent);
  AddRingEx(0.0, 0.0, 35.5, TargetExtent);
  AddRingEx(0.0, 0.0, 30.5, TargetExtent);
  AddRingEx(0.0, 0.0, 25.5, TargetExtent);
  AddRingEx(0.0, 0.0, 20.5, TargetExtent);
  AddRingEx(0.0, 0.0, 15.5, TargetExtent);
  AddRingEx(0.0, 0.0, 10.5, TargetExtent);
  AddRingEx(0.0, 0.0, 5.5, TargetExtent);
  AddRingEx(0.0, 0.0, 0.5, TargetExtent);

  ImageEnVect1.Zoom := ImageEnVect1.GetIdealZoom * 0.9;




end;{DrawTarget}

{------------------------------------------------------}
{}procedure TForm1.AddRingEx(x,y,d,TargetExtent:double);
{------------------------------------------------------}
var h: integer;
    r: double;
begin
  r := (d / 2.0);

  h := ImageEnVect1.AddNewObject;

  ImageEnVect1.ObjKind[h] := iekELLIPSE;
//  ImageEnVect1.ObjPenWidth[h] := Round(0.05 * multi);

  ImageEnVect1.SetObjRect(h, Rect(Round((x + (TargetExtent / 2) - r) * multi),
                                  Round((y + (TargetExtent / 2) - r) * multi),
                                  Round((x + (TargetExtent / 2) + r) * multi),
                                  Round((y + (TargetExtent / 2) + r) * multi)));
end;{AddRingEx}


thanks a lot,
Kostas

fab Posted - Aug 11 2011 : 09:08:27
Hi,
you can set the bitmap size with:

ImageEnView.Proc.ImageResize(trunc(WidthInMM*mult), trunc(HeightInMM*mult));

Of course you have to fill WidthInMM and HeightInMM variables with the right values (in mm).

It is possible to do the same with TImageEnVect. Just create vectorial objects (iekELLIPSE) with the right sizes.
Note that the background image must be still of the right size (use ImageResize).
Kostas Posted - Aug 11 2011 : 05:59:09
Hi Fabrizio,

thanks for quick answer.
Excuse for my bad English.

If I use these values, I see nothing although i zoom in and out.
X := 747.865; Y := 69.956; diameter := 45.356;

But i see what if i use this values.
x := 0.5; y := 0.5; diameter := 4.356;

Is that a extends problem? how can set the right extends?
Is it possible to draw in a ImageEnVect?
I want draw a Target for air pistol.

procedure TForm1.Button1Click(Sender: TObject);
var dpi:integer;
    X,Y,diameter,mult:double;
begin

// Suppose 254 dpi (chosen to avoid decimals)
// This means that 254 pixels = 2.54mm (1 inch = 2.54mm)
// Hence 100 pixels = 1mm
dpi := 254;
ImageEnView1.IO.Params.DPI := dpi;

// now draw the circle multiplying each value by 100 (dpi / 2.54)
x := 0.5;
y := 0.5;
diameter := 4.356;

//X := 747.865;
//Y := 69.956;
//diameter := 45.356;

mult := dpi / 2.54;
Label1.caption := IntToStr(ImageEnView1.ExtentX);
Label2.caption := IntToStr(ImageEnView1.ExtentY);

//Ellipse required integer!
  with ImageEnView1.IEBitmap.Canvas do
    Ellipse(Round(X*mult), Round(Y*mult), Round((x+diameter)*mult), Round((y+diameter)*mult));
  ImageEnView1.Update();

end;



Regards, Kostas
fab Posted - Aug 10 2011 : 10:06:41
Hello,
supposing you have to create an image that when "printed" will contain this circle, you could write:

// Suppose 254 dpi (chosen to avoid decimals)
// This means that 254 pixels = 25.4mm (1 inch = 2.54cm)
// Hence 10 pixels = 1mm
dpi := 254;
ImageEnView1.IO.Params.DPI := dpi;

// now draw the circle multiplying each value by 10 (dpi / 25.4)
X := 747.865;
Y := 69.956;
diameter := 45.356;
mult := dpi / 25.4;
with ImageEnView1.IEBitmap.Canvas do
  Ellipse(X*mult, Y*mult, (x+diameter)*mult, (y+diameter)*mult);
ImageEnView1.Update();

I supposed that there is already an image with the right sizes.
This code DOES NOT "display" a circle with the correct sizes, but should "print" with the right sizes.