Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2005.07.18;
Скачать: CL | DM;

Вниз

Ошибка при переводе Bmp в Wmf   Найти похожие ветки 

 
Dr. Genius   (2005-06-27 16:06) [0]

В переменной Bmp типа TBitmap хранится изображение с разрешением 800х600. Перевожу Bmp в Wmf по коду, выложенному ниже. Получается Wmf-файл с разрешением не 800х600, а 797х597. Почему так происходит и как решить эту проблему.

var
 Bmp: TBitmap;
 Metafile: TMetafile;
 MfCanvas: TMetafileCanvas;

...
...

 Metafile := TMetaFile.Create;
 Metafile.Width := Bmp.Width;
 Metafile.Height := Bmp.Height;
 MfCanvas := TMetafileCanvas.Create (Metafile, 0);
 try
   MfCanvas.Draw (0, 0, Bmp);
 finally
   MfCanvas.Free;
 end;
 Metafile.SaveToFile (‘Image.wmf");
 Metafile.Free;


 
-=XP=- ©   (2005-06-27 16:10) [1]

А визуально как? Обрезает или сжимает?


 
-=XP=- ©   (2005-06-27 16:11) [2]

И вообще, зачем этот перевод? Все равно растр хранится (если WMF это вообще позволяет - не помню).


 
Dr. Genius   (2005-06-27 16:50) [3]


> А визуально как? Обрезает или сжимает?


Сжимает.


> И вообще, зачем этот перевод? Все равно растр хранится (если
> WMF это вообще позволяет - не помню).


Я пишу программу для захвата экранных снимков с последующим сохранением их в файлы. Чем больше форматов будет поддерживаться программой - тем лучше.


 
lookin ©   (2005-06-27 17:06) [4]

Я не уверен, но:

constructor Create(AMetafile: TMetafile; ReferenceDevice: HDC);

Create sets the size of the TMetafile object from ReferenceDevice if it does not already have the MMHeight and MMWidth properties set. Create then creates a metafile device context, and sets the Handle property to its handle. All subsequent drawing methods will draw to the metafile device context.

И при этом:

property MMWidth: Integer;

MMWidth is used for a more accurate reading of the horizontal size of the graphic. The Width property, by contrast, is always in screen device pixel units; to avoid loss of precision in converting between device pixels and millimeters, set or read the dimensions in millimeters with MMWidth. The MMWidth property is always in screen device pixel units.

Может быть, эти две сточки из кода убрать?
Metafile.Width := Bmp.Width;
Metafile.Height := Bmp.Height;



Страницы: 1 вся ветка

Текущий архив: 2005.07.18;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.053 c
6-1113171232
Chubais
2005-04-11 02:13
2005.07.18
sendto проблемы!


1-1119618297
Alex_DM
2005-06-24 17:04
2005.07.18
Буфер DDE


1-1119851637
Vad74
2005-06-27 09:53
2005.07.18
Не работает Application.OnHelp в Delphi 6


1-1119693133
grol
2005-06-25 13:52
2005.07.18
Кнопка-компонент из 3 картинок (image ей)?


1-1119633216
Начинающий2
2005-06-24 21:13
2005.07.18
Несколько вопросов по шрифтам и еще один.