На главную

On-line справка по Win32 API

Написать письмо
БЕСПЛАТНАЯ ежедневная online лотерея! Выигрывай каждый день БЕСПЛАТНО!
Список всех статей A-B-C-D-E-F-G-H-I-J-K-L-M-N-O-P-Q-R-S-T-U-V-W-X-Y-Z | Скачать Вниз

Enhanced Metafile Operations



A developer creates an enhanced metafile by using the CreateEnhMetaFile function and supplying the appropriate arguments. The Win32 API uses these arguments to maintain picture dimensions, to determine whether the metafile should be stored on a disk or in memory, and so on.

To maintain picture dimensions across output devices, the Win32 API requires the resolution of the reference device. This reference device is the device on which the picture first appeared, and the reference DC is the DC associated with the reference device. When calling the CreateEnhMetaFile function, the application must supply a handle that identifies this DC. The application can get this handle by calling the GetDC or CreateDC function or specify NULL as the handle to use the current display device for the reference device.

Most applications store pictures permanently and therefore create an enhanced metafile that is stored on a disk; however, there are some instances when this is not necessary. For example, a word-processing application that provides chart-drawing capabilities could store a user-defined chart in memory as an enhanced metafile and then copy the enhanced metafile bits from memory into the user's document file. An application that requires a metafile that is stored permanently on a disk must supply the filename when it calls the CreateEnhMetaFile function. If the developer does not supply a filename, Windows automatically treats the metafile as a temporary file and stores it in memory.

The developer can add an optional text description to a metafile containing information about the picture and the author. An application can display these strings in the File Open dialog box to provide the user with information about metafile content that will help in selecting the appropriate file. If an application includes the text description, the application must supply a pointer to the string when it calls the CreateEnhMetaFile function.
When the CreateEnhMetaFile function is successful, it returns a handle that identifies a special metafile DC. A metafile DC is unique in that it is associated with a file rather than with an output device. When Windows processes a GDI function that received a handle to a metafile DC, it converts the GDI function into an enhanced-metafile record and appends the record to the end of the enhanced metafile.

After a picture is complete and the last record is appended to the enhanced metafile, the application can close the file by calling the CloseEnhMetaFile function. This function closes and deletes the special metafile DC and returns a handle identifying the enhanced metafile. The application can use this handle to accomplish the following tasks.

· Display the picture stored in the enhanced metafile.
· Create copies of the enhanced metafile.
· Enumerate, edit, or copy the individual records in the enhanced metafile.
· Retrieve the optional description that is stored in the enhanced metafile.
· Retrieve a copy of the enhanced-metafile header.
· Retrieve a binary version of the enhanced metafile.
· Enumerate the colors in the optional palette.
· Convert an enhanced-format metafile into a Windows-format metafile.



Some applications create temporary backup (or duplicate) copies of a file before enabling the user to alter the original. An application can create a backup copy of an enhanced metafile by calling the CopyEnhMetaFile function, supplying a handle that identifies the enhanced metafile, and supplying a pointer to the name of the new file.
Most drawing, illustration, and computer-aided design (CAD) applications require a means of editing a picture stored in an enhanced metafile. Although editing an enhanced metafile is a complex task, a developer can use the EnumEnhMetaFile function in combination with other Win32 functions to provide this capability in your application. The EnumEnhMetaFile function and its associated callback function enable the application to process individual records in an enhanced metafile.

Some applications display the text description of an enhanced metafile with the corresponding filename in the File Open dialog box. An application can determine whether this string exists in an enhanced metafile by retrieving the metafile header and examining one of its members. The GetEnhMetaFileHeader function can retrieve the metafile header. If the string exists, the application retrieves it by calling the GetEnhMetaFileDescription function.

Some applications retrieve the contents of a metafile by calling the GetEnhMetaFileBits function; however, before retrieving the contents, the application must specify the size of the file. To get the size, the application can use the GetEnhMetaFileHeader function and examine the appropriate member.
To achieve consistent colors when a picture is displayed on various output devices, an application can call the CreatePalette function and store a logical palette in an enhanced metafile. Other applications that display the picture stored in the enhanced metafile retrieve this palette and call the RealizePalette function before displaying the picture. To determine whether a palette is stored in an enhanced metafile, an application can retrieve the metafile header and examine the appropriate member. If a palette exists, the application can call the GetEnhMetaFilePaletteEntries function to retrieve the logical palette.


Пригласи друзей и счет твоего мобильника всегда будет положительным!
Предыдущая статья
 
Сайт Народ.Ру Интернет
Следующая статья
Пригласи друзей и счет твоего мобильника всегда будет положительным!

Расширенные Действия Метафайла



Разработчик создает расширенный метафайл используя функцию CreateEnhMetaFile и поставляя подходящие аргументы. Win32 API Использует эти аргументы, чтобы поддерживать картинные измерения, чтобы определять должен метафайл быть загружен на диск или в памяти, и так далее.

