Oolite 1.91.0.7646-241128-10e222e
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
33/* OOExtractPixMapChannel()
34 Given a 4-channel pixmap, extract one channel, producing a single-channel
35 pixmap. This is done in place, destroying the original data.
36 ChannelIndex specifies which component to extract. This is a per-pixel
37 byte index: 0 means bytes bytes 0, 4, 8 etc. will be used, 2 means bytes
38 2, 6, 10 etc. will be used.
39 Returns false (without modifying the pixmap) if passed NULL, an invalid
40 pixmap, a pixmap whose channel count is not 4, or a channel index greater
41 than 3.
42*/
43BOOL OOExtractPixMapChannel(OOPixMap *ioPixMap, uint8_t channelIndex, BOOL compactWhenDone);
44
45
46/* OOPixMapToRGBA()
47 Convert a pixmap to RGBA format.
48 NOTE: if successful, this will free() the original buffer and replace it.
49*/
50BOOL OOPixMapToRGBA(OOPixMap *ioPixMap);
51
52
53/* OOPixMapModulateUniform()
54 Multiply all pixels by specified per-component factors. Pixmap must be in
55 RGBA format. The effect of using factors outside the range [0..1] is
56 undefined.
57 OOPixMapToRGBA() is called on ioPixMap.
58*/
59BOOL OOPixMapModulateUniform(OOPixMap *ioPixMap, float f0, float f1, float f2, float f3);
60
61
62/* OOPixMapModulatePixMap()
63 Multiply each pixel of ioDstPixMap by the corresponding pixel of otherPixMap,
64 writing the result to ioDstPixMap.
65 OOPixMapToRGBA() is called on ioDstPixMap; otherPixMap must be RGBA.
66*/
67BOOL OOPixMapModulatePixMap(OOPixMap *ioDstPixMap, OOPixMap otherPixMap);
68
69
70/* OOPixMapAddPixMap()
71 Add each pixel of otherPixMap to the corresponding pixel of ioDstPixMap,
72 writing the result to ioDstPixMap.
73 OOPixMapToRGBA() is called on ioDstPixMap; otherPixMap must be RGBA.
74*/
75BOOL 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)