Главная страница
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.05 c
3-1106348562
NeedHelp
2005-01-22 02:02
2005.02.20
data.MB zanimaet 16 MB ?? 4to delat ??? eto ved mnogo =(


6-1102693128
Шелест вёсел
2004-12-10 18:38
2005.02.20
Как Установить Компоненты ClientSocket и ServerSocket В D7?


3-1106058019
Бульбаш
2005-01-18 17:20
2005.02.20
Как отменить Post при переходе на другую строку?


9-1100950280
Bryke
2004-11-20 14:31
2005.02.20
Индексация


14-1106895441
MBo
2005-01-28 09:57
2005.02.20
Пятничные задачки. ;)