| 1 |
#ifndef _Photo_h_ |
| 2 |
#define _Photo_h_ |
| 3 |
/* Photo.h |
| 4 |
* |
| 5 |
* Copyright (C) 2013-2017,2019,2026 Paul Boersma |
| 6 |
* |
| 7 |
* This code is free software; you can redistribute it and/or modify |
| 8 |
* it under the terms of the GNU General Public License as published by |
| 9 |
* the Free Software Foundation; either version 3 of the License, or (at |
| 10 |
* your option) any later version. |
| 11 |
* |
| 12 |
* This code is distributed in the hope that it will be useful, but |
| 13 |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 15 |
* See the GNU General Public License for more details. |
| 16 |
* |
| 17 |
* You should have received a copy of the GNU General Public License |
| 18 |
* along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 19 |
*/ |
| 20 |
|
| 21 |
#include "Matrix.h" |
| 22 |
|
| 23 |
#include "Photo_def.h" |
| 24 |
|
| 25 |
void Photo_init (Photo me, |
| 26 |
double xmin, double xmax, integer nx, double dx, double x1, |
| 27 |
double ymin, double ymax, integer ny, double dy, double y1); |
| 28 |
|
| 29 |
autoPhoto Photo_create |
| 30 |
(double xmin, double xmax, integer nx, double dx, double x1, |
| 31 |
double ymin, double ymax, integer ny, double dy, double y1); |
| 32 |
/* |
| 33 |
Function: |
| 34 |
return a new opaque black Photo. |
| 35 |
Preconditions: |
| 36 |
xmin <= xmax; ymin <= ymax; |
| 37 |
nx >= 1; ny >= 1; |
| 38 |
dx > 0.0; dy > 0.0; |
| 39 |
Postconditions: |
| 40 |
result -> xmin == xmin; |
| 41 |
result -> xmax == xmax; |
| 42 |
result -> ymin == ymin; |
| 43 |
result -> ymax == ymax; |
| 44 |
result -> nx == nx; |
| 45 |
result -> ny == ny; |
| 46 |
result -> dx == dx; |
| 47 |
result -> dy == dy; |
| 48 |
result -> x1 == x1; |
| 49 |
result -> y1 == y1; |
| 50 |
result -> d_red -> z [1..ny] [1..nx] == 0.0; |
| 51 |
result -> d_green -> z [1..ny] [1..nx] == 0.0; |
| 52 |
result -> d_blue -> z [1..ny] [1..nx] == 0.0; |
| 53 |
result -> d_transparency -> z [1..ny] [1..nx] == 0.0; |
| 54 |
*/ |
| 55 |
|
| 56 |
autoPhoto Photo_createSimple (integer numberOfRows, integer numberOfColumns); |
| 57 |
/* |
| 58 |
Function: |
| 59 |
return a new opaque black Photo. |
| 60 |
Preconditions: |
| 61 |
numberOfRows >= 1; numberOfColumns >= 1; |
| 62 |
Postconditions: |
| 63 |
result -> xmin == 0.5; |
| 64 |
result -> xmax == numberOfColumns + 0.5; |
| 65 |
result -> ymin == 0.5; |
| 66 |
result -> ymax == numberOfRows + 0.5; |
| 67 |
result -> nx == numberOfColumns; |
| 68 |
result -> ny == numberOfRows; |
| 69 |
result -> dx == 1; |
| 70 |
result -> dy == 1; |
| 71 |
result -> x1 == 1; |
| 72 |
result -> y1 == 1; |
| 73 |
result -> d_red -> z [1..ny] [1..nx] == 0.0; |
| 74 |
result -> d_green -> z [1..ny] [1..nx] == 0.0; |
| 75 |
result -> d_blue -> z [1..ny] [1..nx] == 0.0; |
| 76 |
result -> d_transparency -> z [1..ny] [1..nx] == 0.0; |
| 77 |
*/ |
| 78 |
|
| 79 |
autoPhoto Photo_readFromImageFile (MelderFile file); |
| 80 |
|
| 81 |
MelderColour Photo_getValueAtXY (Photo me, double x, double y); |
| 82 |
/* |
| 83 |
Linear interpolation between matrix points, |
| 84 |
constant extrapolation in cells on the edge, |
| 85 |
undefined outside the union of the unit squares around the points. |
| 86 |
*/ |
| 87 |
|
| 88 |
void Photo_replaceRed (Photo me, Matrix red); |
| 89 |
void Photo_replaceGreen (Photo me, Matrix green); |
| 90 |
void Photo_replaceBlue (Photo me, Matrix blue); |
| 91 |
void Photo_replaceTransparency (Photo me, Matrix transparency); |
| 92 |
|
| 93 |
void Photo_paintImageInside (Photo me, Graphics g, double xmin, double xmax, double ymin, double ymax); |
| 94 |
void Photo_paintImage (Photo me, Graphics g, double xmin, double xmax, double ymin, double ymax); |
| 95 |
|
| 96 |
void Photo_paintCellsInside (Photo me, Graphics g, double xmin, double xmax, double ymin, double ymax); |
| 97 |
void Photo_paintCells (Photo me, Graphics g, double xmin, double xmax, double ymin, double ymax); |
| 98 |
/* |
| 99 |
Every sample is drawn as a rectangle. |
| 100 |
*/ |
| 101 |
|
| 102 |
void Photo_playMovie (Photo me, Graphics g); |
| 103 |
void Photo_saveAsPNG (Photo me, MelderFile file); |
| 104 |
void Photo_saveAsTIFF (Photo me, MelderFile file); |
| 105 |
void Photo_saveAsGIF (Photo me, MelderFile file); |
| 106 |
void Photo_saveAsWindowsBitmapFile (Photo me, MelderFile file); |
| 107 |
void Photo_saveAsJPEG (Photo me, MelderFile file); |
| 108 |
void Photo_saveAsJPEG2000 (Photo me, MelderFile file); |
| 109 |
void Photo_saveAsAppleIconFile (Photo me, MelderFile file); |
| 110 |
void Photo_saveAsWindowsIconFile (Photo me, MelderFile file); |
| 111 |
|
| 112 |
/* End of file Photo.h */ |
| 113 |
#endif |