mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 06:24:58 +00:00
LibPDF: Add scaffolding for function objects
See PDF 1.7 Spec, "3.9 Functions".
This commit is contained in:
parent
21894f1cde
commit
9204252d02
3 changed files with 80 additions and 0 deletions
|
@ -14,6 +14,7 @@ set(SOURCES
|
|||
Fonts/Type0Font.cpp
|
||||
Fonts/Type1Font.cpp
|
||||
Fonts/Type1FontProgram.cpp
|
||||
Function.cpp
|
||||
Interpolation.cpp
|
||||
ObjectDerivatives.cpp
|
||||
Page.cpp
|
||||
|
|
58
Userland/Libraries/LibPDF/Function.cpp
Normal file
58
Userland/Libraries/LibPDF/Function.cpp
Normal file
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Nico Weber <thakis@chromium.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibPDF/Function.h>
|
||||
|
||||
// PDF 1.7 spec, 3.9 Functions
|
||||
|
||||
namespace PDF {
|
||||
|
||||
class SampledFunction final : public Function {
|
||||
public:
|
||||
virtual PDFErrorOr<ReadonlySpan<float>> evaluate(ReadonlySpan<float>) const override;
|
||||
};
|
||||
|
||||
PDFErrorOr<ReadonlySpan<float>> SampledFunction::evaluate(ReadonlySpan<float>) const
|
||||
{
|
||||
return Error(Error::Type::RenderingUnsupported, "SampledFunction not yet implemented"_string);
|
||||
}
|
||||
|
||||
class ExponentialInterpolationFunction final : public Function {
|
||||
public:
|
||||
virtual PDFErrorOr<ReadonlySpan<float>> evaluate(ReadonlySpan<float>) const override;
|
||||
};
|
||||
|
||||
PDFErrorOr<ReadonlySpan<float>> ExponentialInterpolationFunction::evaluate(ReadonlySpan<float>) const
|
||||
{
|
||||
return Error(Error::Type::RenderingUnsupported, "ExponentialInterpolationFunction not yet implemented"_string);
|
||||
}
|
||||
|
||||
class StitchingFunction final : public Function {
|
||||
public:
|
||||
virtual PDFErrorOr<ReadonlySpan<float>> evaluate(ReadonlySpan<float>) const override;
|
||||
};
|
||||
|
||||
PDFErrorOr<ReadonlySpan<float>> StitchingFunction::evaluate(ReadonlySpan<float>) const
|
||||
{
|
||||
return Error(Error::Type::RenderingUnsupported, "StitchingFunction not yet implemented"_string);
|
||||
}
|
||||
|
||||
class PostScriptCalculatorFunction final : public Function {
|
||||
public:
|
||||
virtual PDFErrorOr<ReadonlySpan<float>> evaluate(ReadonlySpan<float>) const override;
|
||||
};
|
||||
|
||||
PDFErrorOr<ReadonlySpan<float>> PostScriptCalculatorFunction::evaluate(ReadonlySpan<float>) const
|
||||
{
|
||||
return Error(Error::Type::RenderingUnsupported, "PostScriptCalculatorFunction not yet implemented"_string);
|
||||
}
|
||||
|
||||
PDFErrorOr<NonnullRefPtr<Function>> Function::create(Document*, NonnullRefPtr<Object>)
|
||||
{
|
||||
return Error(Error::Type::RenderingUnsupported, "Function creation not yet implemented"_string);
|
||||
}
|
||||
|
||||
}
|
21
Userland/Libraries/LibPDF/Function.h
Normal file
21
Userland/Libraries/LibPDF/Function.h
Normal file
|
@ -0,0 +1,21 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Nico Weber <thakis@chromium.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Forward.h>
|
||||
#include <LibPDF/Value.h>
|
||||
|
||||
namespace PDF {
|
||||
|
||||
class Function : public RefCounted<Function> {
|
||||
public:
|
||||
static PDFErrorOr<NonnullRefPtr<Function>> create(Document*, NonnullRefPtr<Object>);
|
||||
virtual ~Function() = default;
|
||||
virtual PDFErrorOr<ReadonlySpan<float>> evaluate(ReadonlySpan<float>) const = 0;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue