Package: CreateFunctionOp
CreateFunctionOp
name | instruction | branch | complexity | line | method | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
CreateFunctionOp(int, int, ImageFunction, EditableImage.DataType) |
|
|
|
|
|
||||||||||||||||||||
getImageFunction() |
|
|
|
|
|
||||||||||||||||||||
toString() |
|
|
|
|
|
Coverage
1: /*
2: * *********************************************************************************************************************
3: *
4: * Mistral: open source imaging engine
5: * http://tidalwave.it/projects/mistral
6: *
7: * Copyright (C) 2003 - 2023 by Tidalwave s.a.s. (http://tidalwave.it)
8: *
9: * *********************************************************************************************************************
10: *
11: * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
12: * the License. You may obtain a copy of the License at
13: *
14: * http://www.apache.org/licenses/LICENSE-2.0
15: *
16: * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
17: * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
18: * specific language governing permissions and limitations under the License.
19: *
20: * *********************************************************************************************************************
21: *
22: * git clone https://bitbucket.org/tidalwave/mistral-src
23: * git clone https://github.com/tidalwave-it/mistral-src
24: *
25: * *********************************************************************************************************************
26: */
27: package it.tidalwave.image.op;
28:
29: import it.tidalwave.image.EditableImage;
30: import it.tidalwave.image.ImageFunction;
31:
32: /***********************************************************************************************************************
33: *
34: * This operation creates a new image with the specified size and data type,
35: * whose pixel values are computed by a given function.
36: *
37: * @author Fabrizio Giudici
38: *
39: **********************************************************************************************************************/
40: public class CreateFunctionOp extends CreateOp
41: {
42: private final ImageFunction function;
43:
44: /*******************************************************************************************************************
45: *
46: * Creates a new operation which will create an image. AT THE MOMENT ONLY
47: * MONOCHROMATIC IMAGES (MADE BY A SINGLE BAND) ARE SUPPORTED.
48: *
49: * @param width the image width
50: * @param height the image height
51: * @param function the function which computes the pixel values
52: * @param dataType the data type
53: *
54: ******************************************************************************************************************/
55: public CreateFunctionOp (final int width,
56: final int height,
57: final ImageFunction function,
58: final EditableImage.DataType dataType)
59: {
60: super(width, height, dataType);
61: this.function = function;
62:
63:• if (function == null)
64: {
65: throw new IllegalArgumentException("function cannot be null");
66: }
67: }
68:
69: /*******************************************************************************************************************
70: *
71: *
72: ******************************************************************************************************************/
73: public ImageFunction getImageFunction()
74: {
75: return function;
76: }
77:
78: /*******************************************************************************************************************
79: *
80: * {@inheritDoc}
81: *
82: ******************************************************************************************************************/
83: @Override
84: public String toString()
85: {
86: return "CreateFunctionOp(" + getWidth() + ", " + getHeight() + ", " + function + ", " + getDataType() + ")";
87: }
88: }