Oolite
Loading...
Searching...
No Matches
OOPixMapChannelOperations.h
Go to the documentation of this file.
1/*
2
3OOPixMapChannelOperations.h
4
5Utility to convert one channel of an RGBA texture into a greyscale texture.
6
7
8Copyright (C) 2010-2013 Jens Ayton
9
10Permission is hereby granted, free of charge, to any person obtaining a copy
11of this software and associated documentation files (the "Software"), to deal
12in the Software without restriction, including without limitation the rights
13to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14copies of the Software, and to permit persons to whom the Software is
15furnished to do so, subject to the following conditions:
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26SOFTWARE.
27
28*/
29
30#import "OOPixMap.h"
31
32/* OOExtractPixMapChannel()
33 Given a 4-channel pixmap, extract one channel, producing a single-channel
34 pixmap. This is done in place, destroying the original data.
35 ChannelIndex specifies which component to extract. This is a per-pixel
36 byte index: 0 means bytes bytes 0, 4, 8 etc. will be used, 2 means bytes
37 2, 6, 10 etc. will be used.
38 Returns false (without modifying the pixmap) if passed NULL, an invalid
39 pixmap, a pixmap whose channel count is not 4, or a channel index greater
40 than 3.
41*/
42BOOL OOExtractPixMapChannel(OOPixMap* ioPixMap, uint8_t channelIndex, BOOL compactWhenDone);
43
44/* OOPixMapToRGBA()
45 Convert a pixmap to RGBA format.
46 NOTE: if successful, this will free() the original buffer and replace it.
47*/
48BOOL OOPixMapToRGBA(OOPixMap* ioPixMap);
49
50/* OOPixMapModulateUniform()
51 Multiply all pixels by specified per-component factors. Pixmap must be in
52 RGBA format. The effect of using factors outside the range [0..1] is
53 undefined.
54 OOPixMapToRGBA() is called on ioPixMap.
55*/
56BOOL OOPixMapModulateUniform(OOPixMap* ioPixMap, float f0, float f1, float f2, float f3);
57
58/* OOPixMapModulatePixMap()
59 Multiply each pixel of ioDstPixMap by the corresponding pixel of otherPixMap,
60 writing the result to ioDstPixMap.
61 OOPixMapToRGBA() is called on ioDstPixMap; otherPixMap must be RGBA.
62*/
63BOOL OOPixMapModulatePixMap(OOPixMap* ioDstPixMap, OOPixMap otherPixMap);
64
65/* OOPixMapAddPixMap()
66 Add each pixel of otherPixMap to the corresponding pixel of ioDstPixMap,
67 writing the result to ioDstPixMap.
68 OOPixMapToRGBA() is called on ioDstPixMap; otherPixMap must be RGBA.
69*/
70BOOL OOPixMapAddPixMap(OOPixMap* ioDstPixMap, OOPixMap otherPixMap);
BOOL OOPixMapModulateUniform(OOPixMap *ioPixMap, float f0, float f1, float f2, float f3)
BOOL OOExtractPixMapChannel(OOPixMap *ioPixMap, uint8_t channelIndex, BOOL compactWhenDone)
BOOL OOPixMapAddPixMap(OOPixMap *ioDstPixMap, OOPixMap otherPixMap)
BOOL OOPixMapModulatePixMap(OOPixMap *ioDstPixMap, OOPixMap otherPixMap)
BOOL OOPixMapToRGBA(OOPixMap *ioPixMap)