OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
ossimPngWriter Class Reference

#include <ossimPngWriter.h>

Inheritance diagram for ossimPngWriter:
ossimImageFileWriter ossimImageWriter ossimProcessInterface ossimConnectableObjectListener ossimOutputSource ossimListener ossimSource ossimConnectableObject ossimErrorStatusInterface ossimObject ossimListenerManager ossimPropertyInterface ossimReferenced

Public Member Functions

 ossimPngWriter ()
 
virtual ~ossimPngWriter ()
 
virtual ossimString getShortName () const
 
virtual ossimString getLongName () const
 
virtual ossimString getClassName () const
 
virtual ossimString getExtension () const
 Returns a 3-letter extension from the image type descriptor (theOutputImageType) that can be used for image file extensions. More...
 
virtual void getImageTypeList (std::vector< ossimString > &imageTypeList) const
 void getImageTypeList(std::vector<ossimString>& imageTypeList)const More...
 
virtual bool isOpen () const
 
virtual bool open ()
 
virtual void close ()
 
virtual bool saveState (ossimKeywordlist &kwl, const char *prefix=0) const
 saves the state of the object. More...
 
virtual bool loadState (const ossimKeywordlist &kwl, const char *prefix=0)
 Method to the load (recreate) the state of an object from a keyword list. More...
 
virtual void setProperty (ossimRefPtr< ossimProperty > property)
 Will set the property whose name matches the argument "property->getName()". More...
 
virtual ossimRefPtr< ossimPropertygetProperty (const ossimString &name) const
 
virtual void getPropertyNames (std::vector< ossimString > &propertyNames) const
 Pushes this's names onto the list of property names. More...
 
bool hasImageType (const ossimString &imageType) const
 bool hasImageType(const ossimString& imageType) const More...
 
void setLut (const ossimNBandLutDataObject &lut)
 
ossimString getCompressionLevel () const
 Get the png compression level as a string. More...
 
bool setCompressionLevel (const ossimString &level)
 Set the png compression level from a string. More...
 
bool getAlphaChannelFlag (void) const
 Retrieve the writer's setting for whether or not to add an alpha channel to the output png image. More...
 
void setAlphaChannelFlag (bool flag)
 Set the writer to add an alpha channel to the output png image. More...
 
virtual bool writeStream ()
 Method to write the image to a stream. More...
 
virtual bool setOutputStream (std::ostream &stream)
 Sets the output stream to write to. More...
 
- Public Member Functions inherited from ossimImageFileWriter
 ossimImageFileWriter (const ossimFilename &filename=ossimFilename(), ossimImageSource *inputSource=0, ossimObject *owner=0)
 The writer will own the sequencer. More...
 
virtual ~ossimImageFileWriter ()
 
virtual ossimObjectgetObject ()
 
virtual const ossimObjectgetObject () const
 
virtual bool getOutputHasInternalOverviews (void) const
 Examples of writers that always generate internal overviews are ossim_kakadu_jp2 and ossim_kakadu_nitf_j2k. More...
 
virtual void setTileSize (const ossimIpt &tileSize)
 Sets the output image tiling size if supported by the writer. More...
 
virtual bool writeEnviHeaderFile ()
 Will write an envi header file. More...
 
virtual bool writeErsHeaderFile ()
 Will write an ER Mapper header file. More...
 
virtual bool writeExternalGeometryFile ()
 Will write an external geometry file. More...
 
virtual bool writeFgdcFile ()
 Will write an fgdc file. More...
 
virtual bool writeHistogramFile ()
 Returns true on success, false on error. More...
 
virtual bool writeJpegWorldFile ()
 Will write a jpeg world file. More...
 
virtual bool writeOverviewFile (ossim_uint16 tiff_compress_type=1, ossim_int32 jpeg_compress_quality=75, bool includeR0=false)
 Write out an ossim overview file from the source_file. More...
 
virtual bool writeReadmeFile ()
 Will write a readme file. More...
 
virtual bool writeTiffWorldFile ()
 Will write a world file. More...
 
virtual bool writeWorldFile ()
 Will write a world file. More...
 
virtual bool writeMetaDataFiles ()
 Convenience method that calls meta data write methods that are flagged to be called. More...
 
virtual void setAreaOfInterest (const ossimIrect &inputRect)
 
virtual void changeSequencer (ossimImageSourceSequencer *sequencer)
 Sets the sequencer and connects it to the input of this. More...
 
virtual ossimImageSourceSequencergetSequencer ()
 
virtual void initialize ()
 Initialize method. More...
 
virtual bool execute ()
 Calls: writeFile() writeMetaDataFiles() More...
 
virtual bool setOutputStream (ossimRefPtr< ossimOStream > stream)
 Sets the output stream to write to. More...
 
virtual ossimRefPtr< ossimOStreamgetOutputStream () const
 Method to return the stream attached to output. More...
 
virtual void setPercentComplete (double percentComplete)
 
virtual void setOutputImageType (ossim_int32 type)
 
virtual void setOutputImageType (const ossimString &type)
 
virtual ossim_int32 getOutputImageType () const
 
virtual ossimString getOutputImageTypeString () const
 
virtual void setOutputName (const ossimString &outputName)
 
virtual void setFilename (const ossimFilename &file)
 
virtual const ossimFilenamegetFilename () const
 
virtual bool canConnectMyInputTo (ossim_int32 inputIndex, const ossimConnectableObject *object) const
 required to be overriden by derived classes More...
 
virtual void disconnectInputEvent (ossimConnectionEvent &event)
 
virtual void connectInputEvent (ossimConnectionEvent &event)
 
virtual void propertyEvent (ossimPropertyEvent &event)
 
virtual bool getWriteImageFlag () const
 Control flags... More...
 
virtual bool getWriteHistogramFlag () const
 
virtual bool getWriteOverviewFlag () const
 
virtual bool getScaleToEightBitFlag () const
 
virtual bool getWriteEnviHeaderFlag () const
 
virtual bool getWriteErsHeaderFlag () const
 
virtual bool getWriteExternalGeometryFlag () const
 
virtual bool getWriteFgdcFlag () const
 
virtual bool getWriteJpegWorldFileFlag () const
 
virtual bool getWriteReadmeFlag () const
 
virtual bool getWriteTiffWorldFileFlag () const
 
virtual bool getWriteWorldFileFlag () const
 
virtual void setWriteImageFlag (bool flag)
 
virtual void setWriteOverviewFlag (bool flag)
 
virtual void setWriteHistogramFlag (bool flag)
 
virtual void setScaleToEightBitFlag (bool flag)
 
virtual void setWriteEnviHeaderFlag (bool flag)
 
virtual void setWriteErsHeaderFlag (bool flag)
 
virtual void setWriteExternalGeometryFlag (bool flag)
 
virtual void setWriteFgdcFlag (bool flag)
 
virtual void setWriteJpegWorldFile (bool flag)
 
virtual void setWriteReadme (bool flag)
 
virtual void setWriteTiffWorldFile (bool flag)
 
virtual void setWriteWorldFile (bool flag)
 
virtual ossim_uint16 getOverviewCompressType () const
 
virtual ossim_int32 getOverviewJpegCompressQuality () const
 
virtual void setOverviewCompressType (ossim_uint16 type)
 
virtual void setOverviewJpegCompressQuality (ossim_int32 quality)
 
virtual bool addListener (ossimListener *listener)
 Overrides base "addListener" this will capture the pointer and then call the base class "addListener". More...
 
virtual bool removeListener (ossimListener *listener)
 Overrides base "removeListener". More...
 
virtual void setPixelType (ossimPixelType type)
 If "point" the coordinate tie points are relative to the center of the pixel. More...
 
virtual void setPixelType (const ossimString &type)
 If "point" the coordinate tie points are relative to the center of the pixel. More...
 
virtual ossimPixelType getPixelType () const
 
virtual void getPixelTypeString (ossimString &type) const
 
- Public Member Functions inherited from ossimImageWriter
 ossimImageWriter (ossimObject *owner=NULL)
 
 ossimImageWriter (ossimObject *owner, ossim_uint32 numberOfInputs, ossim_uint32 numberOfOutputs, bool inputListIsFixed, bool outputListIsFixed)
 
virtual ~ossimImageWriter ()
 
virtual bool setViewingRect (const ossimIrect &aRect)
 
virtual ossimIrect getAreaOfInterest () const
 
- Public Member Functions inherited from ossimOutputSource
 ossimOutputSource (ossimObject *owner=NULL)
 
 ossimOutputSource (ossimObject *owner, ossim_uint32 inputListSize, ossim_uint32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimOutputSource ()
 
virtual bool open (const ossimString &outputName)
 
virtual const ossimStringgetOutputName ()
 
- Public Member Functions inherited from ossimSource
 ossimSource (ossimObject *owner=0)
 
 ossimSource (ossimObject *owner, ossim_uint32 inputListSize, ossim_uint32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimSource ()
 
virtual bool isSourceEnabled () const
 
virtual void enableSource ()
 
virtual void disableSource ()
 
virtual bool getEnableFlag () const
 
virtual void setEnableFlag (bool flag)
 
virtual bool isInitialized () const
 
virtual void setInitializedFlag (bool flag)
 
virtual std::ostream & print (std::ostream &out) const
 Outputs theErrorStatus as an ossimErrorCode and an ossimString. More...
 
- Public Member Functions inherited from ossimConnectableObject
 ossimConnectableObject (ossimObject *owner=0)
 Base constructor of this object. More...
 
 ossimConnectableObject (ossimObject *owner, ossim_int32 inputListSize, ossim_int32 outputListSize, bool inputListIsFixedFlag=true, bool outputListIsFixedFlag=true)
 
virtual ~ossimConnectableObject ()
 
void setId (const ossimId &id)
 All connectable objects will have id's. More...
 
const ossimIdgetId () const
 Will allow us to get this object's id. More...
 
const ossimObjectgetOwner () const
 Fetches the current owner, most likely a container but not limited to one. More...
 
virtual void changeOwner (ossimObject *owner)
 Permits changing the object's owner. More...
 
virtual void setDescription (const ossimString &description)
 
virtual ossimString getDescription () const
 
virtual bool isConnected (ossimConnectableObjectDirectionType direction=CONNECTABLE_DIRECTION_INPUT) const
 will check the direction specified to see if all slots are full. More...
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findConnectableObject(const ossimId &id))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findObjectOfType(RTTItypeid typeId, ossimConnectableObjectDirectionType directionType, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findObjectOfType(const ossimString &obj, ossimConnectableObjectDirectionType directionType, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual ossimConnectableObject *findInputObjectOfType(const ossimString &className))
 
virtual ossim_int32 findInputIndex (const ossimConnectableObject *object)
 Return a valid index of the input list if the passed in object is found else return -1. More...
 
virtual ossim_int32 findInputIndex (const ossimId &id)
 Return a valid index of the input list if the passed id is found else return -1. More...
 
virtual ossim_int32 findOutputIndex (const ossimConnectableObject *object)
 Return a valid index of the output list if the passed in object is found else return -1. More...
 
virtual ossim_int32 findOutputIndex (const ossimId &id)
 Return a valid index of the output list if the passed in object is found else return -1. More...
 
virtual ossim_int32 getMyInputIndexToConnectTo (ossimConnectableObject *object) const
 Should return the first available index to connect to. More...
 
virtual ossim_int32 getMyOutputIndexToConnectTo (ossimConnectableObject *object) const
 Should return the first available index to connect to. More...
 
virtual bool canConnectMyOutputTo (ossim_int32 myOutputIndex, const ossimConnectableObject *object) const
 default implementation is to allow anyone to connect to us. More...
 
virtual void disconnect (ossimConnectableObject *object=0)
 Will disconnect the object passed in. More...
 
virtual void disconnect (const ossimId &id)
 Will disconnect the object passed in. More...
 
virtual ossimRefPtr< ossimConnectableObjectdisconnectMyInput (ossim_int32 inputIndex, bool disconnectOutputFlag=true, bool createEventFlag=true)
 Will disconnect the object at the given input index and generate a connection event. More...
 
virtual void disconnectMyInput (ossimConnectableObject *input, bool disconnectOutputFlag=true, bool createEventFlag=true)
 Finds the index of the passed in input and calls disconnectMyInput(inputIndex, disconnectOutputFlag, createEventFlag);. More...
 
virtual void disconnectMyInputs (ConnectableObjectList &inputList, bool disconnectOutputFlag=true, bool createEventFlag=true)
 
virtual ossimRefPtr< ossimConnectableObjectdisconnectMyOutput (ossim_int32 outputIndex, bool disconnectInputFlag=true, bool createEventFlag=true)
 Will disconnect the object at the given output index and generate a connection event. More...
 
virtual void disconnectMyOutput (ossimConnectableObject *output, bool disconnectInputFlag=true, bool createEventFlag=true)
 Will disconnect the output object. More...
 
virtual void disconnectMyOutputs (ConnectableObjectList &outputList, bool disconnectOutputFlag=true, bool createEventFlag=true)
 
virtual void disconnectAllInputs ()
 Will disconnect all of the input objects. More...
 
virtual void disconnectAllOutputs ()
 Will disconnect all of the output objects. More...
 
virtual ossim_int32 connectMyInputTo (ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
 Will try to connect this objects input to the passed in object. More...
 
virtual ossim_int32 connectMyInputTo (ossim_int32 inputIndex, ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
 Will connect the specified input to the passed in object. More...
 
virtual bool connectMyInputTo (ConnectableObjectList &inputList, bool makeOutputConnection=true, bool createEventFlag=true)
 
virtual ossim_int32 connectMyOutputTo (ossimConnectableObject *outputObject, bool makeInputConnection=true, bool createEventFlag=true)
 Will try to connect this objects output to the passed in object. More...
 
virtual bool connectMyOutputTo (ConnectableObjectList &outputList, bool makeInputConnection=true, bool createEventFlag=true)
 
virtual bool connectInputList (ConnectableObjectList &inputList)
 Will disconnect itself from all inputs and reset to the passed in input list. More...
 
virtual bool connectOutputList (ConnectableObjectList &outputList)
 Will disconnect itself from all outputs and reset to the passed in output list. More...
 
virtual ossim_uint32 getNumberOfInputs () const
 Returns the number of input objects. More...
 
virtual ossim_uint32 getNumberOfOutputs () const
 Return the number of output objects. More...
 
ossimConnectableObjectgetInput (ossim_uint32 index=0)
 returns the object at the specified index. More...
 
const ossimConnectableObjectgetInput (ossim_uint32 index=0) const
 returns the object at the specified index. More...
 
ossimConnectableObjectgetOutput (ossim_uint32 index=0)
 returns the object at the specified index. More...
 
const ossimConnectableObjectgetOutput (ossim_uint32 index=0) const
 returns the object at the specified index. More...
 
virtual void setNumberOfInputs (ossim_int32 numberOfInputs)
 Will set the number of inputs. More...
 
virtual bool getInputListIsFixedFlag () const
 
virtual bool getOutputListIsFixedFlag () const
 
virtual void setNumberOfOutputs (ossim_int32 numberOfInputs)
 Will set the number of outputs. More...
 
const ConnectableObjectListgetInputList () const
 
const ConnectableObjectListgetOutputList () const
 
ConnectableObjectListgetInputList ()
 
ConnectableObjectListgetOutputList ()
 
 OSSIM_DEPRECATE_METHOD (virtual void findAllObjectsOfType(ConnectableObjectList &result, const RTTItypeid &typeInfo, bool recurse=true))
 
 OSSIM_DEPRECATE_METHOD (virtual void findAllObjectsOfType(ConnectableObjectList &result, const ossimString &className, bool recurse=true))
 
virtual void propagateEventToOutputs (ossimEvent &event)
 
virtual void propagateEventToInputs (ossimEvent &event)
 
virtual void setProperty (const ossimString &name, const ossimString &value)
 
virtual ossim_uint32 saveStateOfAllInputs (ossimKeywordlist &kwl, bool saveThisStateFlag=true, ossim_uint32 objectIndex=1, const char *prefix=0) const
 Save the state of all inputs to a keyword list. More...
 
virtual bool fillContainer (ossimConnectableContainer &container)
 Inserts this object and all of its children and inputs into the container provided. More...
 
bool moveInputUp (const ossimId &id)
 Moves the input connection matching id up one in the connection list. More...
 
bool moveInputDown (const ossimId &id)
 Moves the input connection matching id down one in the connection list. More...
 
bool moveInputToTop (const ossimId &id)
 Moves the input connection matching id to the top of the connection list. More...
 
bool moveInputToBottom (const ossimId &id)
 Moves the input connection matching id to the bottom of the connection list. More...
 
virtual void accept (ossimVisitor &visitor)
 We will add a visitor interface for all connectable objects. More...
 
- Public Member Functions inherited from ossimObject
 ossimObject ()
 
virtual ~ossimObject ()
 
virtual ossimObjectdup () const
 
virtual RTTItypeid getType () const
 
virtual bool canCastTo (ossimObject *obj) const
 
virtual bool canCastTo (const RTTItypeid &id) const
 
virtual bool canCastTo (const ossimString &parentClassName) const
 
virtual bool isEqualTo (const ossimObject &obj, ossimCompareType compareType=OSSIM_COMPARE_FULL) const
 
- Public Member Functions inherited from ossimReferenced
 ossimReferenced ()
 
 ossimReferenced (const ossimReferenced &)
 
ossimReferencedoperator= (const ossimReferenced &)
 
void ref () const
 increment the reference count by one, indicating that this object has another pointer which is referencing it. More...
 
void unref () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
void unref_nodelete () const
 decrement the reference count by one, indicating that a pointer to this object is referencing it. More...
 
int referenceCount () const
 
- Public Member Functions inherited from ossimListenerManager
 ossimListenerManager ()
 
virtual ~ossimListenerManager ()
 
virtual void fireEvent (ossimEvent &event)
 
virtual bool findListener (ossimListener *listener)
 
- Public Member Functions inherited from ossimPropertyInterface
 ossimPropertyInterface ()
 
virtual ~ossimPropertyInterface ()
 
virtual ossimString getPropertyValueAsString (const ossimString &name) const
 
void getPropertyList (std::vector< ossimRefPtr< ossimProperty > > &propertyList) const
 
void setProperties (std::vector< ossimRefPtr< ossimProperty > > &propertyList)
 
- Public Member Functions inherited from ossimErrorStatusInterface
 ossimErrorStatusInterface ()
 
virtual ~ossimErrorStatusInterface ()
 
virtual ossimErrorCode getErrorStatus () const
 
virtual ossimString getErrorStatusString () const
 
virtual void setErrorStatus (ossimErrorCode error_status) const
 
virtual void setErrorStatus () const
 
virtual void clearErrorStatus () const
 
bool hasError () const
 
- Public Member Functions inherited from ossimProcessInterface
 ossimProcessInterface ()
 
virtual ~ossimProcessInterface ()
 
virtual void abort ()
 
bool needsAborting () const
 
bool isAbortRequested () const
 
bool isAborted () const
 
bool isExecuting () const
 
ossimProcessStatus getProcessStatus () const
 
virtual void setProcessStatus (ossimProcessStatus processStatus)
 
virtual double getPercentComplete () const
 
virtual ossimListenerManagergetManager ()
 
void enableEvents ()
 
void disableEvents ()
 
void setCurrentMessage (const ossimString &message)
 
virtual std::ostream & print (std::ostream &out) const
 
- Public Member Functions inherited from ossimConnectableObjectListener
 ossimConnectableObjectListener ()
 
virtual ~ossimConnectableObjectListener ()
 
virtual void processEvent (ossimEvent &event)
 ProcessEvent. More...
 
virtual void objectDestructingEvent (ossimObjectDestructingEvent &)
 
virtual void connectionEvent (ossimConnectionEvent &)
 
virtual void disconnectOutputEvent (ossimConnectionEvent &)
 
virtual void connectOutputEvent (ossimConnectionEvent &)
 
virtual void addObjectEvent (ossimContainerEvent &)
 
virtual void removeObjectEvent (ossimContainerEvent &)
 
virtual void containerEvent (ossimContainerEvent &)
 
virtual void refreshEvent (ossimRefreshEvent &)
 
- Public Member Functions inherited from ossimListener
 ossimListener ()
 
virtual ~ossimListener ()
 
void enableListener ()
 
void disableListener ()
 
void setListenerEnableFlag (bool flag)
 
bool isListenerEnabled () const
 
bool getListenerEnableFlag () const
 

Private Member Functions

virtual bool writeFile ()
 Writes the file to disk or a stream. More...
 
bool doSwap (ossimScalarType outputScalar) const
 
bool isLutEnabled () const
 
void writeOptionalChunks (png_structp pp, png_infop info)
 writes optionial chunks. More...
 
void writeTransparentColorChunk (png_structp pp, png_infop info)
 Write transparent color chunk (tRNS) Location:
Multiple:
More...
 
void writeGammaChunk (png_structp pp, png_infop info)
 Write gamm chunk (gAMMA) Location: Before PLTE, before first IDAT. More...
 
void writeBackgroundColorChunk (png_structp pp, png_infop info)
 Write background color chunk (bKGD) Location: After PLTE, before first IDAT. More...
 
void writeTimeStampChunk (png_structp pp, png_infop info)
 Write time stamp chunk (tIME). More...
 
void writeLatinTextChunk (png_structp pp, png_infop info)
 Write any text (tEXt, zTXt). More...
 
void writeInternationalTextChunk (png_structp pp, png_infop info)
 Write any text (iTXt). More...
 
void writeHistogram (png_structp pp, png_infop info)
 Write histogram (hIST) Location: after PLTE, before first IDAT Multiple: no. More...
 
void writeSuggestedPalette (png_structp pp, png_infop info)
 Write suggested palette (sPLT) Location: before first IDAT Multiple: yes. More...
 
void writeSignificantBits (png_structp pp, png_infop info)
 Write significant bits (sBIT) Location: before PLTE and first IDAT Multiple: no. More...
 
void writePhysicalPixelDimensions (png_structp pp, png_infop info)
 Write physical pixel dimensions (pHYs) Location: before first IDAT Multiple: no. More...
 
void writePhysicalScale (png_structp pp, png_infop info)
 Write physical scale (sCAL) Location: before first IDAT Multiple: no. More...
 
void writeImageOffset (png_structp pp, png_infop info)
 Write image offset (oFFs) Location: before first IDAT Multiple: no. More...
 
void writePixelCalibration (png_structp pp, png_infop info)
 Write pixel calibration (pCAL) Location: after PLTE, before first IDAT Multiple: no. More...
 
void writeFractalParameters (png_structp pp, png_infop info)
 Write fractal parameters (fRAc) Location: anywhere Multiple: yes. More...
 
ossim_int32 getColorType (ossim_int32 bands) const
 Get the png color type. More...
 
ossim_int32 getBitDepth (ossimScalarType outputScalar) const
 

Static Private Member Functions

static void pngWriteData (png_structp png_ptr, png_bytep data, png_size_t length)
 Callback method for writing to stream. More...
 
static void pngFlush (png_structp png_ptr)
 Callback method for a flush. More...
 

Private Attributes

std::ostream * theOutputStream
 
bool theOwnsStreamFlag
 
ossim_int32 theCompressionLevel
 Compression level from zlib.h: Z_NO_COMPRESSION 0 Z_BEST_SPEED 1 Z_BEST_COMPRESSION 9 Z_DEFAULT_COMPRESSION (-1) More...
 
ossim_int32 theInterlaceSupport
 Interlace support: PNG_INTERLACE_ADAM7 PNG_INTERLACE_NONE. More...
 
ossim_int32 theCompressionStratagy
 Z_FILTERED 1 Z_HUFFMAN_ONLY 2 Z_RLE 3 Z_FIXED 4 Z_DEFAULT_STRATEGY 0. More...
 
ossim_int32 thePngFilter
 PNG_NO_FILTERS 0x00 PNG_FILTER_NONE 0x08 PNG_FILTER_SUB 0x10 PNG_FILTER_UP 0x20 PNG_FILTER_AVG 0x40 PNG_FILTER_PAETH 0x80. More...
 
bool theGammaFlag
 For gamma support. More...
 
ossim_float64 theGamma
 
bool theTimeFlag
 Time support, either on or off. More...
 
bool theAlphaChannelFlag
 For alpha channel support. More...
 
bool theBackgroundFlag
 For background support. More...
 
ossim_uint16 theBackgroundRed
 
ossim_uint16 theBackgroundGreen
 
ossim_uint16 theBackgroundBlue
 
ossim_uint16 theBackgroundGray
 
bool theTransparentFlag
 For transparent color support. More...
 
ossim_uint16 theTransparentRed
 
ossim_uint16 theTransparentGreen
 
ossim_uint16 theTransparentBlue
 
ossim_uint16 theTransparentGray
 

Additional Inherited Members

- Public Types inherited from ossimConnectableObject
enum  ossimConnectableObjectDirectionType { CONNECTABLE_DIRECTION_NONE = 0, CONNECTABLE_DIRECTION_INPUT = 1, CONNECTABLE_DIRECTION_OUTPUT = 2 }
 
typedef std::vector< ossimRefPtr< ossimConnectableObject > > ConnectableObjectList
 
- Public Types inherited from ossimProcessInterface
enum  ossimProcessStatus {
  PROCESS_STATUS_UNKNOWN = 0, PROCESS_STATUS_EXECUTING = 1, PROCESS_STATUS_ABORTED = 2, PROCESS_STATUS_ABORT_REQUEST = 3,
  PROCESS_STATUS_NOT_EXECUTING = 4
}
 
- Protected Member Functions inherited from ossimImageFileWriter
bool writeWorldFile (const ossimFilename &file)
 Common world file writer method. More...
 
- Protected Member Functions inherited from ossimSource
 ossimSource (const ossimSource &rhs)
 
const ossimSourceoperator= (const ossimSource &rhs)
 
- Protected Member Functions inherited from ossimConnectableObject
ossimConnectableObjectfindObjectOfType (ConnectableObjectList *connectableList, ossimVisitor &visitor)
 
- Protected Member Functions inherited from ossimReferenced
virtual ~ossimReferenced ()
 
- Protected Member Functions inherited from ossimListenerManager
 ossimListenerManager (const ossimListenerManager &rhs)
 
- Protected Attributes inherited from ossimImageFileWriter
ossimRefPtr< ossimImageSourceSequencertheInputConnection
 
ossimRefPtr< ossimViewControllertheViewController
 
ossimListenertheProgressListener
 
ossimFilename theFilename
 
ossimString theOutputImageType
 
bool theWriteImageFlag
 
bool theWriteOverviewFlag
 
bool theWriteHistogramFlag
 
bool theScaleToEightBitFlag
 
ossim_uint16 theOverviewCompressType
 
ossim_int32 theOverviewJpegCompressQuality
 
bool theWriteEnviHeaderFlag
 External meta data writer flags. More...
 
bool theWriteErsHeaderFlag
 
bool theWriteExternalGeometryFlag
 
bool theWriteFgdcFlag
 
bool theWriteJpegWorldFileFlag
 
bool theWriteReadmeFlag
 
bool theWriteTiffWorldFileFlag
 
bool theWriteWorldFileFlag
 
bool theAutoCreateDirectoryFlag
 
ossimUnitType theLinearUnits
 If not a geographic projection this allows the user to set the linear units of the output tag to be: More...
 
ossimPixelType thePixelType
 OSSIM_PIXEL_IS_POINT = 0, OSSIM_PIXEL_IS_AREA = 1. More...
 
- Protected Attributes inherited from ossimImageWriter
ossimIrect theAreaOfInterest
 
- Protected Attributes inherited from ossimOutputSource
ossimString theOutputName
 
- Protected Attributes inherited from ossimSource
bool theEnableFlag
 
bool theInitializedFlag
 
- Protected Attributes inherited from ossimConnectableObject
ossimId theId
 
ossimString theDescription
 
ossimObjecttheOwner
 
bool theInputListIsFixedFlag
 Indicates whether the theInputObjectList is fixed. More...
 
bool theOutputListIsFixedFlag
 Indicates whether the theOutputObjectList is fixed. More...
 
ConnectableObjectList theInputObjectList
 Holds a list of input objects. More...
 
ConnectableObjectList theOutputObjectList
 Holds a list of output objects. More...
 
- Protected Attributes inherited from ossimListenerManager
std::list< ossimListener * > theListenerList
 
bool theEnabledFlag
 
std::list< ossimListener * > theDelayedAdd
 
std::list< ossimListener * > theDelayedRemove
 
bool theFireEventFlag
 
- Protected Attributes inherited from ossimErrorStatusInterface
ossimErrorCode theErrorStatus
 
- Protected Attributes inherited from ossimProcessInterface
double thePercentComplete
 
ossimProcessStatus theProcessStatus
 
ossimString theMessage
 
bool theEventFlag
 
- Protected Attributes inherited from ossimListener
bool theListenerEnableFlag
 

Detailed Description

Definition at line 23 of file ossimPngWriter.h.

Constructor & Destructor Documentation

◆ ossimPngWriter()

ossimPngWriter::ossimPngWriter ( )

Definition at line 52 of file ossimPngWriter.cpp.

54  theOutputStream(0),
55  theOwnsStreamFlag(false),
56  theCompressionLevel(Z_BEST_COMPRESSION),
57  theInterlaceSupport(PNG_INTERLACE_NONE),
58  theCompressionStratagy(Z_FILTERED),
59  thePngFilter(PNG_FILTER_NONE),
60  theGammaFlag(false),
61  theGamma(0.0),
62  theTimeFlag(true),
63  theAlphaChannelFlag(false),
64  theBackgroundFlag(false),
69  theTransparentFlag(false),
74 
75 {
76  if (traceDebug())
77  {
79  << "ossimPngWriter::ossimPngWriter entered" << std::endl;
80 #if OSSIM_ID_ENABLED
82  << "OSSIM_ID: "
83  << OSSIM_ID
84  << std::endl;
85 #endif
86  }
87 
88  // Since there is no internal geometry set the flag to write out one.
90 
91  theOutputImageType = "ossim_png";
92 }
ossim_uint16 theTransparentGreen
ossim_uint16 theBackgroundBlue
bool theTimeFlag
Time support, either on or off.
ossim_int32 theInterlaceSupport
Interlace support: PNG_INTERLACE_ADAM7 PNG_INTERLACE_NONE.
ossim_int32 thePngFilter
PNG_NO_FILTERS 0x00 PNG_FILTER_NONE 0x08 PNG_FILTER_SUB 0x10 PNG_FILTER_UP 0x20 PNG_FILTER_AVG 0x40 P...
bool theBackgroundFlag
For background support.
ossim_uint16 theTransparentGray
ossim_uint16 theBackgroundGray
ossimImageFileWriter(const ossimFilename &filename=ossimFilename(), ossimImageSource *inputSource=0, ossimObject *owner=0)
The writer will own the sequencer.
std::ostream * theOutputStream
ossim_uint16 theBackgroundRed
ossim_int32 theCompressionLevel
Compression level from zlib.h: Z_NO_COMPRESSION 0 Z_BEST_SPEED 1 Z_BEST_COMPRESSION 9 Z_DEFAULT_COMPR...
bool theAlphaChannelFlag
For alpha channel support.
bool theGammaFlag
For gamma support.
virtual void setWriteExternalGeometryFlag(bool flag)
ossim_float64 theGamma
bool theTransparentFlag
For transparent color support.
ossim_uint16 theTransparentBlue
ossim_uint16 theBackgroundGreen
ossim_uint16 theTransparentRed
ossim_int32 theCompressionStratagy
Z_FILTERED 1 Z_HUFFMAN_ONLY 2 Z_RLE 3 Z_FIXED 4 Z_DEFAULT_STRATEGY 0.
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ ~ossimPngWriter()

ossimPngWriter::~ossimPngWriter ( )
virtual

Definition at line 94 of file ossimPngWriter.cpp.

References close().

95 {
96  // This will flush stream and delete it if we own it.
97  close();
98 }
virtual void close()

Member Function Documentation

◆ close()

void ossimPngWriter::close ( )
virtual

Generic interface to allow one to close a consumer. For displays this might minimize the window and free up internal pointers for file writers it will make sure the file stream is closed and flushed.

Implements ossimOutputSource.

Definition at line 547 of file ossimPngWriter.cpp.

References theOutputStream, and theOwnsStreamFlag.

Referenced by open(), and ~ossimPngWriter().

548 {
549  if (theOutputStream)
550  {
551  theOutputStream->flush();
552 
553  if (theOwnsStreamFlag)
554  {
555  delete theOutputStream;
556  theOutputStream = 0;
557  theOwnsStreamFlag = false;
558  }
559  }
560 }
std::ostream * theOutputStream

◆ doSwap()

bool ossimPngWriter::doSwap ( ossimScalarType  outputScalar) const
private
Returns
true is swapping should be performed, false if not.

Definition at line 633 of file ossimPngWriter.cpp.

References ossim::byteOrder(), OSSIM_LITTLE_ENDIAN, and OSSIM_UINT8.

634 {
635  bool result = false;
636  if (outputScalar != OSSIM_UINT8)
637  {
639  {
640  result = true;
641  }
642  }
643  return result;
644 }
OSSIM_DLL ossimByteOrder byteOrder()
Definition: ossimCommon.cpp:54
8 bit unsigned integer

◆ getAlphaChannelFlag()

bool ossimPngWriter::getAlphaChannelFlag ( void  ) const

Retrieve the writer's setting for whether or not to add an alpha channel to the output png image.

Returns
true if the writer is configured to create an alpha channel.

Definition at line 995 of file ossimPngWriter.cpp.

References theAlphaChannelFlag.

996 {
997  return theAlphaChannelFlag;
998 }
bool theAlphaChannelFlag
For alpha channel support.

◆ getBitDepth()

ossim_int32 ossimPngWriter::getBitDepth ( ossimScalarType  outputScalar) const
private

Definition at line 908 of file ossimPngWriter.cpp.

References OSSIM_SINT16, OSSIM_UINT16, OSSIM_UINT8, and OSSIM_USHORT11.

909 {
910  // Can be 1, 2, 4, 8, or 16 bits/channel (from IHDR)
911  ossim_int32 bitDepth = 0;
912 
913  switch(outputScalar)
914  {
915  case OSSIM_UINT8:
916  bitDepth = 8;
917  break;
918  case OSSIM_SINT16:
919  case OSSIM_UINT16:
920  case OSSIM_USHORT11:
921  bitDepth = 16;
922  break;
923  default:
924  break;
925  }
926 
927  return bitDepth;
928 }
16 bit unsigned integer
16 bit signed integer
16 bit unsigned integer (11 bits used)
8 bit unsigned integer
int ossim_int32

◆ getClassName()

ossimString ossimPngWriter::getClassName ( ) const
virtual
Returns
"ossimPngWriter"

Reimplemented from ossimObject.

Definition at line 110 of file ossimPngWriter.cpp.

111 {
112  return ossimString("ossimPngWriter");
113 }

◆ getColorType()

ossim_int32 ossimPngWriter::getColorType ( ossim_int32  bands) const
private

Get the png color type.

Returns
png color type. One of: PNG_COLOR_TYPE_GRAY PNG_COLOR_TYPE_PALETTE PNG_COLOR_TYPE_RGB PNG_COLOR_TYPE_RGB_ALPHA PNG_COLOR_TYPE_GRAY_ALPHA

Definition at line 879 of file ossimPngWriter.cpp.

References theAlphaChannelFlag.

880 {
881  //---
882  //
883  //---
884  ossim_int32 colorType = PNG_COLOR_TYPE_RGB;
885 
887  {
888  if(bands == 1)
889  {
890  colorType = PNG_COLOR_TYPE_GRAY_ALPHA;
891  }
892  else
893  {
894  colorType = PNG_COLOR_TYPE_RGB_ALPHA;
895  }
896  }
897  else
898  {
899  if (bands == 1)
900  {
901  colorType = PNG_COLOR_TYPE_GRAY;
902  }
903  }
904 
905  return colorType;
906 }
bool theAlphaChannelFlag
For alpha channel support.
int ossim_int32

◆ getCompressionLevel()

ossimString ossimPngWriter::getCompressionLevel ( ) const

Get the png compression level as a string.

Returns
The level which will be one of: z_no_compression z_best_speed z_best_compression z_default_compression

Definition at line 930 of file ossimPngWriter.cpp.

References theCompressionLevel.

931 {
932  ossimString result = ossimString("z_default_compression");
933 
934  switch (theCompressionLevel)
935  {
936  case Z_NO_COMPRESSION:
937  result = ossimString("z_no_compression");
938  break;
939 
940  case Z_BEST_SPEED:
941  result = ossimString("z_best_speed");
942  break;
943 
944  case Z_BEST_COMPRESSION:
945  result = ossimString("z_best_compression");
946  break;
947 
948  default:
949  break;
950  }
951  return result;
952 }
ossim_int32 theCompressionLevel
Compression level from zlib.h: Z_NO_COMPRESSION 0 Z_BEST_SPEED 1 Z_BEST_COMPRESSION 9 Z_DEFAULT_COMPR...

◆ getExtension()

ossimString ossimPngWriter::getExtension ( ) const
virtual

Returns a 3-letter extension from the image type descriptor (theOutputImageType) that can be used for image file extensions.

Parameters
imageTypestring representing image type.
Returns
the 3-letter string extension.

Reimplemented from ossimImageFileWriter.

Definition at line 567 of file ossimPngWriter.cpp.

568 {
569  return ossimString("png");
570 }

◆ getImageTypeList()

void ossimPngWriter::getImageTypeList ( std::vector< ossimString > &  imageTypeList) const
virtual

void getImageTypeList(std::vector<ossimString>& imageTypeList)const

Appends this writer image types to list "imageTypeList".

This writer only has one type "png".

Parameters
imageTypeListstl::vector<ossimString> list to append to.

Implements ossimImageFileWriter.

Definition at line 562 of file ossimPngWriter.cpp.

Referenced by ossimPngWriterFactory::getImageTypeList().

563 {
564  imageTypeList.push_back(ossimString("ossim_png"));
565 }

◆ getLongName()

ossimString ossimPngWriter::getLongName ( ) const
virtual
Returns
"ossim png writer"

Reimplemented from ossimObject.

Definition at line 105 of file ossimPngWriter.cpp.

106 {
107  return ossimString("ossim png writer");
108 }

◆ getProperty()

ossimRefPtr< ossimProperty > ossimPngWriter::getProperty ( const ossimString name) const
virtual
Parameters
nameName of property to return.
Returns
A pointer to a property object which matches "name".

Reimplemented from ossimImageFileWriter.

Definition at line 604 of file ossimPngWriter.cpp.

605 {
606  if (name == COMPRESSION_LEVEL_KW)
607  {
608  ossimStringProperty* stringProp =
609  new ossimStringProperty(name,
611  false); // editable flag
612  stringProp->addConstraint(ossimString("z_no_compression"));
613  stringProp->addConstraint(ossimString("z_best_speed"));
614  stringProp->addConstraint(ossimString("z_best_compression"));
615  stringProp->addConstraint(ossimString("z_default_compression"));
616  return stringProp;
617  }
618  else if (name == ADD_ALPHA_CHANNEL_KW)
619  {
620  return new ossimBooleanProperty(ADD_ALPHA_CHANNEL_KW,
622  }
624 }
void addConstraint(const ossimString &value)
ossimString getCompressionLevel() const
Get the png compression level as a string.
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
bool theAlphaChannelFlag
For alpha channel support.

◆ getPropertyNames()

void ossimPngWriter::getPropertyNames ( std::vector< ossimString > &  propertyNames) const
virtual

Pushes this's names onto the list of property names.

Parameters
propertyNamesarray to add this's property names to.

Reimplemented from ossimImageFileWriter.

Definition at line 626 of file ossimPngWriter.cpp.

627 {
628  propertyNames.push_back(ossimString(COMPRESSION_LEVEL_KW));
629  propertyNames.push_back(ossimString(ADD_ALPHA_CHANNEL_KW));
631 }
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const

◆ getShortName()

ossimString ossimPngWriter::getShortName ( ) const
virtual
Returns
"png writer"

Reimplemented from ossimObject.

Definition at line 100 of file ossimPngWriter.cpp.

101 {
102  return ossimString("ossim_png_writer");
103 }

◆ hasImageType()

bool ossimPngWriter::hasImageType ( const ossimString imageType) const
virtual

bool hasImageType(const ossimString& imageType) const

Parameters
imageTypestring representing image type.
Returns
true if "imageType" is supported by writer.

Reimplemented from ossimImageFileWriter.

Definition at line 572 of file ossimPngWriter.cpp.

573 {
574  if ( (imageType == "ossim_png") || (imageType == "image/png") )
575  {
576  return true;
577  }
578 
579  return false;
580 }

◆ isLutEnabled()

bool ossimPngWriter::isLutEnabled ( ) const
private

Definition at line 646 of file ossimPngWriter.cpp.

647 {
648  // Temp drb...
649  return false;
650 }

◆ isOpen()

bool ossimPngWriter::isOpen ( ) const
virtual

Implements ossimOutputSource.

Definition at line 513 of file ossimPngWriter.cpp.

References theOutputStream.

Referenced by writeFile().

514 {
515  if (theOutputStream)
516  {
517  return true;
518  }
519  return false;
520 }
std::ostream * theOutputStream

◆ loadState()

bool ossimPngWriter::loadState ( const ossimKeywordlist kwl,
const char *  prefix = 0 
)
virtual

Method to the load (recreate) the state of an object from a keyword list.

Return true if ok or false on error.

Reimplemented from ossimImageFileWriter.

Definition at line 497 of file ossimPngWriter.cpp.

References ossimKeywordlist::find().

499 {
500  const char* value;
501 
502  value = kwl.find(prefix, ADD_ALPHA_CHANNEL_KW);
503  if(value)
504  {
505  setAlphaChannelFlag( ossimString(value).toBool() );
506  }
507 
508  theOutputImageType = "png";
509 
510  return ossimImageFileWriter::loadState(kwl, prefix);
511 }
const char * find(const char *key) const
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
void setAlphaChannelFlag(bool flag)
Set the writer to add an alpha channel to the output png image.

◆ open()

bool ossimPngWriter::open ( )
virtual

Allows a generic interface to open a consumer for writing. If you are a display writer then you would probably show the window or init the device context for writing.

Implements ossimOutputSource.

Definition at line 522 of file ossimPngWriter.cpp.

References ossimString::c_str(), close(), ossimString::empty(), ossimImageFileWriter::theFilename, theOutputStream, and theOwnsStreamFlag.

Referenced by writeFile().

523 {
524  close();
525 
526  // Check for empty filenames.
527  if (theFilename.empty())
528  {
529  return false;
530  }
531 
532  // ossimOFStream* os = new ossimOFStream();
533  std::ofstream* os = new std::ofstream();
534  os->open(theFilename.c_str(), ios::out | ios::binary);
535  if(os->is_open())
536  {
537  theOutputStream = os;
538  theOwnsStreamFlag = true;
539  return true;
540  }
541  delete os;
542  os = 0;
543 
544  return false;
545 }
virtual void close()
std::ostream * theOutputStream
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396
bool empty() const
Definition: ossimString.h:411
std::basic_ofstream< char > ofstream
Class for char output file streams.
Definition: ossimIosFwd.h:47

◆ pngFlush()

void ossimPngWriter::pngFlush ( png_structp  png_ptr)
staticprivate

Callback method for a flush.

This is a required method for png_set_write_fn.

Definition at line 480 of file ossimPngWriter.cpp.

481 {
482  std::ostream* fp = (std::ostream*)png_get_io_ptr(png_ptr);
483  fp->flush();
484 }
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23

◆ pngWriteData()

void ossimPngWriter::pngWriteData ( png_structp  png_ptr,
png_bytep  data,
png_size_t  length 
)
staticprivate

Callback method for writing to stream.

This allows us to choose the stream; hence, writing to a file or memory. This will be passed to libpng's png_set_write_fn.

Definition at line 471 of file ossimPngWriter.cpp.

474 {
475  std::ostream* fp = (std::ostream*)png_get_io_ptr(png_ptr);
476 
477  fp->write((char*)data, length);
478 }
std::basic_ostream< char > ostream
Base class for char output streams.
Definition: ossimIosFwd.h:23

◆ saveState()

bool ossimPngWriter::saveState ( ossimKeywordlist kwl,
const char *  prefix = 0 
) const
virtual

saves the state of the object.

Reimplemented from ossimImageFileWriter.

Definition at line 486 of file ossimPngWriter.cpp.

References ossimKeywordlist::add().

488 {
489  kwl.add( prefix,
490  ADD_ALPHA_CHANNEL_KW,
492  true );
493 
494  return ossimImageFileWriter::saveState(kwl, prefix);
495 }
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
static ossimString toString(bool aValue)
Numeric to string methods.
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
bool theAlphaChannelFlag
For alpha channel support.

◆ setAlphaChannelFlag()

void ossimPngWriter::setAlphaChannelFlag ( bool  flag)

Set the writer to add an alpha channel to the output png image.

Parameters
flagtrue to create an alpha channel.

Definition at line 1000 of file ossimPngWriter.cpp.

References theAlphaChannelFlag.

1001 {
1002  theAlphaChannelFlag = flag;
1003 }
bool theAlphaChannelFlag
For alpha channel support.

◆ setCompressionLevel()

bool ossimPngWriter::setCompressionLevel ( const ossimString level)

Set the png compression level from a string.

Parameters
levelShould be one of: z_no_compression z_best_speed z_best_compression z_default_compression
Returns
true on success, false if level is not accepted.

Definition at line 954 of file ossimPngWriter.cpp.

References ossimString::downcase(), status, and theCompressionLevel.

955 {
956  bool status = true;
957 
958  ossimString s = level;
959  s.downcase();
960 
961  if(s == "z_no_compression")
962  {
963  theCompressionLevel = Z_NO_COMPRESSION;
964  }
965  else if(s == "z_best_speed")
966  {
967  theCompressionLevel = Z_BEST_SPEED;
968  }
969  else if(s == "z_best_compression")
970  {
971  theCompressionLevel = Z_BEST_COMPRESSION;
972  }
973  else if(s == "z_default_compression")
974  {
975  theCompressionLevel = Z_DEFAULT_COMPRESSION;
976  }
977  else
978  {
979  status = false;
980  }
981 
982  if (traceDebug())
983  {
985  << "DEBUG:"
986  << "\nossimPngWriter::setCompressionLevel DEBUG"
987  << "passed in level: " << level.c_str()
988  << "writer level: " << getCompressionLevel().c_str()
989  << endl;
990  }
991 
992  return status;
993 }
ossimString getCompressionLevel() const
Get the png compression level as a string.
ossim_int32 theCompressionLevel
Compression level from zlib.h: Z_NO_COMPRESSION 0 Z_BEST_SPEED 1 Z_BEST_COMPRESSION 9 Z_DEFAULT_COMPR...
static ossimString downcase(const ossimString &aString)
Definition: ossimString.cpp:48
return status
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)

◆ setLut()

void ossimPngWriter::setLut ( const ossimNBandLutDataObject lut)

◆ setOutputStream()

bool ossimPngWriter::setOutputStream ( std::ostream &  stream)
virtual

Sets the output stream to write to.

The stream will not be closed/deleted by this object.

Parameters
outputThe stream to write to.

Reimplemented from ossimImageFileWriter.

Definition at line 1005 of file ossimPngWriter.cpp.

References theOutputStream, and theOwnsStreamFlag.

1006 {
1008  {
1009  delete theOutputStream;
1010  }
1011  theOutputStream = &stream;
1012  theOwnsStreamFlag = false;
1013  return true;
1014 }
std::ostream * theOutputStream

◆ setProperty()

void ossimPngWriter::setProperty ( ossimRefPtr< ossimProperty property)
virtual

Will set the property whose name matches the argument "property->getName()".

Parameters
propertyObject containing property to set.

Reimplemented from ossimImageFileWriter.

Definition at line 582 of file ossimPngWriter.cpp.

References ossimProperty::getName().

583 {
584  if (!property)
585  {
586  return;
587  }
588 
589  if (property->getName() == COMPRESSION_LEVEL_KW)
590  {
591  setCompressionLevel(property->valueToString());
592  }
593  else
594  if (property->getName() == ADD_ALPHA_CHANNEL_KW)
595  {
596  setAlphaChannelFlag( property->valueToString().toBool() );
597  }
598  else
599  {
601  }
602 }
virtual void valueToString(ossimString &valueResult) const =0
void setAlphaChannelFlag(bool flag)
Set the writer to add an alpha channel to the output png image.
bool setCompressionLevel(const ossimString &level)
Set the png compression level from a string.
virtual void setProperty(ossimRefPtr< ossimProperty > property)
const ossimString & getName() const

◆ writeBackgroundColorChunk()

void ossimPngWriter::writeBackgroundColorChunk ( png_structp  pp,
png_infop  info 
)
private

Write background color chunk (bKGD) Location: After PLTE, before first IDAT.

Multiple: no

Definition at line 778 of file ossimPngWriter.cpp.

References theBackgroundBlue, theBackgroundFlag, theBackgroundGray, theBackgroundGreen, and theBackgroundRed.

Referenced by writeOptionalChunks().

779 {
781  {
782  png_color_16 background;
783  background.red = theBackgroundRed;
784  background.green = theBackgroundGreen;
785  background.blue = theBackgroundBlue;
786  background.gray = theBackgroundGray;
787  png_set_bKGD( pp, info, &background );
788  }
789 }
ossim_uint16 theBackgroundBlue
bool theBackgroundFlag
For background support.
ossim_uint16 theBackgroundGray
ossim_uint16 theBackgroundRed
ossim_uint16 theBackgroundGreen

◆ writeFile()

bool ossimPngWriter::writeFile ( )
privatevirtual

Writes the file to disk or a stream.

Returns
true on success, false on error.

Implements ossimImageFileWriter.

Definition at line 115 of file ossimPngWriter.cpp.

References ossimErrorStatusInterface::getErrorStatus(), ossimImageSourceSequencer::isMaster(), isOpen(), open(), ossimErrorCodes::OSSIM_OK, ossimImageFileWriter::theInputConnection, and writeStream().

116 {
118  {
119  return false;
120  }
121 
122  //---
123  // Make sure we can open the file. Note only the master process is used for
124  // writing...
125  //---
127  {
128  if (!isOpen())
129  {
130  open();
131  }
132  }
133 
134  return writeStream();
135 }
static const ossimErrorCode OSSIM_OK
virtual bool writeStream()
Method to write the image to a stream.
ossimRefPtr< ossimImageSourceSequencer > theInputConnection
virtual bool isOpen() const
virtual ossimErrorCode getErrorStatus() const
virtual bool open()

◆ writeFractalParameters()

void ossimPngWriter::writeFractalParameters ( png_structp  pp,
png_infop  info 
)
private

Write fractal parameters (fRAc) Location: anywhere Multiple: yes.

Definition at line 875 of file ossimPngWriter.cpp.

Referenced by writeOptionalChunks().

877 {}

◆ writeGammaChunk()

void ossimPngWriter::writeGammaChunk ( png_structp  pp,
png_infop  info 
)
private

Write gamm chunk (gAMMA) Location: Before PLTE, before first IDAT.

Multiple: no

Definition at line 791 of file ossimPngWriter.cpp.

References theGamma, and theGammaFlag.

Referenced by writeOptionalChunks().

792 {
793  if(theGammaFlag)
794  {
795  png_set_gAMA(pp, info, theGamma);
796  }
797 }
bool theGammaFlag
For gamma support.
ossim_float64 theGamma

◆ writeHistogram()

void ossimPngWriter::writeHistogram ( png_structp  pp,
png_infop  info 
)
private

Write histogram (hIST) Location: after PLTE, before first IDAT Multiple: no.

Definition at line 820 of file ossimPngWriter.cpp.

Referenced by writeOptionalChunks().

822 {}

◆ writeImageOffset()

void ossimPngWriter::writeImageOffset ( png_structp  pp,
png_infop  info 
)
private

Write image offset (oFFs) Location: before first IDAT Multiple: no.

Definition at line 867 of file ossimPngWriter.cpp.

Referenced by writeOptionalChunks().

869 {}

◆ writeInternationalTextChunk()

void ossimPngWriter::writeInternationalTextChunk ( png_structp  pp,
png_infop  info 
)
private

Write any text (iTXt).

Location: anywhere Multiple: yes

Definition at line 816 of file ossimPngWriter.cpp.

Referenced by writeOptionalChunks().

818 {}

◆ writeLatinTextChunk()

void ossimPngWriter::writeLatinTextChunk ( png_structp  pp,
png_infop  info 
)
private

Write any text (tEXt, zTXt).

Location: anywhere Multiple: yes

Definition at line 812 of file ossimPngWriter.cpp.

Referenced by writeOptionalChunks().

814 {}

◆ writeOptionalChunks()

void ossimPngWriter::writeOptionalChunks ( png_structp  pp,
png_infop  info 
)
private

writes optionial chunks.

Definition at line 652 of file ossimPngWriter.cpp.

References writeBackgroundColorChunk(), writeFractalParameters(), writeGammaChunk(), writeHistogram(), writeImageOffset(), writeInternationalTextChunk(), writeLatinTextChunk(), writePhysicalPixelDimensions(), writePhysicalScale(), writePixelCalibration(), writeSignificantBits(), writeSuggestedPalette(), writeTimeStampChunk(), and writeTransparentColorChunk().

653 {
654  //---
655  // NOTE:
656  // Per PNG spec
657  // Chunks with no explicit restrictions (``anywhere'') are nonetheless
658  // implicitly constrained to come after the PNG signature and IHDR
659  // chunk, before the IEND chunk, and not to fall between multiple
660  // IDAT chunks.
661  //---
662 
663  //---
664  // Write gamma chunk (gAMMA)
665  // Location: Before first IDAT and PLTE
666  // Multiple: no
667  //---
668  writeGammaChunk(pp, info);
669 
670  //---
671  // Write significant bits (sBIT)
672  // Location: before PLTE and first IDAT
673  // Multiple: no
674  //---
675  writeSignificantBits(pp, info);
676 
677  // Set the palette png_set_PLTE()
678 
679  //---
680  // Write transparent color chunk (tRNS)
681  // Location: After PLTE, before first IDAT.
682  // Multiple:
683  //---
684  writeTransparentColorChunk(pp, info);
685 
686  //---
687  // Write background color chunk (bKGD)
688  // Location: After PLTE, before first IDAT.
689  // Multiple: no
690  //---
691  writeBackgroundColorChunk(pp, info);
692 
693  //---
694  // Write time stamp chunk (tIME).
695  // Location: anywhere
696  // Multiple: no
697  //
698  //---
699  writeTimeStampChunk(pp, info);
700 
701  //---
702  // Write any text (tEXt, zTXt).
703  // Location: anywhere
704  // Multiple: yes
705  //---
706  writeLatinTextChunk(pp, info);
707 
708  //---
709  // Write any text (iTXt).
710  // Location: anywhere
711  // Multiple: yes
712  //---
713  writeInternationalTextChunk(pp, info);
714 
715  //---
716  // Write histogram (hIST)
717  // Location: after PLTE, before first IDAT
718  // Multiple: no
719  //---
720  writeHistogram(pp, info);
721 
722  //---
723  // Write suggested palette (sPLT)
724  // Location: before first IDAT
725  // Multiple: yes
726  //---
727  writeSuggestedPalette(pp, info);
728 
729  //---
730  // Write physical pixel dimensions (pHYs)
731  // Location: before first IDAT
732  // Multiple: no
733  //---
735 
736  //---
737  // Write physical scale (sCAL)
738  // Location: before first IDAT
739  // Multiple: no
740  //---
741  writePhysicalScale(pp, info);
742 
743  //---
744  // Write image offset (oFFs)
745  // Location: before first IDAT
746  // Multiple: no
747  //---
748  writeImageOffset(pp, info);
749 
750  //---
751  // Write pixel calibration (pCAL)
752  // Location: after PLTE, before first IDAT
753  // Multiple: no
754  //---
755  writePixelCalibration(pp, info);
756 
757  //---
758  // Write fractal parameters (fRAc)
759  // Location: anywhere
760  // Multiple: yes
761  //---
762  writeFractalParameters(pp, info);
763 }
void writeTransparentColorChunk(png_structp pp, png_infop info)
Write transparent color chunk (tRNS) Location: Multiple:
void writePhysicalScale(png_structp pp, png_infop info)
Write physical scale (sCAL) Location: before first IDAT Multiple: no.
void writeLatinTextChunk(png_structp pp, png_infop info)
Write any text (tEXt, zTXt).
void writeBackgroundColorChunk(png_structp pp, png_infop info)
Write background color chunk (bKGD) Location: After PLTE, before first IDAT.
void writeImageOffset(png_structp pp, png_infop info)
Write image offset (oFFs) Location: before first IDAT Multiple: no.
void writeFractalParameters(png_structp pp, png_infop info)
Write fractal parameters (fRAc) Location: anywhere Multiple: yes.
void writeInternationalTextChunk(png_structp pp, png_infop info)
Write any text (iTXt).
void writeSuggestedPalette(png_structp pp, png_infop info)
Write suggested palette (sPLT) Location: before first IDAT Multiple: yes.
void writePixelCalibration(png_structp pp, png_infop info)
Write pixel calibration (pCAL) Location: after PLTE, before first IDAT Multiple: no.
void writeHistogram(png_structp pp, png_infop info)
Write histogram (hIST) Location: after PLTE, before first IDAT Multiple: no.
void writeGammaChunk(png_structp pp, png_infop info)
Write gamm chunk (gAMMA) Location: Before PLTE, before first IDAT.
void writeTimeStampChunk(png_structp pp, png_infop info)
Write time stamp chunk (tIME).
void writeSignificantBits(png_structp pp, png_infop info)
Write significant bits (sBIT) Location: before PLTE and first IDAT Multiple: no.
void writePhysicalPixelDimensions(png_structp pp, png_infop info)
Write physical pixel dimensions (pHYs) Location: before first IDAT Multiple: no.

◆ writePhysicalPixelDimensions()

void ossimPngWriter::writePhysicalPixelDimensions ( png_structp  pp,
png_infop  info 
)
private

Write physical pixel dimensions (pHYs) Location: before first IDAT Multiple: no.

Definition at line 859 of file ossimPngWriter.cpp.

Referenced by writeOptionalChunks().

861 {}

◆ writePhysicalScale()

void ossimPngWriter::writePhysicalScale ( png_structp  pp,
png_infop  info 
)
private

Write physical scale (sCAL) Location: before first IDAT Multiple: no.

Definition at line 863 of file ossimPngWriter.cpp.

Referenced by writeOptionalChunks().

865 {}

◆ writePixelCalibration()

void ossimPngWriter::writePixelCalibration ( png_structp  pp,
png_infop  info 
)
private

Write pixel calibration (pCAL) Location: after PLTE, before first IDAT Multiple: no.

Definition at line 871 of file ossimPngWriter.cpp.

Referenced by writeOptionalChunks().

873 {}

◆ writeSignificantBits()

void ossimPngWriter::writeSignificantBits ( png_structp  pp,
png_infop  info 
)
private

Write significant bits (sBIT) Location: before PLTE and first IDAT Multiple: no.

Definition at line 824 of file ossimPngWriter.cpp.

References ossimImageSourceSequencer::getMaxPixelValue(), ossimImageSourceSequencer::getOutputScalarType(), max, OSSIM_UINT8, and ossimImageFileWriter::theInputConnection.

Referenced by writeOptionalChunks().

826 {
827  // Must be called before PLTE and first IDAT. No multiple sBIT chunks.
829  {
831  if (max <= 65535)
832  {
833  ossim_uint16 max16 = static_cast<ossim_uint16>(max);
834  png_byte bits = 16;
835  ossim_uint16 s = 0xffff;
836  while ( (s != 0x0001) && (s >= max16) )
837  {
838  s = s >> 1;
839  if (s < max) break;
840  --bits;
841  }
842 
843  // destroyed by png_destroy_write_struct ??? (drb)
844  png_color_8* sig_bit = new png_color_8;
845  sig_bit->red = bits;
846  sig_bit->green = bits;
847  sig_bit->blue = bits;
848  sig_bit->gray = bits;
849  sig_bit->alpha = bits;
850  png_set_sBIT(pp, info, sig_bit);
851  }
852  }
853 }
virtual double getMaxPixelValue(ossim_uint32 band=0) const
Returns the max pixel of the band.
unsigned short ossim_uint16
double ossim_float64
virtual ossimScalarType getOutputScalarType() const
This will be used to query the output pixel type of the tile source.
ossimRefPtr< ossimImageSourceSequencer > theInputConnection
#define max(a, b)
Definition: auxiliary.h:76
8 bit unsigned integer

◆ writeStream()

bool ossimPngWriter::writeStream ( )
virtual

Method to write the image to a stream.

Returns
true on success, false on error.

Reimplemented from ossimImageFileWriter.

Definition at line 137 of file ossimPngWriter.cpp.

References ossimImageFileWriter::theInputConnection.

Referenced by writeFile().

138 {
139  static const char MODULE[] = "ossimPngWriter::write";
140 
141  if (!theInputConnection) // Must have a sequencer...
142  {
143  if (traceDebug())
144  {
146  << MODULE << " DEBUG:\ntheInputConnection is NULL!" << endl;
147  }
148  return false;
149  }
150 
151  //---
152  // Make sure we have a stream. Note only the master process is used for
153  // writing...
154  //---
156  {
157  if (!theOutputStream)
158  {
160  << MODULE << " ERROR:"
161  << "\nNULL output stream!"
162  << "\nReturning from method." << std::endl;
163 
164  return false;
165  }
166  }
167 
168  // make sure we have a region of interest
170  {
173  }
174  else
175  {
177  }
178 
179  if(theAreaOfInterest.hasNans()) // Must have an area of interest...
180  {
181  if (traceDebug())
182  {
184  << MODULE << " ERROR: Area of interest has nans!"
185  << "Area of interest: "
187  << "\nReturning..." << endl;
188  }
189 
190  return false;
191  }
192 
193  // Get the number of bands. Must be one or three for this writer.
195  if (bands != 1 && bands != 3)
196  {
198  << MODULE << " Range Error:"
199  << "\nInvalid number of input bands! Must be one or three."
200  << "\nInput bands = " << bands
201  << "\nReturning from method." << endl;
202 
203  return false;
204  }
205 
206  //---
207  // PNG only supports unsigned 8 and 16 bit images, so scale if needed.
208  // Note: This needs to be done on all processes.
209  //---
211  if( ( (inputScalar != OSSIM_UINT8) &&
212  (inputScalar != OSSIM_UINT16) &&
213  (inputScalar != OSSIM_USHORT11) ) ||
214  ( (inputScalar != OSSIM_UINT8) && theScaleToEightBitFlag )
215  )
216  {
217  if (traceDebug())
218  {
220  << " WARNING:"
221  << "\nData is being scaled to 8 bit!"
222  << "\nOriginal scalar type: "
224  getEntryString(inputScalar).c_str()
225  << std::endl;
226  }
227 
228  //---
229  // Attach a scalar remapper to the end of the input chain. This will
230  // need to be unattached and deleted at the end of this.
231  //---
232  ossimImageSource* inputSource = new ossimScalarRemapper;
233  inputSource->connectMyInputTo(0, theInputConnection->getInput(0));
234  theInputConnection->connectMyInputTo(0, inputSource);
236  }
237 
239  setPercentComplete(0.0);
240 
242  {
244  bool swapFlag = doSwap(outputScalar);
245  ossim_int32 imageHeight
247  ossim_int32 imageWidth
251  ossim_int32 bytesPerPixel = ossim::scalarSizeInBytes(outputScalar);
252  ossim_int32 bytesPerRow = bands*imageWidth*bytesPerPixel;
253  ossim_int32 colorType = getColorType(bands);
254 
255  if ( bands == 1 )
256  {
258  }
259  else
260  if ( bands == 3 )
261  {
265  }
266 
267  if ( theAlphaChannelFlag == true )
268  {
269  bands += 1; // add in the alpha channel
270  bytesPerRow += imageWidth*bytesPerPixel;
271  }
272 
273  // Allocate a buffer (tile) to hold a row of bip-format tiles.
275  new ossimImageData(0,
276  outputScalar,
277  bands,
278  imageWidth,
279  tileHeight);
280  bipTile->initialize();
281 
282  //---
283  // Begin of png related stuff.
284  //---
285  png_structp pp = png_create_write_struct (PNG_LIBPNG_VER_STRING, 0, 0, 0);
286  png_infop info = png_create_info_struct (pp);
287 
288  if ( setjmp( png_jmpbuf(pp) ) )
289  {
291  << "Error writing image: " << theFilename.c_str()
292  << std::endl;
293  return false;
294  }
295 
296  //---
297  // Pass the static write and flush to libpng to allow us to use our
298  // stream instead of doing "png_init_io (pp, theOutputFilePtr);"
299  //---
300  png_set_write_fn( pp,
301  (png_voidp)theOutputStream,
302  (png_rw_ptr) &ossimPngWriter::pngWriteData,
303  (png_flush_ptr)&ossimPngWriter::pngFlush);
304 
305  // Set the compression level.
306  png_set_compression_level(pp, theCompressionLevel);
307 
308  //---
309  // Set the filtering.
310  // Note that palette images should usually not be filtered.
311  if (isLutEnabled())
312  {
313  png_set_filter(pp, PNG_FILTER_TYPE_BASE, PNG_FILTER_NONE);
314  png_set_compression_strategy(pp, Z_DEFAULT_STRATEGY);
315  }
316  else
317  {
318  // leave default filter selection alone
319  png_set_compression_strategy(pp, Z_FILTERED);
320  }
321 
322  if (traceDebug())
323  {
325  << MODULE << " DEBUG: "
326  << "\nInput scalar: "
328  getEntryString(inputScalar).c_str()
329  << "\nOutput scalar: "
331  getEntryString(outputScalar).c_str()
332  << "\nOutput Rect: " << theAreaOfInterest
333  << "\nSwap flag: " << swapFlag
334  << "\nbytesPerRow: " << bytesPerRow
335  << "\nimageWidth: " << imageWidth
336  << "\nimageHeight: " << imageHeight
337  << "\ngitDepth: " << getBitDepth(outputScalar)
338  << "\ngetColorType(bands): " << colorType
339  << endl;
340  }
341 
342  png_set_IHDR(pp,
343  info,
344  imageWidth,
345  imageHeight,
346  getBitDepth(outputScalar),
347  colorType,
349  PNG_COMPRESSION_TYPE_DEFAULT,
350  PNG_FILTER_TYPE_DEFAULT);
351 
352  // Set the palette png_set_PLTE() in writeOptionalChunks()
353  writeOptionalChunks(pp, info);
354 
355  png_write_info(pp, info);
356 
357  // png_set_packing(pp);
358 
359  // Write the image.
360  if(theInterlaceSupport) // interlaced...
361  {
362  // Requires reading whole image into memory...
364  << "Interlace support not implemented yet!"
365  << std::endl;
366  return false;
367  }
368  else // not interlaced...
369  {
373 
374  //---
375  // Loop through and grab a row of tiles and copy to the buffer.
376  // Then write the buffer to the png file.
377  // Get the next row of tiles ... until finished.
378  //---
379 
380  // Row loop, in line direction...
381  for (ossim_uint32 i=0; ( (i<maxY) && (!needsAborting()) ); ++i)
382  {
383  ossimIrect buf_rect = theAreaOfInterest;
384  buf_rect.set_uly(theAreaOfInterest.ul().y+i*tileHeight);
385  buf_rect.set_lry(buf_rect.ul().y + tileHeight - 1);
386 
387  bipTile->setImageRectangle(buf_rect);
388  void* bipBuf = bipTile->getBuf();
389 
390 
391  // Grab lines of data that span the entire width of the image.
393  if ( t.valid() )
394  {
395  if ( theAlphaChannelFlag )
396  {
397  t->computeAlphaChannel();
398  t->unloadTileToBipAlpha(bipBuf, buf_rect, buf_rect);
399  }
400  else
401  {
402  t->unloadTile( bipBuf, buf_rect, buf_rect, OSSIM_BIP);
403  }
404 
405  // Copy the buffer to the png file.
406  ossim_int32 lines_to_copy =
407  min( (buf_rect.lr().y-buf_rect.ul().y+1),
408  (theAreaOfInterest.lr().y-buf_rect.ul().y+1) );
409 
410  if (traceDebug())
411  {
413  << MODULE
414  << "buf_rect: " << buf_rect
415  << "lines_to_copy: " << lines_to_copy << endl;
416  }
417 
418  if(!needsAborting())
419  {
420  if(swapFlag)
421  {
422  ossimEndian endian;
423  endian.swap((ossim_uint16*)bipBuf,
424  imageWidth*lines_to_copy*bands);
425  }
426 
427  ossim_uint8* buf = (ossim_uint8*)bipBuf;
428  ossim_int32 buf_offset = 0;
429  for (ossim_int32 line=0; line<lines_to_copy; ++line)
430  {
431  png_bytep rowp = (png_bytep)&buf[buf_offset];
432  png_write_row(pp, rowp);
433  buf_offset += bytesPerRow;
434  }
435 
436  } // if ( !getProcessStatus() )
437 
438  double dPercentComplete = (100.0*(i+1)) / maxY;
439  setPercentComplete( dPercentComplete );
440 
441  } // if ( t.valid() )
442 
443  } // End of loop through tiles in the y direction.
444 
445  } // Not interlace write block.
446 
447  png_write_end(pp, 0);
448  png_destroy_write_struct(&pp, &info);
449 
450  close();
451 
452  } // End of if(theInputConnection->isMaster()) block.
453 
454  else // slave process
455  {
457  }
458 
459  if(needsAborting())
460  {
462  }
463  else
464  {
466  }
467 
468  return true;
469 }
virtual ossimRefPtr< ossimImageData > getTile(const ossimIrect &rect, ossim_uint32 resLevel=0)
void set_uly(ossim_int32 y)
Definition: ossimIrect.h:666
virtual void computeAlphaChannel()
Computes the alpha channel.
virtual void setImageRectangle(const ossimIrect &rect)
16 bit unsigned integer
ossim_int32 theInterlaceSupport
Interlace support: PNG_INTERLACE_ADAM7 PNG_INTERLACE_NONE.
virtual ossim_uint32 getNumberOfOutputBands() const
Returns the number of bands in a tile returned from this TileSource.
bool valid() const
Definition: ossimRefPtr.h:75
ossimIrect theAreaOfInterest
const ossimIpt & ul() const
Definition: ossimIrect.h:274
virtual void close()
ossim_uint16 theTransparentGray
unsigned short ossim_uint16
virtual void setProcessStatus(ossimProcessStatus processStatus)
virtual void initialize()
Initialize the data buffer.
static void pngFlush(png_structp png_ptr)
Callback method for a flush.
ossimConnectableObject * getInput(ossim_uint32 index=0)
returns the object at the specified index.
static ossimScalarTypeLut * instance()
Returns the static instance of an ossimScalarTypeLut object.
std::ostream * theOutputStream
virtual void setAreaOfInterest(const ossimIrect &areaOfInterest)
virtual ossimScalarType getOutputScalarType() const
This will be used to query the output pixel type of the tile source.
ossimRefPtr< ossimImageSourceSequencer > theInputConnection
ossim_int32 theCompressionLevel
Compression level from zlib.h: Z_NO_COMPRESSION 0 Z_BEST_SPEED 1 Z_BEST_COMPRESSION 9 Z_DEFAULT_COMPR...
bool isLutEnabled() const
unsigned int ossim_uint32
OSSIM_DLL ossim_uint32 scalarSizeInBytes(ossimScalarType scalarType)
const ossimIpt & lr() const
Definition: ossimIrect.h:276
virtual void unloadTileToBipAlpha(void *dest, const ossimIrect &dest_rect, const ossimIrect &clip_rect) const
virtual void unloadTile(void *dest, const ossimIrect &dest_rect, ossimInterleaveType il_type) const
virtual ossim_int32 connectMyInputTo(ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
Will try to connect this objects input to the passed in object.
bool theAlphaChannelFlag
For alpha channel support.
ossimScalarType
virtual double getNullPixelValue(ossim_uint32 band=0) const
Each band has a null pixel associated with it.
16 bit unsigned integer (11 bits used)
virtual ossim_uint32 getTileHeight() const
Returns the default processing tile height.
void set_lry(ossim_int32 y)
Definition: ossimIrect.h:702
ossim_int32 getColorType(ossim_int32 bands) const
Get the png color type.
ossim_int32 y
Definition: ossimIpt.h:142
virtual const void * getBuf() const
void writeOptionalChunks(png_structp pp, png_infop info)
writes optionial chunks.
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string&#39;s contents...
Definition: ossimString.h:396
bool hasNans() const
Definition: ossimIrect.h:337
ossim_uint16 theTransparentBlue
const ossimIrect & getAreaOfInterest() const
ossim_int32 x
Definition: ossimIpt.h:141
8 bit unsigned integer
virtual void setPercentComplete(double percentComplete)
ossim_uint16 theTransparentRed
void swap(ossim_sint8 &)
Definition: ossimEndian.h:26
ossim_int32 getBitDepth(ossimScalarType outputScalar) const
unsigned char ossim_uint8
bool doSwap(ossimScalarType outputScalar) const
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
ossim_int64 getNumberOfTilesVertical() const
#define min(a, b)
Definition: auxiliary.h:75
int ossim_int32
static void pngWriteData(png_structp png_ptr, png_bytep data, png_size_t length)
Callback method for writing to stream.

◆ writeSuggestedPalette()

void ossimPngWriter::writeSuggestedPalette ( png_structp  pp,
png_infop  info 
)
private

Write suggested palette (sPLT) Location: before first IDAT Multiple: yes.

Definition at line 855 of file ossimPngWriter.cpp.

Referenced by writeOptionalChunks().

857 {}

◆ writeTimeStampChunk()

void ossimPngWriter::writeTimeStampChunk ( png_structp  pp,
png_infop  info 
)
private

Write time stamp chunk (tIME).

Location: anywhere Multiple: no

Definition at line 799 of file ossimPngWriter.cpp.

References theTimeFlag.

Referenced by writeOptionalChunks().

801 {
802  if(theTimeFlag)
803  {
804  png_time modtime;
805  time_t t;
806  time(&t);
807  png_convert_from_time_t(&modtime, t);
808  png_set_tIME(pp, info, &modtime);
809  }
810 }
bool theTimeFlag
Time support, either on or off.

◆ writeTransparentColorChunk()

void ossimPngWriter::writeTransparentColorChunk ( png_structp  pp,
png_infop  info 
)
private

Write transparent color chunk (tRNS) Location:
Multiple:

Definition at line 765 of file ossimPngWriter.cpp.

References theTransparentBlue, theTransparentFlag, theTransparentGray, theTransparentGreen, and theTransparentRed.

Referenced by writeOptionalChunks().

766 {
767  if (theTransparentFlag)
768  {
769  png_color_16 transparent;
770  transparent.red = (png_uint_16)theTransparentRed;
771  transparent.green = (png_uint_16)theTransparentGreen;
772  transparent.blue = (png_uint_16)theTransparentBlue;
773  transparent.gray = (png_uint_16)theTransparentGray;
774  png_set_tRNS( pp, info, NULL, 0, &transparent );
775  }
776 }
ossim_uint16 theTransparentGreen
ossim_uint16 theTransparentGray
bool theTransparentFlag
For transparent color support.
ossim_uint16 theTransparentBlue
ossim_uint16 theTransparentRed

Member Data Documentation

◆ theAlphaChannelFlag

bool ossimPngWriter::theAlphaChannelFlag
private

For alpha channel support.

Definition at line 375 of file ossimPngWriter.h.

Referenced by getAlphaChannelFlag(), getColorType(), and setAlphaChannelFlag().

◆ theBackgroundBlue

ossim_uint16 ossimPngWriter::theBackgroundBlue
private

Definition at line 381 of file ossimPngWriter.h.

Referenced by writeBackgroundColorChunk().

◆ theBackgroundFlag

bool ossimPngWriter::theBackgroundFlag
private

For background support.

Definition at line 378 of file ossimPngWriter.h.

Referenced by writeBackgroundColorChunk().

◆ theBackgroundGray

ossim_uint16 ossimPngWriter::theBackgroundGray
private

Definition at line 382 of file ossimPngWriter.h.

Referenced by writeBackgroundColorChunk().

◆ theBackgroundGreen

ossim_uint16 ossimPngWriter::theBackgroundGreen
private

Definition at line 380 of file ossimPngWriter.h.

Referenced by writeBackgroundColorChunk().

◆ theBackgroundRed

ossim_uint16 ossimPngWriter::theBackgroundRed
private

Definition at line 379 of file ossimPngWriter.h.

Referenced by writeBackgroundColorChunk().

◆ theCompressionLevel

ossim_int32 ossimPngWriter::theCompressionLevel
private

Compression level from zlib.h: Z_NO_COMPRESSION 0 Z_BEST_SPEED 1 Z_BEST_COMPRESSION 9 Z_DEFAULT_COMPRESSION (-1)

Defaulted to Z_BEST_COMPRESSION

Definition at line 323 of file ossimPngWriter.h.

Referenced by getCompressionLevel(), and setCompressionLevel().

◆ theCompressionStratagy

ossim_int32 ossimPngWriter::theCompressionStratagy
private

Z_FILTERED 1 Z_HUFFMAN_ONLY 2 Z_RLE 3 Z_FIXED 4 Z_DEFAULT_STRATEGY 0.

Default to Z_FILTERED if not palette image, Z_DEFAULT_STRATEGY if palette.

Definition at line 344 of file ossimPngWriter.h.

◆ theGamma

ossim_float64 ossimPngWriter::theGamma
private

Definition at line 369 of file ossimPngWriter.h.

Referenced by writeGammaChunk().

◆ theGammaFlag

bool ossimPngWriter::theGammaFlag
private

For gamma support.

gamma multiplied by 100,000 and rounded to the nearest integer. So if gamma is 1/2.2 (or 0.45454545...), the value in the gAMA chunk is 45,455.

There can be only one gAMA chunk, and it must appear before any IDATs and also before the PLTE chunk, if one is present.

Definition at line 368 of file ossimPngWriter.h.

Referenced by writeGammaChunk().

◆ theInterlaceSupport

ossim_int32 ossimPngWriter::theInterlaceSupport
private

Interlace support: PNG_INTERLACE_ADAM7 PNG_INTERLACE_NONE.

Defaulted to PNG_INTERLACE_NONE

Definition at line 332 of file ossimPngWriter.h.

◆ theOutputStream

std::ostream* ossimPngWriter::theOutputStream
private

Definition at line 311 of file ossimPngWriter.h.

Referenced by close(), isOpen(), open(), and setOutputStream().

◆ theOwnsStreamFlag

bool ossimPngWriter::theOwnsStreamFlag
private

Definition at line 312 of file ossimPngWriter.h.

Referenced by close(), open(), and setOutputStream().

◆ thePngFilter

ossim_int32 ossimPngWriter::thePngFilter
private

PNG_NO_FILTERS 0x00 PNG_FILTER_NONE 0x08 PNG_FILTER_SUB 0x10 PNG_FILTER_UP 0x20 PNG_FILTER_AVG 0x40 PNG_FILTER_PAETH 0x80.

Defaulted to PNG_FILTER_NONE if palette; If not palette this is left up to zlib to decide unless the user overrides it.

Definition at line 357 of file ossimPngWriter.h.

◆ theTimeFlag

bool ossimPngWriter::theTimeFlag
private

Time support, either on or off.

Default = on.

Definition at line 372 of file ossimPngWriter.h.

Referenced by writeTimeStampChunk().

◆ theTransparentBlue

ossim_uint16 ossimPngWriter::theTransparentBlue
private

Definition at line 388 of file ossimPngWriter.h.

Referenced by writeTransparentColorChunk().

◆ theTransparentFlag

bool ossimPngWriter::theTransparentFlag
private

For transparent color support.

Definition at line 385 of file ossimPngWriter.h.

Referenced by writeTransparentColorChunk().

◆ theTransparentGray

ossim_uint16 ossimPngWriter::theTransparentGray
private

Definition at line 389 of file ossimPngWriter.h.

Referenced by writeTransparentColorChunk().

◆ theTransparentGreen

ossim_uint16 ossimPngWriter::theTransparentGreen
private

Definition at line 387 of file ossimPngWriter.h.

Referenced by writeTransparentColorChunk().

◆ theTransparentRed

ossim_uint16 ossimPngWriter::theTransparentRed
private

Definition at line 386 of file ossimPngWriter.h.

Referenced by writeTransparentColorChunk().


The documentation for this class was generated from the following files: