Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  SkPngEncoderBase.h

  Sprache: C
 

/*
 * Copyright 2024 Google LLC
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkPngEncoderBase_DEFINED
#define SkPngEncoderBase_DEFINED

#include <cstddef>
#include <cstdint>

#include <optional>
#include "include/core/SkImageInfo.h"
#include "include/core/SkSpan.h"
#include "include/encode/SkEncoder.h"
#include "include/private/SkEncodedInfo.h"

class SkPixmap;

// This class implements functionality shared between `SkPngEncoderImpl` and
// `SkPngRustEncoderImpl`.
class SkPngEncoderBase : public SkEncoder {
public:
    struct TargetInfo {
        std::optional<SkImageInfo> fSrcRowInfo;
        std::optional<SkImageInfo> fDstRowInfo;
        SkEncodedInfo fDstInfo;
        size_t fDstRowSize;
    };

    // Gets the `fDstRowInfo` that `fSrcRowInfo` should be converted into before
    // encoding and uses SkConvertPixels to transform source rows into
    // ready-to-encode rows (and the `fDstRowSize` of such rows).
    //
    // For example, `kRGBA_F32_SkColorType` source will be encoded as
    // `SkEncodedInfo::kRGBA_Color` with 16 `bitsPerComponent`.
    //
    // 'fDstInfo' stores extra information for libpng.
    //
    // Returns `std::nullopt` if `srcInfo` is not supported by the PNG encoder.
    static std::optional<TargetInfo> getTargetInfo(const SkImageInfo& srcInfo);

protected:
    SkPngEncoderBase(TargetInfo targetInfo, const SkPixmap& src);

    // SkEncoder override:
    bool onEncodeRows(int numRows) final;

    // Called from `onEncodeRows` to encode the given `row` (in `dstInfo` format
    // that was passed to the `SkPngEncoderBase`'s constructor).
    virtual bool onEncodeRow(SkSpan<const uint8_t> row) = 0;

    // Called from `onEncodeRows` to finalize the encoded PNG (e.g. write the
    // `IEND` chunk).
    virtual bool onFinishEncoding() = 0;

    const TargetInfo& targetInfo() const { return fTargetInfo; }

private:
    TargetInfo fTargetInfo;
    bool fFinishedEncoding = false;
};

#endif  // SkPngEncoderBase_DEFINED

Messung V0.5 in Prozent
C=72 H=100 G=86

¤ Dauer der Verarbeitung: 0.3 Sekunden  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Open Source Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Statistik
#Sources=277311
#Domains=752002