| 1 |
/*****************************************************************************/ |
| 2 |
// Copyright 2023 Adobe Systems Incorporated |
| 3 |
// All Rights Reserved. |
| 4 |
// |
| 5 |
// NOTICE: Adobe permits you to use, modify, and distribute this file in |
| 6 |
// accordance with the terms of the Adobe license agreement accompanying it. |
| 7 |
/*****************************************************************************/ |
| 8 |
|
| 9 |
/** \file |
| 10 |
* Functions and classes for working with a semantic mask. |
| 11 |
*/ |
| 12 |
|
| 13 |
/*****************************************************************************/ |
| 14 |
|
| 15 |
#ifndef __dng_semantic_mask__ |
| 16 |
#define __dng_semantic_mask__ |
| 17 |
|
| 18 |
/*****************************************************************************/ |
| 19 |
|
| 20 |
#include "dng_classes.h" |
| 21 |
#include "dng_string.h" |
| 22 |
#include "dng_types.h" |
| 23 |
|
| 24 |
#include <memory> |
| 25 |
|
| 26 |
/*****************************************************************************/ |
| 27 |
|
| 28 |
class dng_semantic_mask |
| 29 |
{ |
| 30 |
|
| 31 |
public: |
| 32 |
|
| 33 |
// String identifying the semantics of this mask. Corresponds to |
| 34 |
// SemanticName tag. |
| 35 |
|
| 36 |
dng_string fName; |
| 37 |
|
| 38 |
// String identifying the instance of this mask. Corresponds to |
| 39 |
// SemanticInstanceID tag. |
| 40 |
|
| 41 |
dng_string fInstanceID; |
| 42 |
|
| 43 |
// XMP block. We don't use this for anything at present; just make |
| 44 |
// sure we preserve it. |
| 45 |
|
| 46 |
std::shared_ptr<const dng_memory_block> fXMP; |
| 47 |
|
| 48 |
// The semantic mask. The origin of the image bounds is always (0,0) |
| 49 |
// by convention. |
| 50 |
|
| 51 |
std::shared_ptr<const dng_image> fMask; |
| 52 |
|
| 53 |
// Optional MaskSubArea tag (top, left, bottom, right). |
| 54 |
|
| 55 |
// [0]: top crop |
| 56 |
// [1]: left crop |
| 57 |
|
| 58 |
// [2]: width full |
| 59 |
// [3]: height full |
| 60 |
|
| 61 |
uint32 fMaskSubArea [4] = { 0, 0, 0, 0 }; |
| 62 |
|
| 63 |
// Lossy compressed data. |
| 64 |
|
| 65 |
std::shared_ptr<const dng_lossy_compressed_image> fLossyCompressed; |
| 66 |
|
| 67 |
public: |
| 68 |
|
| 69 |
bool IsMaskSubAreaValid () const; |
| 70 |
|
| 71 |
void CalcMaskSubArea (dng_point &origin, |
| 72 |
dng_rect &wholeImageArea) const; |
| 73 |
|
| 74 |
}; |
| 75 |
|
| 76 |
/*****************************************************************************/ |
| 77 |
|
| 78 |
#endif // __dng_semantic_mask__ |
| 79 |
|
| 80 |
/*****************************************************************************/ |
| 81 |
|