Qt 4.8
Public Types | Public Functions | Public Variables | List of all members
QJpegHandlerPrivate Class Reference

Public Types

enum  State { Ready, ReadHeader, Error }
 

Public Functions

 QJpegHandlerPrivate (QJpegHandler *qq)
 
bool read (QImage *image)
 
bool readJpegHeader (QIODevice *)
 
 ~QJpegHandlerPrivate ()
 

Public Variables

QRect clipRect
 
struct my_error_mgr err
 
QImage::Format format
 
struct jpeg_decompress_struct info
 
struct my_jpeg_source_mgriod_src
 
QJpegHandlerq
 
int quality
 
QRect scaledClipRect
 
QSize scaledSize
 
QVariant size
 
State state
 

Detailed Description

Definition at line 684 of file qjpeghandler.cpp.

Enumerations

◆ State

Enumerator
Ready 
ReadHeader 
Error 

Definition at line 687 of file qjpeghandler.cpp.

Constructors and Destructors

◆ QJpegHandlerPrivate()

QJpegHandlerPrivate::QJpegHandlerPrivate ( QJpegHandler qq)
inline

Definition at line 693 of file qjpeghandler.cpp.

694  : quality(75), iod_src(0), state(Ready), q(qq)
695  {}
QJpegHandler * q
struct my_jpeg_source_mgr * iod_src

◆ ~QJpegHandlerPrivate()

QJpegHandlerPrivate::~QJpegHandlerPrivate ( )
inline

Definition at line 697 of file qjpeghandler.cpp.

698  {
699  if(iod_src)
700  {
701  jpeg_destroy_decompress(&info);
702  delete iod_src;
703  iod_src = 0;
704  }
705  }
struct jpeg_decompress_struct info
struct my_jpeg_source_mgr * iod_src

Functions

◆ read()

bool QJpegHandlerPrivate::read ( QImage image)

Definition at line 763 of file qjpeghandler.cpp.

Referenced by QJpegHandler::read().

764 {
765  if(state == Ready)
766  readJpegHeader(q->device());
767 
768  if(state == ReadHeader)
769  {
770  bool success = read_jpeg_image(image, scaledSize, scaledClipRect, clipRect, quality, &info, &err);
771  state = success ? Ready : Error;
772  return success;
773  }
774 
775  return false;
776 
777 }
QJpegHandler * q
struct jpeg_decompress_struct info
struct my_error_mgr err
QIODevice * device() const
Returns the device currently assigned to the QImageIOHandler.
static bool read_jpeg_image(QImage *outImage, QSize scaledSize, QRect scaledClipRect, QRect clipRect, int inQuality, j_decompress_ptr info, struct my_error_mgr *err)
bool readJpegHeader(QIODevice *)

◆ readJpegHeader()

bool QJpegHandlerPrivate::readJpegHeader ( QIODevice device)
Warning
This function is not part of the public interface.

Definition at line 728 of file qjpeghandler.cpp.

Referenced by QJpegHandler::option().

729 {
730  if(state == Ready)
731  {
732  state = Error;
733  iod_src = new my_jpeg_source_mgr(device);
734 
735  jpeg_create_decompress(&info);
736  info.src = iod_src;
737  info.err = jpeg_std_error(&err);
738  err.error_exit = my_error_exit;
739 
740  if (!setjmp(err.setjmp_buffer)) {
741  (void) jpeg_read_header(&info, TRUE);
742 
743  int width = 0;
744  int height = 0;
745  read_jpeg_size(width, height, &info);
746  size = QSize(width, height);
747 
750  state = ReadHeader;
751  return true;
752  }
753  else
754  {
755  return false;
756  }
757  }
758  else if(state == Error)
759  return false;
760  return true;
761 }
static void my_error_exit(j_common_ptr cinfo)
jmp_buf setjmp_buffer
struct jpeg_decompress_struct info
#define TRUE
Synonym for true.
Definition: qglobal.h:1018
struct my_error_mgr err
static bool read_jpeg_size(int &w, int &h, j_decompress_ptr cinfo)
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
struct my_jpeg_source_mgr * iod_src
static bool read_jpeg_format(QImage::Format &format, j_decompress_ptr cinfo)

Properties

◆ clipRect

QRect QJpegHandlerPrivate::clipRect

Definition at line 715 of file qjpeghandler.cpp.

Referenced by QJpegHandler::option(), and QJpegHandler::setOption().

◆ err

struct my_error_mgr QJpegHandlerPrivate::err

Definition at line 718 of file qjpeghandler.cpp.

◆ format

QImage::Format QJpegHandlerPrivate::format

Definition at line 712 of file qjpeghandler.cpp.

Referenced by QJpegHandler::option().

◆ info

struct jpeg_decompress_struct QJpegHandlerPrivate::info

Definition at line 716 of file qjpeghandler.cpp.

◆ iod_src

struct my_jpeg_source_mgr* QJpegHandlerPrivate::iod_src

Definition at line 717 of file qjpeghandler.cpp.

◆ q

QJpegHandler* QJpegHandlerPrivate::q

Definition at line 722 of file qjpeghandler.cpp.

◆ quality

int QJpegHandlerPrivate::quality

◆ scaledClipRect

QRect QJpegHandlerPrivate::scaledClipRect

Definition at line 714 of file qjpeghandler.cpp.

Referenced by QJpegHandler::option(), and QJpegHandler::setOption().

◆ scaledSize

QSize QJpegHandlerPrivate::scaledSize

Definition at line 713 of file qjpeghandler.cpp.

Referenced by QJpegHandler::option(), and QJpegHandler::setOption().

◆ size

QVariant QJpegHandlerPrivate::size

Definition at line 711 of file qjpeghandler.cpp.

Referenced by QJpegHandler::option().

◆ state

State QJpegHandlerPrivate::state

Definition at line 720 of file qjpeghandler.cpp.

Referenced by QJpegHandler::canRead().


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