Чтобы поддерживать картинные измерения через выходные устройства, Win32 API требует разрешение устройства ссылки. Это устройство ссылки является устройством на котором изображение сначала оказавшееся, и ссылка DC - DC связанное устройством ссылки. При вызове функции CreateEnhMetaFile, приложение должно поставить ручку, которая идентифицирует это DC. Приложение может получить эту ручку вызывая GetDC или CreateDC функционирует или определяет НЕДЕЙСТВИТЕЛЬНЫЙ как ручка, чтобы использовать текущее дисплейное устройство для устройства ссылки.

Большинство приложений загружают изображения навсегда и следовательно создают расширенный метафайл, который загружен на диск; тем не менее, есть некоторые примеры когда не необходимо. Например, текстовое-обрабатывающее приложение, которое обеспечивает диаграмму-чертеж возможностей могло бы загрузить определенную диаграмму пользователя в память как расширенный метафайл затем копирует расширенные биты метафайла из памяти в файл документа пользователя. Приложение, которое требует метафайл, который загружается навсегда на диске должно поставить filename когда это называет функцию CreateEnhMetaFile. Если разработчик не поставляет filename, Windows автоматически рассматривает метафайл как временный файл и загрузка это в памяти.

Разработчик может добавить дополнительное текстовое описание к метафайлу, содержащему информацию об изображении и автор. Приложение может отобразить эти строки в Файловом Открытом диалоговом блоке, чтобы обеспечивать пользователя информацией о содержимом метафайла, который поможет на выборе подходящего файла. Если приложение включает текстовое описание, приложение должно поставить указатель в строку когда оно называет функцию CreateEnhMetaFile.
Когда функция CreateEnhMetaFile имеет успех, она возвращает ручку, которая идентифицирует специальный метафайл DC. Метафайл DC уникальный в том, что это связано файлом а не с выходным устройством. Когда Windows обрабатывает функцию GDI, которая получала ручку в метафайл DC, это преобразовывает функцию GDI в расширенный-метафайл записывать и добавляет запись в конец расширенного метафайла.

После того, как изображение будет завершенно и последняя запись добавлена в расширенный метафайл, приложение может закрыть файл вызывая функцию CloseEnhMetaFile. Эта функция закрывает и удаляет специальный метафайл DC и возвращает ручку опознавая расширенный метафайл. Приложение может использовать эту ручку, чтобы выполнять следующие задачи.

Отображать изображение загруженное в расширенный метафайл.
Создавать копии расширенного метафайла.
Перечислять, редактировать, или копировать индивидуальные записи в расширенном метафайле.
Извлекать дополнительное описание, которое загружено в расширенный метафайл.
Извлекать копию расширенного метафайла заголовка.
Извлекать двоичную версию расширенного метафайла.
Перечислять цвета в дополнительной палитре.
Преобразование расширенный формат метафайла в метафайл формата Windows-.



Некоторые приложения создают временные копии копии (или дубликат) файла перед включением пользователя, чтобы изменять подлинник. Приложение может создать резервную копию расширенного метафайла вызывая функцию CopyEnhMetaFile, поставляющую ручку, которая идентифицирует расширенный метафайл, и поставляя указатель в имя нового файла.
Рисующая, иллюстрация, и приложения автоматизированного проектирования (САПР) требуют средства редактирования изображения загруженного в расширенный метафайл. Хотя редактируя расширенный метафайл является сложной задачей, разработчик может использовать функцию EnumEnhMetaFile в комбинации с другими функциями Win32, чтобы обеспечивать эту возможность в вашем приложении. EnumEnhMetaFile Функциональный и связанный возврат функционирует допустимый приложение, чтобы обрабатывать индивидуальные записи в расширенном метафайле.

Некоторые приложения отображают текстовое описание расширенного метафайла с соответствующим filename в Файловом Открытом диалоговом блоке. Приложение может определить что независимо эта строка существует в расширенном метафайле извлекая заголовок метафайла и проверки один из своих участников. Функция GetEnhMetaFileHeader может извлечь заголовок метафайла. Если строка существует, приложение извлекает это вызывая функцию GetEnhMetaFileDescription.

Некоторые приложения извлекают содержание метафайла вызывая функцию GetEnhMetaFileBits; тем не менее, перед поиском содержания, приложение должно определить размер файла. Чтобы получать размер, приложение может использовать функцию GetEnhMetaFileHeader и изучать подходящий элемент.
Чтобы достигать последовательных цветов когда изображение отображено на различных выходных устройствах, приложение может назвать функцию CreatePalette и загружать логическую палитру в расширенный метафайл. Другие приложения, которые отображают изображение загруженное в расширенный метафайл извлекать эту палитру и называть функцию RealizePalette прежде, чем отобразить изображение. Чтобы определять загружена палитра в расширенный метафайл, приложение может извлечь заголовок метафайла и изучать подходящий элемент. Если палитра существует, приложение может назвать функцию GetEnhMetaFilePaletteEntries, чтобы извлекать логическую палитру.


Вверх Version 1.3, Oct 26 2010 © 2007, 2010, mrhx Вверх
 mrhx software  Русский перевод OpenGL  Русский перевод Win32 API
 
Используются технологии uCoz