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

Вниз

Инвертирование цвета   Найти похожие ветки 

 
Сергей+   (2005-01-03 16:31) [0]

Всем привет !

есть задача:
нужно проинвертировать заданный цвет.
Хотелось бы найти чтонибудь системное, чтобы самому не   обрабатывать множество форматов цвета.
////
например, если рисовать линию в режиме
canvas.pen.mode:=pmNot
то винда как-раз делает эту задачу.

заранее спасиба


 
programania ©   (2005-01-03 19:45) [1]

C:=RGB(255-GetRValue(C),255-GetGValue(C),255-GetBValue(C));


 
R.D.I. ©   (2005-01-03 19:51) [2]


var
 C: TColor;
begin
...
C:=16777215 - C;
...
end;


 
Anatoly Podgoretsky ©   (2005-01-03 20:21) [3]

C := C XOR $FFFFFF


 
Asteroid ©   (2005-01-04 01:30) [4]

Смотря как надо инвертировать. Если в нормальном смысле - то [1]-[3]. Если так, чтобы была как можно большая разница в цвете между прямым и инвертированным - то C := C xor $808080. (сравни с [3] на сером цвете типа $7F7F7F).


 
Сергей+   (2005-01-04 10:11) [5]

спасибо за советы.
но это малость не то.

откуда вы знаете что цвет в формате $00BBGGRR

у битмапа есть дофиг форматов:
TPixelFormat = (pf1bit, pf4bit, pf8bit, pf15bit, pf16bit, pf24bit, pf32bit)
и у винды всякие настройки глубины цвета ......

не хотелось бы делать надцать переборов :(


 
GrayFace ©   (2005-01-04 16:05) [6]

Вот как раз TBitmap гарантирует формат $BBGGRR, иначе надо было бы делать ColorToRGB. Canvas.Pixels все переводит в нормальный TColor.


 
ivane   (2005-01-04 18:36) [7]

Попробуй просто копирование чисто белого или чисто чёрного битмапа на твой исходный(того же размера) с использованием логических операций....

Вырезка из Хелпа(TCanvas.CopyMode)



TCopyMode specifies how a graphical image is copied onto a canvas.

Unit

Graphics

Delphi syntax:

type TCopyMode = Longint;

C++ syntax:

typedef int TCopyMode;

Description

TCopyMode values describe how to combine the colors of a source bitmap and a destination bitmap.

The Windows unit defines the following constants for TCopyMode values:

Value Meaning

cmBlackness Fills the destination rectangle on the canvas with black.
cmDstInvert Inverts the image on the canvas and ignores the source.
cmMergeCopy Combines the image on the canvas and the source bitmap by using the Boolean AND operator.
cmMergePaint Combines the inverted source bitmap with the image on the canvas by using the Boolean OR operator.
cmNotSrcCopy Copies the inverted source bitmap to the canvas.
cmNotSrcErase Combines the image on the canvas and the source bitmap by using the Boolean OR operator, and inverts the result.

cmPatCopy Copies the source pattern to the canvas.
cmPatInvert Combines the source pattern with the image on the canvas using the Boolean XOR operator
cmPatPaint Combines the inverted source bitmap with the source pattern by using the Boolean OR operator. Combines the result of this operation with the image on the canvas by using the Boolean OR operator.
cmSrcAnd Combines the image on the canvas and source bitmap by using the Boolean AND operator.
cmSrcCopy Copies the source bitmap to the canvas.

cmSrcErase Inverts the image on the canvas and combines the result with the source bitmap by using the Boolean AND operator.
cmSrcInvert Combines the image on the canvas and the source bitmap by using the Boolean XOR operator.
cmSrcPaint Combines the image on the canvas and the source bitmap by using the Boolean OR operator.
cmWhiteness Fills the destination rectangle on the canvas with white.



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

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

Наверх




Память: 0.48 MB
Время: 0.044 c
1-1107333212
Proga
2005-02-02 11:33
2005.02.20
Загнать бинарное дерево в xml файл


4-1104934401
Danilka from home
2005-01-05 17:13
2005.02.20
IIS. Как создать нового пользователя Windows?


1-1107328546
Jay1982
2005-02-02 10:15
2005.02.20
HotKey in CONSOLE


3-1106556894
sergeymist
2005-01-24 11:54
2005.02.20
как подставить данные полученные из query в список combobox


4-1105009997
Davinchi
2005-01-06 14:13
2005.02.20
Сркытие программы из Alt+Tab и панели задач