EXRTranslator: Remove from the tree.
It's now at HaikuArchives and supplied in a package at HaikuPorts. EXR images are rare and mostly used in pretty specific cases, so it isn't re-added to the default install. Catalogs are left in-tree until they are purged from Pootle. Change-Id: I54e478a30e02bdefd1b8fa53c4b66d84ffb04185
This commit is contained in:
@@ -759,7 +759,6 @@ rule ArchitectureSetupWarnings architecture
|
|||||||
EnableWerror src add-ons screen_savers ;
|
EnableWerror src add-ons screen_savers ;
|
||||||
EnableWerror src add-ons tracker ;
|
EnableWerror src add-ons tracker ;
|
||||||
EnableWerror src add-ons translators bmp ;
|
EnableWerror src add-ons translators bmp ;
|
||||||
EnableWerror src add-ons translators exr ;
|
|
||||||
EnableWerror src add-ons translators gif ;
|
EnableWerror src add-ons translators gif ;
|
||||||
EnableWerror src add-ons translators hvif ;
|
EnableWerror src add-ons translators hvif ;
|
||||||
EnableWerror src add-ons translators ico ;
|
EnableWerror src add-ons translators ico ;
|
||||||
|
|||||||
@@ -565,30 +565,6 @@ if [ IsPackageAvailable tiff4_devel ] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# openexr
|
|
||||||
if [ IsPackageAvailable openexr_devel ] {
|
|
||||||
ExtractBuildFeatureArchives openexr :
|
|
||||||
file: base openexr
|
|
||||||
runtime: lib
|
|
||||||
file: devel openexr_devel
|
|
||||||
depends: base
|
|
||||||
libraries:
|
|
||||||
$(developLibDir)/libIlmImf.so
|
|
||||||
$(developLibDir)/libIlmImfUtil.so
|
|
||||||
$(developLibDir)/libHalf.so
|
|
||||||
$(developLibDir)/libIex.so
|
|
||||||
$(developLibDir)/libIexMath.so
|
|
||||||
$(developLibDir)/libIlmThread.so
|
|
||||||
$(developLibDir)/libImath.so
|
|
||||||
headers: $(developHeadersDir) $(developHeadersDir)/OpenEXR
|
|
||||||
;
|
|
||||||
|
|
||||||
EnableBuildFeatures openexr ;
|
|
||||||
} else {
|
|
||||||
unavailableBuildFeatures += openexr ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# libdvdread
|
# libdvdread
|
||||||
if [ IsPackageAvailable libdvdread_devel ] {
|
if [ IsPackageAvailable libdvdread_devel ] {
|
||||||
ExtractBuildFeatureArchives libdvdread :
|
ExtractBuildFeatureArchives libdvdread :
|
||||||
|
|||||||
@@ -130,7 +130,6 @@ SYSTEM_ADD_ONS_ACCELERANTS += [ FFilterByBuildFeatures
|
|||||||
SYSTEM_ADD_ONS_TRANSLATORS += [ FFilterByBuildFeatures
|
SYSTEM_ADD_ONS_TRANSLATORS += [ FFilterByBuildFeatures
|
||||||
AVIFTranslator@libavif
|
AVIFTranslator@libavif
|
||||||
BMPTranslator
|
BMPTranslator
|
||||||
EXRTranslator@openexr
|
|
||||||
GIFTranslator
|
GIFTranslator
|
||||||
HVIFTranslator
|
HVIFTranslator
|
||||||
ICOTranslator ICNSTranslator@libicns
|
ICOTranslator ICNSTranslator@libicns
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ SubDir HAIKU_TOP src add-ons translators ;
|
|||||||
|
|
||||||
SubInclude HAIKU_TOP src add-ons translators avif ;
|
SubInclude HAIKU_TOP src add-ons translators avif ;
|
||||||
SubInclude HAIKU_TOP src add-ons translators bmp ;
|
SubInclude HAIKU_TOP src add-ons translators bmp ;
|
||||||
SubInclude HAIKU_TOP src add-ons translators exr ;
|
|
||||||
SubInclude HAIKU_TOP src add-ons translators gif ;
|
SubInclude HAIKU_TOP src add-ons translators gif ;
|
||||||
SubInclude HAIKU_TOP src add-ons translators hvif ;
|
SubInclude HAIKU_TOP src add-ons translators hvif ;
|
||||||
SubInclude HAIKU_TOP src add-ons translators ico ;
|
SubInclude HAIKU_TOP src add-ons translators ico ;
|
||||||
|
|||||||
@@ -1,73 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2008, Jérôme Duval. All rights reserved.
|
|
||||||
* Copyright 2005-2007, Axel Dörfler, [email protected]. All rights reserved.
|
|
||||||
* Copyright 2009, Maxime Simon, [email protected]. All rights reserved.
|
|
||||||
* Distributed under the terms of the MIT License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "ConfigView.h"
|
|
||||||
#include "EXRTranslator.h"
|
|
||||||
|
|
||||||
#include <Catalog.h>
|
|
||||||
#include <CheckBox.h>
|
|
||||||
#include <LayoutBuilder.h>
|
|
||||||
#include <StringView.h>
|
|
||||||
|
|
||||||
#include <OpenEXRConfig.h>
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#undef B_TRANSLATION_CONTEXT
|
|
||||||
#define B_TRANSLATION_CONTEXT "ConfigView"
|
|
||||||
|
|
||||||
|
|
||||||
ConfigView::ConfigView(uint32 flags)
|
|
||||||
: BView("EXRTranslator Settings", flags)
|
|
||||||
{
|
|
||||||
SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
|
|
||||||
|
|
||||||
BStringView *titleView = new BStringView("title",
|
|
||||||
B_TRANSLATE("EXR image translator"));
|
|
||||||
titleView->SetFont(be_bold_font);
|
|
||||||
|
|
||||||
char version[256];
|
|
||||||
sprintf(version, B_TRANSLATE("Version %d.%d.%d, %s"),
|
|
||||||
int(B_TRANSLATION_MAJOR_VERSION(EXR_TRANSLATOR_VERSION)),
|
|
||||||
int(B_TRANSLATION_MINOR_VERSION(EXR_TRANSLATOR_VERSION)),
|
|
||||||
int(B_TRANSLATION_REVISION_VERSION(EXR_TRANSLATOR_VERSION)),
|
|
||||||
__DATE__);
|
|
||||||
BStringView *versionView = new BStringView("version", version);
|
|
||||||
|
|
||||||
BStringView *copyrightView = new BStringView("copyright",
|
|
||||||
B_UTF8_COPYRIGHT "2008 Haiku Inc.");
|
|
||||||
|
|
||||||
BString openExrInfo = B_TRANSLATE("Based on OpenEXR %version%");
|
|
||||||
openExrInfo.ReplaceAll("%version%", OPENEXR_VERSION_STRING);
|
|
||||||
BStringView *copyrightView2 = new BStringView("copyright2",
|
|
||||||
openExrInfo.String());
|
|
||||||
|
|
||||||
BStringView *copyrightView3 = new BStringView("copyright3",
|
|
||||||
B_UTF8_COPYRIGHT "2002-2014 Industrial Light & Magic,");
|
|
||||||
|
|
||||||
BStringView *copyrightView4 = new BStringView("copyright4",
|
|
||||||
B_TRANSLATE("a division of Lucasfilm Entertainment Company Ltd"));
|
|
||||||
|
|
||||||
// Build the layout
|
|
||||||
BLayoutBuilder::Group<>(this, B_VERTICAL, 0)
|
|
||||||
.SetInsets(B_USE_DEFAULT_SPACING)
|
|
||||||
.Add(titleView)
|
|
||||||
.Add(versionView)
|
|
||||||
.Add(copyrightView)
|
|
||||||
.AddGlue()
|
|
||||||
.Add(copyrightView2)
|
|
||||||
.Add(copyrightView3)
|
|
||||||
.Add(copyrightView4);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ConfigView::~ConfigView()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2004-2007, Axel Dörfler, [email protected]. All rights reserved.
|
|
||||||
* Distributed under the terms of the MIT License.
|
|
||||||
*/
|
|
||||||
#ifndef CONFIG_VIEW_H
|
|
||||||
#define CONFIG_VIEW_H
|
|
||||||
|
|
||||||
|
|
||||||
#include <View.h>
|
|
||||||
|
|
||||||
|
|
||||||
class ConfigView : public BView {
|
|
||||||
public:
|
|
||||||
ConfigView(uint32 flags = B_WILL_DRAW);
|
|
||||||
virtual ~ConfigView();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* CONFIG_VIEW_H */
|
|
||||||
@@ -1,100 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004, Industrial Light & Magic, a division of Lucas
|
|
||||||
* Digital Ltd. LLC
|
|
||||||
* Distributed under the terms of the MIT License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "EXRGamma.h"
|
|
||||||
#include "ImathFun.h"
|
|
||||||
#include "ImathMath.h"
|
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
|
|
||||||
float
|
|
||||||
knee(double x, double f)
|
|
||||||
{
|
|
||||||
return float (Imath::Math<double>::log (x * f + 1) / f);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
float
|
|
||||||
findKneeF(float x, float y)
|
|
||||||
{
|
|
||||||
float f0 = 0;
|
|
||||||
float f1 = 1;
|
|
||||||
|
|
||||||
while (knee (x, f1) > y)
|
|
||||||
{
|
|
||||||
f0 = f1;
|
|
||||||
f1 = f1 * 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < 30; ++i)
|
|
||||||
{
|
|
||||||
float f2 = (f0 + f1) / 2;
|
|
||||||
float y2 = knee (x, f2);
|
|
||||||
|
|
||||||
if (y2 < y)
|
|
||||||
f1 = f2;
|
|
||||||
else
|
|
||||||
f0 = f2;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (f0 + f1) / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Gamma::Gamma(float gamma,
|
|
||||||
float exposure,
|
|
||||||
float defog,
|
|
||||||
float kneeLow,
|
|
||||||
float kneeHigh)
|
|
||||||
:
|
|
||||||
g (gamma),
|
|
||||||
m (Imath::Math<float>::pow(2, exposure + 2.47393)),
|
|
||||||
d (defog),
|
|
||||||
kl (Imath::Math<float>::pow(2, kneeLow)),
|
|
||||||
f (findKneeF (Imath::Math<float>::pow(2, kneeHigh) - kl,
|
|
||||||
Imath::Math<float>::pow(2, 3.5) - kl)),
|
|
||||||
s (255.0 * Imath::Math<float>::pow(2, -3.5 * g))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
float
|
|
||||||
Gamma::operator() (half h)
|
|
||||||
{
|
|
||||||
//
|
|
||||||
// Defog
|
|
||||||
//
|
|
||||||
|
|
||||||
float x = max (0.f, (h - d));
|
|
||||||
|
|
||||||
//
|
|
||||||
// Exposure
|
|
||||||
//
|
|
||||||
|
|
||||||
x *= m;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Knee
|
|
||||||
//
|
|
||||||
|
|
||||||
if (x > kl)
|
|
||||||
x = kl + knee (x - kl, f);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Gamma
|
|
||||||
//
|
|
||||||
|
|
||||||
x = Imath::Math<float>::pow (x, g);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Scale and clamp
|
|
||||||
//
|
|
||||||
|
|
||||||
return Imath::clamp (x * s, 0.f, 255.f);
|
|
||||||
}
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004, Industrial Light & Magic, a division of Lucas
|
|
||||||
* Digital Ltd. LLC
|
|
||||||
* Distributed under the terms of the MIT License.
|
|
||||||
*/
|
|
||||||
#ifndef EXR_GAMMA_H
|
|
||||||
#define EXR_GAMMA_H
|
|
||||||
|
|
||||||
#include "halfFunction.h"
|
|
||||||
|
|
||||||
struct Gamma
|
|
||||||
{
|
|
||||||
float g, m, d, kl, f, s;
|
|
||||||
|
|
||||||
Gamma(float gamma,
|
|
||||||
float exposure,
|
|
||||||
float defog,
|
|
||||||
float kneeLow,
|
|
||||||
float kneeHigh);
|
|
||||||
|
|
||||||
float operator() (half h);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -1,254 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2008, Jérôme Duval. All rights reserved.
|
|
||||||
* Copyright (c) 2004, Industrial Light & Magic, a division of Lucas
|
|
||||||
* Digital Ltd. LLC
|
|
||||||
* Distributed under the terms of the MIT License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <Catalog.h>
|
|
||||||
|
|
||||||
#include "ConfigView.h"
|
|
||||||
#include "EXRGamma.h"
|
|
||||||
#include "EXRTranslator.h"
|
|
||||||
#include "ImfArray.h"
|
|
||||||
#undef min
|
|
||||||
#undef max
|
|
||||||
#include "ImfRgbaFile.h"
|
|
||||||
#include "IStreamWrapper.h"
|
|
||||||
|
|
||||||
#undef B_TRANSLATION_CONTEXT
|
|
||||||
#define B_TRANSLATION_CONTEXT "EXRTranslator"
|
|
||||||
|
|
||||||
|
|
||||||
// The input formats that this translator supports.
|
|
||||||
static const translation_format sInputFormats[] = {
|
|
||||||
{
|
|
||||||
EXR_IMAGE_FORMAT,
|
|
||||||
B_TRANSLATOR_BITMAP,
|
|
||||||
EXR_IN_QUALITY,
|
|
||||||
EXR_IN_CAPABILITY,
|
|
||||||
"image/exr",
|
|
||||||
"EXR"
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
// The output formats that this translator supports.
|
|
||||||
static const translation_format sOutputFormats[] = {
|
|
||||||
{
|
|
||||||
B_TRANSLATOR_BITMAP,
|
|
||||||
B_TRANSLATOR_BITMAP,
|
|
||||||
BITS_OUT_QUALITY,
|
|
||||||
BITS_OUT_CAPABILITY,
|
|
||||||
"image/x-be-bitmap",
|
|
||||||
"Be Bitmap Format (EXRTranslator)"
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
// Default settings for the Translator
|
|
||||||
static const TranSetting sDefaultSettings[] = {
|
|
||||||
{B_TRANSLATOR_EXT_HEADER_ONLY, TRAN_SETTING_BOOL, false},
|
|
||||||
{B_TRANSLATOR_EXT_DATA_ONLY, TRAN_SETTING_BOOL, false}
|
|
||||||
};
|
|
||||||
|
|
||||||
const uint32 kNumInputFormats = sizeof(sInputFormats) / sizeof(translation_format);
|
|
||||||
const uint32 kNumOutputFormats = sizeof(sOutputFormats) / sizeof(translation_format);
|
|
||||||
const uint32 kNumDefaultSettings = sizeof(sDefaultSettings) / sizeof(TranSetting);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
|
||||||
|
|
||||||
|
|
||||||
EXRTranslator::EXRTranslator()
|
|
||||||
: BaseTranslator(B_TRANSLATE("EXR images"),
|
|
||||||
B_TRANSLATE("EXR image translator"),
|
|
||||||
EXR_TRANSLATOR_VERSION,
|
|
||||||
sInputFormats, kNumInputFormats,
|
|
||||||
sOutputFormats, kNumOutputFormats,
|
|
||||||
"EXRTranslator_Settings",
|
|
||||||
sDefaultSettings, kNumDefaultSettings,
|
|
||||||
B_TRANSLATOR_BITMAP, EXR_IMAGE_FORMAT)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
EXRTranslator::~EXRTranslator()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
EXRTranslator::DerivedIdentify(BPositionIO *stream,
|
|
||||||
const translation_format *format, BMessage *settings,
|
|
||||||
translator_info *outInfo, uint32 outType)
|
|
||||||
{
|
|
||||||
if (!outType)
|
|
||||||
outType = B_TRANSLATOR_BITMAP;
|
|
||||||
if (outType != B_TRANSLATOR_BITMAP)
|
|
||||||
return B_NO_TRANSLATOR;
|
|
||||||
|
|
||||||
try {
|
|
||||||
IStreamWrapper istream("filename", stream);
|
|
||||||
RgbaInputFile inputFile(istream);
|
|
||||||
|
|
||||||
if (outInfo) {
|
|
||||||
outInfo->type = EXR_IMAGE_FORMAT;
|
|
||||||
outInfo->group = B_TRANSLATOR_BITMAP;
|
|
||||||
outInfo->quality = EXR_IN_QUALITY;
|
|
||||||
outInfo->capability = EXR_IN_CAPABILITY;
|
|
||||||
strcpy(outInfo->MIME, "image/exr");
|
|
||||||
strlcpy(outInfo->name, B_TRANSLATE("EXR image"),
|
|
||||||
sizeof(outInfo->name));
|
|
||||||
}
|
|
||||||
} catch (...) {
|
|
||||||
return B_NO_TRANSLATOR;
|
|
||||||
}
|
|
||||||
|
|
||||||
return B_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
EXRTranslator::DerivedTranslate(BPositionIO* source,
|
|
||||||
const translator_info* info, BMessage* settings,
|
|
||||||
uint32 outType, BPositionIO* target, int32 baseType)
|
|
||||||
{
|
|
||||||
if (!outType)
|
|
||||||
outType = B_TRANSLATOR_BITMAP;
|
|
||||||
if (outType != B_TRANSLATOR_BITMAP || baseType != 0)
|
|
||||||
return B_NO_TRANSLATOR;
|
|
||||||
|
|
||||||
status_t err = B_NO_TRANSLATOR;
|
|
||||||
try {
|
|
||||||
IStreamWrapper istream("filename", source);
|
|
||||||
RgbaInputFile in(istream);
|
|
||||||
|
|
||||||
//Imath::Box2i dw = in.dataWindow();
|
|
||||||
const Imath::Box2i &displayWindow = in.displayWindow();
|
|
||||||
const Imath::Box2i &dataWindow = in.dataWindow();
|
|
||||||
//float a = in.pixelAspectRatio(); // TODO take into account the aspect ratio
|
|
||||||
int dataWidth = dataWindow.max.x - dataWindow.min.x + 1;
|
|
||||||
int dataHeight = dataWindow.max.y - dataWindow.min.y + 1;
|
|
||||||
int displayWidth = displayWindow.max.x - displayWindow.min.x + 1;
|
|
||||||
int displayHeight = displayWindow.max.y - displayWindow.min.y + 1;
|
|
||||||
|
|
||||||
// Write out the data to outDestination
|
|
||||||
// Construct and write Be bitmap header
|
|
||||||
TranslatorBitmap bitsHeader;
|
|
||||||
bitsHeader.magic = B_TRANSLATOR_BITMAP;
|
|
||||||
bitsHeader.bounds.left = 0;
|
|
||||||
bitsHeader.bounds.top = 0;
|
|
||||||
bitsHeader.bounds.right = displayWidth - 1;
|
|
||||||
bitsHeader.bounds.bottom = displayHeight - 1;
|
|
||||||
bitsHeader.rowBytes = 4 * displayWidth;
|
|
||||||
bitsHeader.colors = B_RGBA32;
|
|
||||||
bitsHeader.dataSize = bitsHeader.rowBytes * displayHeight;
|
|
||||||
if (swap_data(B_UINT32_TYPE, &bitsHeader,
|
|
||||||
sizeof(TranslatorBitmap), B_SWAP_HOST_TO_BENDIAN) != B_OK) {
|
|
||||||
return B_ERROR;
|
|
||||||
}
|
|
||||||
target->Write(&bitsHeader, sizeof(TranslatorBitmap));
|
|
||||||
|
|
||||||
Array2D <Rgba> pixels(dataHeight, dataWidth);
|
|
||||||
in.setFrameBuffer (&pixels[0][0] - dataWindow.min.y * dataWidth - dataWindow.min.x, 1, dataWidth);
|
|
||||||
in.readPixels (dataWindow.min.y, dataWindow.max.y);
|
|
||||||
|
|
||||||
float _gamma = 0.4545f;
|
|
||||||
float _exposure = 0.0f;
|
|
||||||
float _defog = 0.0f;
|
|
||||||
float _kneeLow = 0.0f;
|
|
||||||
float _kneeHigh = 5.0f;
|
|
||||||
|
|
||||||
float _fogR = 0.0f;
|
|
||||||
float _fogG = 0.0f;
|
|
||||||
float _fogB = 0.0f;
|
|
||||||
|
|
||||||
halfFunction<float>
|
|
||||||
rGamma (Gamma (_gamma,
|
|
||||||
_exposure,
|
|
||||||
_defog * _fogR,
|
|
||||||
_kneeLow,
|
|
||||||
_kneeHigh),
|
|
||||||
-HALF_MAX, HALF_MAX,
|
|
||||||
0.f, 255.f, 0.f, 0.f);
|
|
||||||
|
|
||||||
halfFunction<float>
|
|
||||||
gGamma (Gamma (_gamma,
|
|
||||||
_exposure,
|
|
||||||
_defog * _fogG,
|
|
||||||
_kneeLow,
|
|
||||||
_kneeHigh),
|
|
||||||
-HALF_MAX, HALF_MAX,
|
|
||||||
0.f, 255.f, 0.f, 0.f);
|
|
||||||
|
|
||||||
halfFunction<float>
|
|
||||||
bGamma (Gamma (_gamma,
|
|
||||||
_exposure,
|
|
||||||
_defog * _fogB,
|
|
||||||
_kneeLow,
|
|
||||||
_kneeHigh),
|
|
||||||
-HALF_MAX, HALF_MAX,
|
|
||||||
0.f, 255.f, 0.f, 0.f);
|
|
||||||
|
|
||||||
for (int y = displayWindow.min.y; y <= displayWindow.max.y; ++y) {
|
|
||||||
if (y < dataWindow.min.y
|
|
||||||
|| y > dataWindow.max.y) {
|
|
||||||
unsigned char sp[4];
|
|
||||||
sp[0] = 128;
|
|
||||||
sp[1] = 128;
|
|
||||||
sp[2] = 128;
|
|
||||||
sp[3] = 255;
|
|
||||||
for (int x = displayWindow.min.x; x <= displayWindow.max.x; ++x) {
|
|
||||||
target->Write(sp, 4);
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int x = displayWindow.min.x; x <= displayWindow.max.x; ++x) {
|
|
||||||
unsigned char sp[4];
|
|
||||||
if (x < dataWindow.min.x
|
|
||||||
|| x > dataWindow.max.x) {
|
|
||||||
sp[0] = 128;
|
|
||||||
sp[1] = 128;
|
|
||||||
sp[2] = 128;
|
|
||||||
sp[3] = 255;
|
|
||||||
} else {
|
|
||||||
const Imf::Rgba &rp = pixels[y][x];
|
|
||||||
|
|
||||||
sp[0] = (unsigned char)bGamma(rp.b);
|
|
||||||
sp[1] = (unsigned char)gGamma(rp.g);
|
|
||||||
sp[2] = (unsigned char)rGamma(rp.r);
|
|
||||||
sp[3] = 255;
|
|
||||||
}
|
|
||||||
target->Write(sp, 4);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
err = B_OK;
|
|
||||||
// } catch (const std::exception &e) {
|
|
||||||
// std::cerr << e.what() << std::endl;
|
|
||||||
} catch (...) {
|
|
||||||
}
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BView *
|
|
||||||
EXRTranslator::NewConfigView(TranslatorSettings *settings)
|
|
||||||
{
|
|
||||||
return new ConfigView();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
|
||||||
|
|
||||||
|
|
||||||
BTranslator *
|
|
||||||
make_nth_translator(int32 n, image_id you, uint32 flags, ...)
|
|
||||||
{
|
|
||||||
if (n != 0)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return new EXRTranslator();
|
|
||||||
}
|
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2008, Jérôme Duval. All rights reserved.
|
|
||||||
* Distributed under the terms of the MIT License.
|
|
||||||
*/
|
|
||||||
#ifndef EXR_TRANSLATOR_H
|
|
||||||
#define EXR_TRANSLATOR_H
|
|
||||||
|
|
||||||
|
|
||||||
#include "BaseTranslator.h"
|
|
||||||
|
|
||||||
|
|
||||||
#define EXR_TRANSLATOR_VERSION B_TRANSLATION_MAKE_VERSION(0, 1, 0)
|
|
||||||
#define EXR_IMAGE_FORMAT 'EXRI'
|
|
||||||
|
|
||||||
#define EXR_IN_QUALITY 0.90
|
|
||||||
#define EXR_IN_CAPABILITY 0.90
|
|
||||||
#define BITS_IN_QUALITY 1
|
|
||||||
#define BITS_IN_CAPABILITY 1
|
|
||||||
|
|
||||||
#define EXR_OUT_QUALITY 0.8
|
|
||||||
#define EXR_OUT_CAPABILITY 0.8
|
|
||||||
#define BITS_OUT_QUALITY 1
|
|
||||||
#define BITS_OUT_CAPABILITY 0.9
|
|
||||||
|
|
||||||
|
|
||||||
class EXRTranslator : public BaseTranslator {
|
|
||||||
public:
|
|
||||||
EXRTranslator();
|
|
||||||
virtual ~EXRTranslator();
|
|
||||||
|
|
||||||
virtual status_t DerivedIdentify(BPositionIO *inSource,
|
|
||||||
const translation_format *inFormat, BMessage *ioExtension,
|
|
||||||
translator_info *outInfo, uint32 outType);
|
|
||||||
|
|
||||||
virtual status_t DerivedTranslate(BPositionIO *inSource,
|
|
||||||
const translator_info *inInfo, BMessage *ioExtension,
|
|
||||||
uint32 outType, BPositionIO *outDestination, int32 baseType);
|
|
||||||
|
|
||||||
virtual BView *NewConfigView(TranslatorSettings *settings);
|
|
||||||
|
|
||||||
private:
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // EXR_TRANSLATOR_H
|
|
||||||
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
/*
|
|
||||||
* EXRTranslator.rdef
|
|
||||||
*/
|
|
||||||
|
|
||||||
resource app_signature "application/x-vnd.Haiku-EXRTranslator";
|
|
||||||
|
|
||||||
resource app_version {
|
|
||||||
major = 0,
|
|
||||||
middle = 1,
|
|
||||||
minor = 0,
|
|
||||||
variety = 0,
|
|
||||||
internal = 0,
|
|
||||||
short_info = "0.1.0",
|
|
||||||
long_info = "Haiku EXRTranslator Add-Ons."
|
|
||||||
};
|
|
||||||
@@ -1,43 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2008, Jérôme Duval. All rights reserved.
|
|
||||||
* Distributed under the terms of the MIT License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "IStreamWrapper.h"
|
|
||||||
|
|
||||||
IStreamWrapper::IStreamWrapper(const char *filename, BPositionIO *stream)
|
|
||||||
: IStream(filename),
|
|
||||||
fStream(stream, 2048)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
IStreamWrapper::~IStreamWrapper()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
IStreamWrapper::read(char c[/*n*/], int n)
|
|
||||||
{
|
|
||||||
int actual = fStream.Read(c, n);
|
|
||||||
if (actual < B_OK) {
|
|
||||||
|
|
||||||
}
|
|
||||||
return (actual == n);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Int64
|
|
||||||
IStreamWrapper::tellg()
|
|
||||||
{
|
|
||||||
return fStream.Position();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
IStreamWrapper::seekg(Int64 pos)
|
|
||||||
{
|
|
||||||
fStream.Seek(pos, SEEK_SET);
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2008, Jérôme Duval. All rights reserved.
|
|
||||||
* Distributed under the terms of the MIT License.
|
|
||||||
*/
|
|
||||||
#ifndef ISTREAM_WRAPPER_H
|
|
||||||
#define ISTREAM_WRAPPER_H
|
|
||||||
|
|
||||||
#include <DataIO.h>
|
|
||||||
#include <ImfIO.h>
|
|
||||||
|
|
||||||
#include "StreamBuffer.h"
|
|
||||||
|
|
||||||
using namespace Imf;
|
|
||||||
|
|
||||||
class IStreamWrapper : public IStream {
|
|
||||||
public:
|
|
||||||
IStreamWrapper(const char *filename, BPositionIO *stream);
|
|
||||||
virtual ~IStreamWrapper();
|
|
||||||
|
|
||||||
virtual bool read(char c[/*n*/], int n);
|
|
||||||
virtual Int64 tellg();
|
|
||||||
virtual void seekg(Int64 pos);
|
|
||||||
|
|
||||||
private:
|
|
||||||
StreamBuffer fStream;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* ISTREAM_WRAPPER_H */
|
|
||||||
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
SubDir HAIKU_TOP src add-ons translators exr ;
|
|
||||||
|
|
||||||
SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) shared ] ;
|
|
||||||
|
|
||||||
AddResources EXRTranslator : EXRTranslator.rdef ;
|
|
||||||
|
|
||||||
local architectureObject ;
|
|
||||||
for architectureObject in [ MultiArchSubDirSetup ] {
|
|
||||||
on $(architectureObject) {
|
|
||||||
UseBuildFeatureHeaders openexr ;
|
|
||||||
Includes [ FGristFiles ConfigView.cpp EXRTranslator.cpp EXRGamma.cpp
|
|
||||||
IStreamWrapper.cpp ]
|
|
||||||
: [ BuildFeatureAttribute openexr : headers ] ;
|
|
||||||
|
|
||||||
Translator [ MultiArchDefaultGristFiles EXRTranslator ] :
|
|
||||||
main.cpp
|
|
||||||
ConfigView.cpp
|
|
||||||
EXRGamma.cpp
|
|
||||||
EXRTranslator.cpp
|
|
||||||
IStreamWrapper.cpp
|
|
||||||
: be translation textencoding [ TargetLibstdc++ ]
|
|
||||||
[ MultiArchDefaultGristFiles libtranslatorsutils.a ]
|
|
||||||
[ BuildFeatureAttribute openexr : libraries ]
|
|
||||||
localestub
|
|
||||||
: true
|
|
||||||
;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DoCatalogs EXRTranslator :
|
|
||||||
x-vnd.Haiku-EXRTranslator
|
|
||||||
:
|
|
||||||
ConfigView.cpp
|
|
||||||
EXRTranslator.cpp
|
|
||||||
main.cpp
|
|
||||||
;
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2005-2006, Axel Dörfler, [email protected]. All rights reserved.
|
|
||||||
* Distributed under the terms of the MIT License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#include "EXRTranslator.h"
|
|
||||||
|
|
||||||
#include "TranslatorWindow.h"
|
|
||||||
#include <Application.h>
|
|
||||||
#include <Catalog.h>
|
|
||||||
|
|
||||||
#undef B_TRANSLATION_CONTEXT
|
|
||||||
#define B_TRANSLATION_CONTEXT "main"
|
|
||||||
|
|
||||||
int
|
|
||||||
main(int /*argc*/, char **/*argv*/)
|
|
||||||
{
|
|
||||||
BApplication app("application/x-vnd.Haiku-EXRTranslator");
|
|
||||||
|
|
||||||
status_t result;
|
|
||||||
result = LaunchTranslatorWindow(new EXRTranslator,
|
|
||||||
B_TRANSLATE("EXR Settings"));
|
|
||||||
if (result != B_OK)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
app.Run();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1910,13 +1910,6 @@ AboutView::_CreateCreditsView()
|
|||||||
.SetLicense(kBSDFourClause)
|
.SetLicense(kBSDFourClause)
|
||||||
.SetURL("http://bzip.org"));
|
.SetURL("http://bzip.org"));
|
||||||
|
|
||||||
// OpenEXR copyrights
|
|
||||||
_AddPackageCredit(PackageCredit("OpenEXR")
|
|
||||||
.SetCopyright(B_TRANSLATE(COPYRIGHT_STRING "2002-2014 Industrial "
|
|
||||||
"Light & Magic, a division of Lucas Digital Ltd. LLC."))
|
|
||||||
.SetLicense(kBSDThreeClause)
|
|
||||||
.SetURL("https://openexr.com"));
|
|
||||||
|
|
||||||
// acpica copyrights
|
// acpica copyrights
|
||||||
_AddPackageCredit(PackageCredit("ACPI Component Architecture (ACPICA)")
|
_AddPackageCredit(PackageCredit("ACPI Component Architecture (ACPICA)")
|
||||||
.SetCopyright(COPYRIGHT_STRING "1999-2018 Intel Corp.")
|
.SetCopyright(COPYRIGHT_STRING "1999-2018 Intel Corp.")
|
||||||
|
|||||||
@@ -28,15 +28,6 @@ requires {
|
|||||||
#ifdef HAIKU_BUILD_FEATURE_%HAIKU_PACKAGING_ARCH%_libicns_ENABLED
|
#ifdef HAIKU_BUILD_FEATURE_%HAIKU_PACKAGING_ARCH%_libicns_ENABLED
|
||||||
lib:libicns
|
lib:libicns
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAIKU_BUILD_FEATURE_%HAIKU_PACKAGING_ARCH%_openexr_ENABLED
|
|
||||||
#ifdef HAIKU_PACKAGING_ARCH_x86_gcc2
|
|
||||||
lib:libilmimf
|
|
||||||
lib:libilmimfutil
|
|
||||||
#else
|
|
||||||
lib:libilmimf_2_4
|
|
||||||
lib:libilmimfutil_2_4
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#ifdef HAIKU_BUILD_FEATURE_%HAIKU_PACKAGING_ARCH%_jasper_ENABLED
|
#ifdef HAIKU_BUILD_FEATURE_%HAIKU_PACKAGING_ARCH%_jasper_ENABLED
|
||||||
lib:libjasper
|
lib:libjasper
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -35,13 +35,6 @@ requires {
|
|||||||
lib:libpng_%HAIKU_SECONDARY_PACKAGING_ARCH% >= 16.0
|
lib:libpng_%HAIKU_SECONDARY_PACKAGING_ARCH% >= 16.0
|
||||||
lib:libtiff_%HAIKU_SECONDARY_PACKAGING_ARCH% >= 5.2
|
lib:libtiff_%HAIKU_SECONDARY_PACKAGING_ARCH% >= 5.2
|
||||||
lib:libwebp_%HAIKU_SECONDARY_PACKAGING_ARCH%
|
lib:libwebp_%HAIKU_SECONDARY_PACKAGING_ARCH%
|
||||||
lib:libhalf_%HAIKU_SECONDARY_PACKAGING_ARCH%
|
|
||||||
lib:libiex_%HAIKU_SECONDARY_PACKAGING_ARCH%
|
|
||||||
lib:libiexmath_%HAIKU_SECONDARY_PACKAGING_ARCH%
|
|
||||||
lib:libilmthread_%HAIKU_SECONDARY_PACKAGING_ARCH%
|
|
||||||
lib:libimath_%HAIKU_SECONDARY_PACKAGING_ARCH%
|
|
||||||
lib:libilmimf_%HAIKU_SECONDARY_PACKAGING_ARCH%
|
|
||||||
lib:libilmimfutil_%HAIKU_SECONDARY_PACKAGING_ARCH%
|
|
||||||
#endif
|
#endif
|
||||||
lib:libsolv_%HAIKU_SECONDARY_PACKAGING_ARCH%
|
lib:libsolv_%HAIKU_SECONDARY_PACKAGING_ARCH%
|
||||||
lib:libsolvext_%HAIKU_SECONDARY_PACKAGING_ARCH%
|
lib:libsolvext_%HAIKU_SECONDARY_PACKAGING_ARCH%
|
||||||
|
|||||||
@@ -36,9 +36,6 @@ requires {
|
|||||||
lib:libtiff_%HAIKU_SECONDARY_PACKAGING_ARCH% >= 5.6
|
lib:libtiff_%HAIKU_SECONDARY_PACKAGING_ARCH% >= 5.6
|
||||||
lib:libwebp_%HAIKU_SECONDARY_PACKAGING_ARCH%
|
lib:libwebp_%HAIKU_SECONDARY_PACKAGING_ARCH%
|
||||||
|
|
||||||
lib:libilmimf_2_4_%HAIKU_SECONDARY_PACKAGING_ARCH%
|
|
||||||
lib:libilmimfutil_2_4_%HAIKU_SECONDARY_PACKAGING_ARCH%
|
|
||||||
|
|
||||||
lib:libavcodec_%HAIKU_SECONDARY_PACKAGING_ARCH% >= 60
|
lib:libavcodec_%HAIKU_SECONDARY_PACKAGING_ARCH% >= 60
|
||||||
lib:libavfilter_%HAIKU_SECONDARY_PACKAGING_ARCH% >= 9
|
lib:libavfilter_%HAIKU_SECONDARY_PACKAGING_ARCH% >= 9
|
||||||
lib:libavformat_%HAIKU_SECONDARY_PACKAGING_ARCH% >= 60
|
lib:libavformat_%HAIKU_SECONDARY_PACKAGING_ARCH% >= 60
|
||||||
|
|||||||
Reference in New Issue
Block a user