DevIL_manual (1265195), страница 3

Файл №1265195 DevIL_manual (Задания) 3 страницаDevIL_manual (1265195) страница 32021-08-18СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 3)

Specify a value of zero for Size if youdo not want ilLoadL to perform any bounds checking.3.3.5 Saving to FilesDevIL also has some powerful saving functions to fully complement the loading functions.ILboolean ilSaveImage(const char *FileName);ILboolean ilSave(ILenum Type, const char *FileName);ILboolean ilSaveF(ILenum Type, ILHANDLE File);ILboolean ilSaveL(ILenum Type, ILvoid *Lump, ILuint Size);DevIL’s saving functions are identical to the loading functions, despite the fact that theysave images instead of load images.

Lists of possible values for Type and supported savingformats are located in Appendix B.Chapter 4: Image Management84 Image Management4.1 Defining ImagesilTexImage is used to give the current bound image new attributes that you specify. Anyimage data or attributes previously in the current bound image are lost after a call toilTexImage, so make sure that you call it only after preserving the image data if need be.ILboolean ilTexImage(ILuint Width, ILuint Height, ILuint Depth,ILubyte Bpp, ILenum Format, ILenum Type, ILvoid *Data);ilTexImage has one of the longer parameter lists of the DevIL functions, so we willbriefly go over what is expected for each argument.− Width: The width of the image. If this is zero, DevIL creates an image with a widthof one.− Height: The height of the image.

If this is zero, DevIL creates an image with a heightof one.− Depth: The depth of the image, if it is an image volume. Most applications shouldspecify 0 or 1 for this parameter.− Bpp: The bytes per pixel of the image data. Do not confuse this with bits per pixel,which is also commonly used. Common bytes per pixel values are 1, 3 and 4.− Format: The format of the image data. See [format #defines], page 23 for what youcan pass.− Type: The type of image data.

Usually, this will be IL_UNSIGNED_BYTE, unless youwant to utilize multiple bytes per colour channel. See [type #defines], page 23 foracceptable type.− Data: Mainly for convenience, if you already have image data loaded and ready toput into the newly created image. Specifying NULL for this parameter just results inthe image having unpredictable image data. You can specify image data later usingilSetData or ilSetPixels.4.2 Getting Image DataThere are two ways to set image data: one is quick and dirty, while the other is more flexiblebut slower.

These two functions are ilGetData and ilCopyPixels.ILubyte *ilGetData(ILvoid);ILuint ilCopyPixels(ILuint XOff, ILuint YOff, ILuint ZOff,ILuint Width, ILuint Height, ILuint Depth, ILenum Format,ILenum Type, ILvoid * Data);4.2.1 The Quick MethodUse ilGetData to get a direct pointer to the current bound image’s data pointer. Do notever try to delete this pointer that is returned. To get information about the image data,use ilGetInteger.ilGetData will return NULL and set an error of IL_ILLEGAL_OPERATION if there is nocurrently bound image.Chapter 4: Image Management94.2.2 The Flexible MethodUse ilCopyPixels to get a portion of the current bound image’s data or to get the currentimage’s data with in a different format / type.

DevIL takes care of all conversions automatically for you to give you the image data in the format or type that you need. The datablock can range from a single line to a rectangle, all the way to a cube.ilCopyPixels has a long parameter list, like ilTexImage, so here is a description of theparameters of ilCopyPixels:− XOff: Specifies where to start copying in the x direction.− YOff: Specifies where to start copying in the y direction.− ZOff: Specifies where to start copying in the z direction. This will be 0 in most cases,unless you are using image volumes.− Width: Number of pixels to copy in the x direction.− Height: Number of pixels to copy in the y direction.− Depth: Number of pixels to copy in the z direction. This will be 1, unless− Format, Type, Data: These are basically the same as ones described above.

see [ilTexImage reference], page 8.4.3 Copying ImagesDevIL has three functions to copy images: ilCopyImage, ilOverlayImage and ilBlit.ILboolean ilCopyImage(ILuint Src);ILboolean ilOverlayImage(ILuint Src, ILint XCoord, ILint YCoord,ILint ZCoord);ILboolean ilBlit(ILuint Src, ILint DestX, ILint DestY, ILint DestZ,ILuint SrcX, ILuint SrcY, ILuint SrcZ, ILuint Width,ILuint Height, ILuint Depth);4.3.1 Direct CopyingUse ilCopyImage to create a copy of an image. ilCopyImage will copy the image specifiedby the image name in Src to the currently bound image.

ilCopyImage can be useful whenyou want to apply an effect to an image but want to preserve the original. The image boundbefore calling ilCopyImage will still be bound after ilCopyImage exits.If you specify an image name in Src that has not been generated by ilGenImages orilBindImage, ilCopyImage will set the IL_INVALID_PARAM error and return IL_FALSE.4.3.2 BlittingilBlit copies a portion of an image over to another image.

This is similar to blittingperformed in graphics libraries, such as StretchBlt in the Windows API. You can copy arectangular block from anywhere in a source image, specified by Src, to any point in thecurrently bound image. A description of the various ilBlit parameters follows:− Src: The source image name.− DestX: Specifies where to place the block of image data in the x direction.− DestY: Specifies where to place the block of image data in the y direction.− DestZ: Specifies where to place the block of image data in the z direction.Chapter 4: Image Management−−−−−−10SrcX: Specifies where to start copying in the x direction of the source image.SrcY: Specifies where to start copying in the y direction of the source image.SrcZ: Specifies where to start copying in the z direction of the source image.Width: How many pixels to copy in the x direction of the source image.Height: How many pixels to copy in the y direction of the source image.Depth: How many pixels to copy in the z direction of the source image.4.3.3 OverlayingilOverlay is essentially the same as ilBlit, but it copies the entire image over, insteadof just a portion of the image.

ilOverlay is more of a convenience function, since you canobtain the same results by calling ilBlit with SrcX, SrcY and SrcZ set to zero, with theWidth, Height and Depth parameters set to the source image’s height, width and depth,respectively. ilOverlay is missing six parameters that ilBlit has:− Src: The source image name.− DestX: Specifies where to place the block of image data in the x direction.− DestY: Specifies where to place the block of image data in the y direction.− DestZ: Specifies where to place the block of image data in the z direction.4.3.4 Blit/Overlay BehaviorBy default, ilBlit and ilOverlay will blend the source with the destination image if thesource has an alpha channel present. If you need to blit the image without blending, youcan use the IL_BLIT_BLEND #define.

This behavior can be toggled with ilEnable andilDisable.ilDisable(IL_BLIT_BLEND); // Turns off blendingilEnable(IL_BLIT_BLEND); // Turns on blendingChapter 5: Image Characteristics115 Image CharacteristicsAll images have a certain set of characteristics: origin of the image, format of the image,type of the image, and more.5.1 OriginDepending on the image format, data can start in the upper left or the lower left cornerof the image. By default, DevIL keeps the origin in the same place as the original image.This can cause your image to be flipped vertically if the image you are loading has an originother than what you expect. To obtain the origin of the image, use ilGetInteger.ilGetInteger(IL_IMAGE_ORIGIN);To force DevIL to use just one origin, you need to use the following code:ilEnable(IL_ORIGIN_SET);ilSetInteger(Origin );Origin is either IL_ORIGIN_LOWER_LEFT or IL_ORIGIN_UPPER_LEFT.

Finally, if you needto find out which origin mode is currently set, use:ilGetInteger(IL_ORIGIN_MODE);5.2 FormatChapter 6: Error Handling126 Error HandlingDevIL contains error-handling routines to alert the users of this library to any internalproblems in DevIL. The ilGetError function reports all errors in DevIL. iluErrorStringconverts error numbers returned from ilGetError to a human-readable format.ILenum ilGetError(ILvoid);const char* iluErrorString(ILenum Error);6.1 Error DetectionProblems can always occur in any software application, and DevIL is no different.

DevILkeeps track of all non-fatal errors that have occurred during its operation. All errors arekept on a stack maintained by ilGetError. Every time ilGetError is called, the lasterror is returned and pushed off the top of the stack. You should call ilGetError untilIL_NO_ERROR is returned. IL_NO_ERROR signifies that there are no more errors on the errorstack. Most errors reported are not harmful, and DevIL operation can continue, except forIL_OUT_OF_MEMORY.All error codes that can be returned by ilGetError are listed in Appendix A.6.2 Error StringsiluErrorString returns a human readable error string from any error that ilGetErrorcan return.

This is useful for when you want to display what kind of error happened to theuser.6.2.1 LanguagesThe ILU error messages have been translated into multiple languages: Arabic, Dutch,German, Japanese and Spanish. The default language is English.6.2.2 Selecting a LanguageiluSetLanguage will change the error string returned by iluErrorString to the languagespecified in its parameter. Languages supported are: English, Arabic, Dutch, German,Japanese and Spanish.

Характеристики

Тип файла
PDF-файл
Размер
664,41 Kb
Материал
Тип материала
Высшее учебное заведение

Список файлов учебной работы

Задания
DevIL
include
IL
devil_cpp_wrapper.hpp
il.h
ilu.h
ilu_region.h
ilut.h
ilut_config.h
lib
libIL.a
libIL.la
libILU.a
libILU.la
libILUT.a
libILUT.la
DevIL-master
DevIL
org.eclipse.cdt.make.core.ScannerConfigBuilder.launch
org.eclipse.cdt.make.core.makeBuilder.launch
.cvsignore
org.eclipse.wst.sse.core.prefs
org.eclipse.wst.validation.prefs
src-ILUT
include
Makefile.am
ilut_allegro.h
ilut_internal.h
ilut_opengl.h
ilut_states.h
msvc8
resources
IL Logo.ico
ILUT.rc
ILUT Unicode.rc
ILUT Unicode.vcproj
ILUT.dsp
ILUT.rc
ILUT.vcproj
ilut.def
resource.h
msvc9
resources
IL Logo.ico
ILUT.rc
main.cpp
makefile.
QuantumOperation
definitions.h
header.h
helpers.cpp
kernel.cu
main.cpp
makefile.
Свежие статьи
Популярно сейчас
Зачем заказывать выполнение своего задания, если оно уже было выполнено много много раз? Его можно просто купить или даже скачать бесплатно на СтудИзбе. Найдите нужный учебный материал у нас!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6392
Авторов
на СтудИзбе
307
Средний доход
с одного платного файла
Обучение Подробнее