Logo Search packages:      
Sourcecode: djvulibre version File versions  Download package

GP< GBitmap > JB2Image::get_bitmap ( int  subsample = 1,
int  align = 1 
) const

Renders an anti-aliased gray level image. This function renders the JB2Image as a bilevel or gray level image. Argument subsample# specifies the desired subsampling ratio in range #1# to #15#. The returned image uses #1+subsample^2# gray levels for representing anti-aliased edges. Argument align# specified the alignment of the rows of the returned images. Setting align# to #4#, for instance, will adjust the bitmap border in order to make sure that each row of the returned image starts on a word (four byte) boundary.

Definition at line 291 of file JB2Image.cpp.

References JB2Shape::bits, JB2Blit::bottom, GBitmap::create(), get_blit(), get_blit_count(), JB2Dict::get_shape(), JB2Blit::left, and JB2Blit::shapeno.

{
  if (width==0 || height==0)
    G_THROW( ERR_MSG("JB2Image.cant_create") );
  int swidth = (width + subsample - 1) / subsample;
  int sheight = (height + subsample - 1) / subsample;
  int border = ((swidth + align - 1) & ~(align - 1)) - swidth;
  GP<GBitmap> bm = GBitmap::create(sheight, swidth, border);
  bm->set_grays(1+subsample*subsample);
  for (int blitno = 0; blitno < get_blit_count(); blitno++)
    {
      const JB2Blit *pblit = get_blit(blitno);
      const JB2Shape  &pshape = get_shape(pblit->shapeno);
      if (pshape.bits)
        bm->blit(pshape.bits, pblit->left, pblit->bottom, subsample);
    }
  return bm;
}


Generated by  Doxygen 1.6.0   Back to index