Page 1 of 1
Scale for added bitmap
Posted: 04 Oct 2011, 17:25
by nicolasjul
Hi,
I need to show a dxf file and add bitmaps on it.
This bitmaps are 16x16 pixels images.
How to be sure the bitmap will be visible and with a good scale compare to scale and zoom of dxf file ?
TIA
Nicolas
Re: Scale for added bitmap
Posted: 10 Oct 2011, 11:29
by Mikhail Zhilin
Hi Nicolas,
if you want to add bitmap to existing TsgCADdxfImage object, you should use TsgCADdxfImage.AddScaledDXFEx method. This method adds the drawing as TsgDXFInsert object into the current TsgCADdxfImage. Specify AScale parameter in order to set the scale for added bitmap. You can control visibility of added bitmap using TsgDXFInsert.Visible property or set its scale in the X, Y and Z directions using TsgDXFInsert.Scale property.
Mikhail
Re: Scale for added bitmap
Posted: 11 Oct 2011, 18:01
by nicolasjul
Hi Mikhail,
Well, with your sample, I can add an image.
But how to know what scale use to do my 16x16px bitmap visible (not too little or not too large) on my TsgCADdxfImage object ?
How to dynamically adjust bitmap scale compare to TsgCADdxfImage object scale ?
Re: Scale for added bitmap
Posted: 12 Oct 2011, 11:01
by nicolasjul
Just another information : my 16x16px bitmap represents a door on the plan.
Is it possible to mesure the door size and adapt this data to bitmap size ?
Re: Scale for added bitmap
Posted: 13 Oct 2011, 17:08
by support
Hello Nicolas.
The size of added raster image can be set in drawing units. Please add the bitmap as TsgDXFImageEnt entity for this purpose:
Code: Select all
var
vImageDef: TsgDXFImageDef;
vImageEnt: TsgDXFImageEnt;
begin
vImageDef := TsgDXFImageDef.Create;
vImageDef.FileName := 'raster_filename_and_path';
Img.Converter.Loads(vImageDef);
if vImageDef.Picture.Graphic <> nil then
begin
Img.Converter.Sections[csImageDefs].AddEntity(vImageDef);
vImageEnt := TsgDXFImageEnt.Create;
vImageEnt.ImageDef := vImageDef;
vImageEnt.Point := MakeFPoint(100, 100, 0);
vImageEnt.UVector := cnstXOrtAxis;
vImageEnt.VVector := cnstYOrtAxis;
vImageEnt.Size := vImageEnt.ImageDef.Size;
vImageEnt.Width := 60;
if Assigned(Img.Converter.OnCreate) then
Img.Converter.OnCreate(vImageEnt);
Img.Converter.Loads(vImageEnt);
Img.CurrentLayout.AddEntity(vImageEnt);
end
else
vImageDef.Free;
Img.GetExtents();
Alexander.
Re: Scale for added bitmap
Posted: 14 Oct 2011, 00:05
by nicolasjul
ok, I'll try that.
thanks.