All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Attributes | Friends | List of all members
evd::PNGView Class Reference

#include <PNGArena.h>

Public Member Functions

 PNGView (PNGArena &a)
 
png_byteoperator() (int x, int y, int c)
 
png_byte operator() (int x, int y, int c) const
 

Protected Attributes

PNGArenaarena
 
std::vector< std::vector
< png_byte * > > 
blocks
 

Friends

JSONFormatteroperator<< (JSONFormatter &, const PNGView &)
 

Detailed Description

Definition at line 69 of file PNGArena.h.

Constructor & Destructor Documentation

evd::PNGView::PNGView ( PNGArena a)
explicit

Definition at line 164 of file PNGArena.cxx.

164  : arena(a)
165  {
166  }
process_name gaushit a
PNGArena & arena
Definition: PNGArena.h:97

Member Function Documentation

png_byte& evd::PNGView::operator() ( int  x,
int  y,
int  c 
)
inline

Definition at line 74 of file PNGArena.h.

75  {
76  const unsigned int ix = x/PNGArena::kBlockSize;
77  const unsigned int iy = y/PNGArena::kBlockSize;
78  if(ix >= blocks.size()) blocks.resize(ix+1);
79  if(iy >= blocks[ix].size()) blocks[ix].resize(iy+1, 0);
80  if(!blocks[ix][iy]) blocks[ix][iy] = arena.NewBlock();
82  }
process_name opflash particleana ie x
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
process_name opflash particleana ie ie y
PNGArena & arena
Definition: PNGArena.h:97
std::vector< std::vector< png_byte * > > blocks
Definition: PNGArena.h:99
png_byte * NewBlock()
Definition: PNGArena.cxx:19
png_byte evd::PNGView::operator() ( int  x,
int  y,
int  c 
) const
inline

Definition at line 84 of file PNGArena.h.

85  {
86  const unsigned int ix = x/PNGArena::kBlockSize;
87  const unsigned int iy = y/PNGArena::kBlockSize;
88  if(ix >= blocks.size()) return 0;
89  if(iy >= blocks[ix].size()) return 0;
90  if(!blocks[ix][iy]) return 0;
92  }
process_name opflash particleana ie x
std::size_t size(FixedBins< T, C > const &) noexcept
Definition: FixedBins.h:561
process_name opflash particleana ie ie y
std::vector< std::vector< png_byte * > > blocks
Definition: PNGArena.h:99

Friends And Related Function Documentation

JSONFormatter& operator<< ( JSONFormatter os,
const PNGView v 
)
friend

Definition at line 467 of file WebEVDServer.cxx.

468 {
469  bool first = true;
470  os << "{\"blocks\": [\n";
471  for(unsigned int ix = 0; ix < v.blocks.size(); ++ix){
472  for(unsigned int iy = 0; iy < v.blocks[ix].size(); ++iy){
473  const png_byte* b = v.blocks[ix][iy];
474  if(!b) continue;
475 
476  if(!first) os << ",\n";
477  first = false;
478 
479  int dataidx = 0;
480  for(unsigned int d = 0; d < v.arena.data.size(); ++d){
481  if(b >= &v.arena.data[d]->front() &&
482  b < &v.arena.data[d]->front() + 4*PNGArena::kArenaSize*PNGArena::kArenaSize){
483  dataidx = d;
484  break;
485  }
486  }
487 
488  const int texdx = ((b-&v.arena.data[dataidx]->front())/4)%PNGArena::kArenaSize;
489  const int texdy = ((b-&v.arena.data[dataidx]->front())/4)/PNGArena::kArenaSize;
490 
491  os << "{"
492  << "\"x\": " << ix*PNGArena::kBlockSize << ", "
493  << "\"y\": " << iy*PNGArena::kBlockSize << ", "
494  << "\"dx\": " << PNGArena::kBlockSize << ", "
495  << "\"dy\": " << PNGArena::kBlockSize << ", "
496  << "\"fname\": \"" << v.arena.name << "_" << dataidx << "\", "
497  << "\"texdim\": " << PNGArena::kArenaSize << ", "
498  << "\"u\": " << texdx << ", "
499  << "\"v\": " << texdy << ", "
500  << "\"du\": " << PNGArena::kBlockSize << ", "
501  << "\"dv\": " << PNGArena::kBlockSize
502  << "}";
503  }
504  }
505  os << "\n]}";
506  return os;
507 }
unsigned char png_byte
Definition: PNGArena.h:10

Member Data Documentation

PNGArena& evd::PNGView::arena
protected

Definition at line 97 of file PNGArena.h.

std::vector<std::vector<png_byte*> > evd::PNGView::blocks
protected

Definition at line 99 of file PNGArena.h.


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