Ағылшыншамен салыстырыңыз: абзацты басыңыз — түпнұсқа терезеде ашылады. Абзац астындағы EN түймесі оны мәтін ішінде көрсетеді.
Мазмұны
Кіріспе
түстерді іздеу кестелері
Компьютерлік графикада, қол жетімді түстердің шектеулі жиынтығы.
color lookup tables
In computer graphics, a finite set of available colors
Компьютерлік графикада палитра – сурет жасау үшін қолданылатын түстердің жиынтығы. Кейбір жүйелерде палитра аппараттық құрылыммен анықталады, ал басқаларында ол динамикалық болып келеді, әдетте түстерді іздеу кестесі (CLUT) арқылы іске асырылады. CLUT – бұл сәйкестік кестесі, онда белгілі бір түстік кеңістіктің түс қайту диапазонынан таңдалған түстерге индекс беріледі, осы индекс арқылы оларға сілтеме жасауға болады. Түстерді индекс арқылы сілтемелеу, түстік кеңістіктегі нақты түстерді сипаттау үшін қажетті ақпараттан кем көлемде болады, бұл деректерді пайдалануды – өңдеуді, деректерді беру жылдамдығын, RAM пайдалануын және жадты – азайтуға мүмкіндік береді. CLUT сілтемелері арқылы көрсетілген суреттер индекстелген түсті суреттер деп аталады.
In computer graphics, a palette is the set of available colors from which an image can be made. In some systems, the palette is fixed by the hardware design, and in others it is dynamic, typically implemented via a color lookup table (CLUT), a correspondence table in which selected colors from a certain color space's color reproduction range are assigned an index, by which they can be referenced. By referencing the colors via an index, which takes less information than needed to describe the actual colors in the color space, this technique aims to reduce data usage, including processing, transfer bandwidth, RAM usage, and storage. Images in which colors are indicated by references to a CLUT are called indexed color images.
Сипаттама
2019 жылға қарай графикалық карталарда ең көп қолданылатын сурет түстер кеңістігі – пикселге 8 биттік түс тереңдігі бар RGB түс моделі. Бұл техниканы пайдалану арқылы, RGB арналарының әрқайсысындағы жарық деңгейін сипаттау үшін пикселге 8 бит жұмсалады, демек 24 бит әр пикселдің түсін толыққанды сипаттайды. Осылайша, мұндай аппараттық құралдың толық жүйелік палитрасы 224 түстен тұрады. CLUT арқылы кіші палитраларды қолданудың мақсаты – бір мезгілде өңделетін мүмкін болатын түстер жиынтығын азайту арқылы пикселге жұмсалатын биттер санын азайту (көбінесе бейімделу әдістері қолданылады). Әр мүмкін түске индекс тағайындалады, бұл әр түске түсті толыққанды сипаттау үшін қажетті ақпараттан кем көлемде сілтеме жасауға мүмкіндік береді. Мысалы, GIF файл форматында жиі қолданылатын 256 түсті палитраны қарастырайық, онда кескінді бейнелеу үшін 24 биттік түс кеңістігінен 256 түс таңдалып алынады, әрқайсысына 8 биттік индекс беріледі. Осылайша, жүйе RGB түс кеңістігіндегі кез келген түсті қайта жасай алады (егер 256 түстің шектеуі рұқсат берсе), пикселге арналған сақтау көлемі 24 биттен 8 битке дейін төмендейді.
As of 2019, the most common image colorspace in graphics cards is the RGB color model with 8 bits per pixel color depth. Using this technique, 8 bits per pixel are used to describe the luminance level in each of the RGB channels, therefore 24 bits fully describe the color of each pixel. The full system palette for such hardware therefore has 224 colors. The objective of the usage of smaller palettes via CLUTs is to lower the number of bits per pixel by reducing the set of possible colors that are to be handled at once (often using adaptive methods). Each possible color is assigned an index, which allows each color to be referenced using less information than needed to fully describe the color. An example is the 256 color palette commonly used in the GIF file format, in which 256 colors to be used to represent an image are selected from the whole 24 bit color space, each being assigned an 8 bit index. This way, while the system can potentially reproduce any color in the RGB color space (as long as the 256 color restriction allows), the storage requirement per pixel is lowered from 24 to 8 bits per pixel.
Палитралардың мөлдірлігі
Индекстелген түстері бар кескінде бір палитра жазбасын қарапайым бейне жабу үшін мөлдір түс ретінде белгілеуге болады: белгілі бір кескінді фонға осылай қойып, жабысқан кескіннің бір бөлігі фонды жасырады, ал қалғаны жасырмайды. Фильмдер мен телешоулардың атаулары мен титрлерін біріктіру – бейне жабудың типолық қолданысы. Үстіне қойылатын кескінде (индекстелген түс деп есептесек) берілген палитра жазбасы мөлдір түсті білдіреді. Әдетте индекс нөмірі 0 болады, бірақ егер жабу бағдарламалық құралмен жасалса, басқа нөмірді таңдауға болады. Жобалау кезінде мөлдір түсті палитра жазбасына кездейсоқ (әдетте ерекше) түс тағайындалады. Мысалда, көрсету құрылғысының стандартты көрсеткіш стрелкасы қызғылт сары фонға салынған, сондықтан қызғылт сары аймақтар мөлдір аймақтарды (сол жақта) көрсетеді. Орындау кезінде жабысқан кескін фондық кескіннің үстіне кез келген жерге орналастырылады және пикселдің түс индексі мөлдір түс болса, фондық пиксел сақталады, әйтпесе ол ауыстырылады. Бұл техника көрсеткіштер үшін, типолық 2D бейне ойындарында кейіпкерлер, оқтар және т.б. (спрайттар), бейне титрлері және басқа бейне араластыру қолданбалары үшін қолданылады. Кейбір ерте компьютерлер, мысалы Commodore 64, MSX және Amiga, аппараттық деңгейде спрайттарды және/немесе толық экранды бейне жабуды қолдайды. Бұл жағдайларда мөлдір палитра жазбасының нөмірі аппараттық құралмен анықталады және ол 0 болады. Кейбір индекстелген түсті файл форматтары, мысалы GIF, белгілі бір палитра жазбасын мөлдір деп белгілеуге мүмкіндік береді, кез келген кескінге қолданылатын палитра жазбаларының ішінде еркін таңдауға болады. BMP файл форматы түс кестесінде альфа арна мәндері үшін орын қалдырады, бірақ қазіргі уақытта бұл орын кез келген мөлдірлік деректерін сақтау үшін қолданылмайды және нөлге теңестіріледі. Ал PNG палитра жазбаларында альфа арналарын қолдайды, бұл палитралы кескіндерде жартылай мөлдірлікті қамтамасыз етеді. Шын түсті кескіндермен жұмыс істегенде, кейбір бейне араластыру жабдықтары мөлдір түс ретінде RGB үштігін (0,0,0) қолдана алады (қызыл, жасыл, көк жоқ: қараның ең қара көлеңкесі, кейде осы жағдайда «суперқара» деп аталады). Жобалау кезінде ол «магиялық қызғылт» түсімен ауыстырылады. Сол сияқты, типолық десктоптық басылымдық бағдарламалық құралдар фотосуреттер мен иллюстрациялардан таза ақ RGB үштігін (255,255,255) қабылдауы мүмкін, бұл мәтін абзацтарының кескіннің шегінен өтуіне мүмкіндік береді, кескіннің нысандарында мәтінді ретсіз орналастыру үшін. 2D бояу бағдарламалары, мысалы Microsoft Paint және Deluxe Paint, кесу, көшіру және қою операцияларын орындағанда пайдаланушы белгілеген фондық түсті мөлдір түс ретінде қолдануы мүмкін. Бұл екеуі байланысты болғанымен (олар бірдей мақсаттар үшін қолданылады), кескіннің биттік маскалары мен альфа арналары палитраларды немесе мөлдір түстерді мүлдем қолданбайтын, бірақ кескінге қосылған қосымша екілік дерек қабаттарын қолданатын техникалар болып табылады.
A single palette entry in an indexed color image can be designated as a transparent color, in order to perform a simple video overlay: superimposing a given image over a background in such way that some part of the overlapped image obscures the background and the remaining not. Superimposing film/TV titles and credits is a typical application of video overlay. In the image to be superimposed (indexed color is assumed), a given palette entry plays the role of the transparent color. Usually the index number 0, but other may be chosen if the overlay is performed by software. At design time, the transparent color palette entry is assigned to an arbitrary (usually distinctive) color. In the example below, a typical arrow pointer for a pointing device is designed over an orange background, so here the orange areas denoted the transparent areas (left). At runtime, the overlapped image is placed anywhere over the background image, and it is blended in such way that if the pixel color index is the transparent color, the background pixel is kept, otherwise it is replaced. This technique is used for pointers, in typical 2 D videogames for characters, bullets and so on (the sprites), video titling and other image mixing applications. Some early computers, as Commodore 64, MSX and Amiga supports sprites and/or full screen video overlay by hardware. In these cases, the transparent palette entry number is defined by the hardware, and it used to be the number 0. Some indexed color image file formats as GIF natively support the designation of a given palette entry as transparent, freely selectable among any of the palette entries used for a given image. The BMP file format reserves space for Alpha channel values in its Color Table, however currently this space is not being used to hold any translucency data and is set to zero. By contrast, PNG supports alpha channels in palette entries, enabling semi transparency in paletted images. When dealing with truecolor images, some video mixing equipment can employ the RGB triplet (0,0,0) (no red, no green, no blue: the darkest shade of black, sometimes referred as superblack in this context) as the transparent color. At design time, it is replaced by the so called magic pink. The same way, typical desktop publishing software can assume pure white, RGB triplet (255,255,255) from photos and illustrations to be excluded in order to let the text paragraphs to invade the image's bounding box for irregular text arrangement around the image's subjects. 2 D painting programs, like Microsoft Paint and Deluxe Paint, can employ the user designated background color as the transparent color when performing cut, copy, and paste operations. Although related (due to they are used for the same purposes), image bit masks and alpha channels are techniques which do not involve the use of palettes nor transparent color at all, but off image added extra binary data layers.
Microsoft Windows-тың жүйелік жүйесі
Microsoft Windows қолданбалары Win32 API-нің арнайы функциялары арқылы 4 бит немесе 8 бит индекстелген түсті дисплей құрылғыларының палитрасын басқарады. Highcolor және Truecolor дисплей режимдерінде палитраларды қолдану сұрақ тудырады. Бұл API-лер «жүйе палитрасы» және көптеген «логикалық палитралар»пен жұмыс істейді. «Жүйе палитрасы» – түсті дисплейдің аппараттық тізілімдерінің RAM-дағы көшірмесі, негізінен физикалық палитра, және ол жүйенің бірегей, ортақ ресурсы болып табылады. Жүгірту кезінде ол әдепкі жүйе палитрасымен (көбінесе көптеген бағдарламалармен жақсы жұмыс істейтін «негізгі палитра») жүктеледі. Егер белгілі бір қолданба түсті графиканы және/немесе кескіндерді шығаруға ниеттенсе, ол өзінің «логикалық палитрасын» орната алады, яғни өзінің жеке түстер таңдауын (256-ға дейін). Қолданба экранға көрсетуге тырысатын әрбір графикалық элемент өзінің логикалық палитрасының түстерін пайдаланады деп есептеледі. Кез келген бағдарлама бір немесе бірнеше логикалық палитраларды еркін басқара алады, алдын ала күтілетін араласуларсыз. Шығыс жасау алдында бағдарлама өзінің логикалық палитрасын жүзеге асыруы керек: жүйе «логикалық» түстерді «физикалық» түстермен сәйкес келтіруге тырысады. Егер жоспарланған түс жүйе палитрасында болса, жүйе логикалық палитра индекстерін жүйелік палитра индекстерімен шамамен сәйкестендіреді (өйткені олар сирек үйлеседі). Егер жоспарланған түс әлі болмаса, жүйе ішкі алгоритмді қолданады, ол жүйе палитрасындағы ең аз пайдаланылатын түсті (әдетте, фондық терезеде қолданылатын) жойып, оны жаңа түспен ауыстырады. Жүйе палитрасындағы түстер саны шектеулі болғандықтан, алгоритм ұқсас түстерді біріктіруге тырысады және артық түстерді жасаудан қашады. Соңғы нәтиже экранға бір уақытта қанша қолданба өз түстерін көрсетуге тырысқанына байланысты. Алдыңғы терезеге әрқашан басымдық беріледі, сондықтан фондық терезелер әртүрлі әрекет етеді: бұзылудан бастап жылдам қайта суреттелуге дейін. Жүйе палитрасы өзгерген кезде жүйе әрбір қолданбаны хабардар ету үшін белгілі бір оқиғаны тудырады. Оқиға алынғаннан кейін терезе бір Win32 API функциясын пайдаланып жылдам қайта суреттелуі мүмкін. Бірақ бұл бағдарламалық кодта нақты көрсетілуі керек; сондықтан көптеген бағдарламалар осы оқиғаны дұрыс өңдей алмайды және олардың терезелері бұзылуы мүмкін. Қолданба жүйе палитрасын белгілі бір түстермен (нақты ретпен) жүктеуге мәжбүрлей алады, жүйені анимацияға арналған түстер екенін айтып «алдап» (физикалық палитрадағы түстердің жылдам өзгеруі). Жүйе содан кейін осы аппараттық палитра жазбалары палитра түсін басқару алгоритмі үшін бос емес деп есептейді. Соңғы нәтиже түс мәжбүрлеу бағдарламасының шеберлігіне, басқа бағдарламалардың мінез-құлқына (бұл мәселе стандартты жағдайда да бірдей) және операциялық жүйенің өзіне байланысты.
Microsoft Windows applications manage the palette of 4 bit or 8 bit indexed color display devices through specialized functions of the Win32 API. The applicability of palettes in Highcolor and Truecolor display modes becomes questionable. These APIs deals with the so called "system palette" and with many "logical palettes". The "system palette" is a copy in RAM of the color display's hardware registers, primarily a physical palette, and it is a unique, shared common resource of the system. At boot, it is loaded with the default system palette (mainly a "master palette" which works well enough with most programs). When a given application intends to output colorized graphics and/or images, it can set their own "logical palette", that is, its own private selection of colors (up to 256). It is supposed that every graphic element that the application tries to show on screen employs the colors of its logical palette. Every program can manage freely one or more logical palettes without further expected interference (in advance). Before the output is effectively made, the program must realize its logical palette: The system tries to match the "logical" colors with "physical" ones. If an intended color is already present in the system palette, the system internally maps the logical to the system palette indexes (because they rarely coincide). If the intended color is not present yet, the system applies an internal algorithm to discard the least used color in the system palette (generally, one used by another window in the background) and substitutes it with the new color. Due to there being limited room for colors in the system palette, the algorithm also tries to remap similar colors together and will always avoid creating redundant colors. The final result depends on how many applications are trying to show their colors on screen at the same time. The foreground window is always favored, so background windows may behave in different ways: from become corrupted to quickly redraw themselves. When the system palette changes, the system triggers a specific event to inform every application. When received, a window can quickly redraw itself using a single Win32 API function. But this must be done explicitly in the program code; hence the fact that many programs fail to handle this event, and their windows will become corrupt in this situation. An application can force the system palette to be loaded with specific colors (even in a specific order), "tricking" the system by telling it they are color entries intended for animation (quick color changes of the colors in the physical palette at specific entries). The system will then assume that those hardware palette entries no longer are free for its palette color management algorithm. The final result depends on the skills of the color forcing program and the behavior of the other programs (although this problem is the same as in the regular case), and that of the operating system itself.