示例#1
0
文件: box.c 项目: syntheticpp/cpptex
tex::spec_t::spec_t(box_base_t *p)
	{
	stretch_order(this) = stretch_order(p);
	shrink_order(this) = shrink_order(p);
	glue_ref_count(this) = 0;
	glue_width(this) = glue_width(p);
	stretch(this) = stretch(p);
	shrink(this) = shrink(p);
	}
示例#2
0
文件: box.c 项目: syntheticpp/cpptex
void tex::print_spec(ptr p, str s)
	{
	print_scaled(glue_width(p));
	print(s);
	if (stretch(p) != 0) {
		print(" plus ");
		print_glue(stretch(p), stretch_order(p), s);
		}
	if (shrink(p) != 0) {
		print(" minus ");
		print_glue(shrink(p), shrink_order(p), s);
		}
	}
示例#3
0
// 指定のCGを拡大/縮小したCGを作成
int scg_create_stretch(int wNumCG, int wWidth, int wHeight, int wNumSrcCG) {
	cginfo_t *i, *srccg;
	surface_t *src;
	
	spcg_assert_no(wNumCG);
	spcg_assert_no(wNumSrcCG);
	
	// 元にするCGを参照 (LINKCGなら読み込み)
	if (NULL == (srccg = scg_loadcg_no(wNumSrcCG, FALSE))) {
		return NG;
	}
	
	i = g_new(cginfo_t, 1);
	i->type = CG_STRETCH;
	i->no   = wNumCG;
	i->refcnt = 0;
	
	src = srccg->sf;
	i->sf = stretch(src, wWidth, wHeight, 0);
	
	// もし前に作成したものがあり、未開放の場合は開放
	scg_free(wNumCG);
	
	sact.cg[wNumCG] = i;
	
	return OK;
}
示例#4
0
void GFXDrawUtil::drawBitmapSR( GFXTextureObject*texture, const Point2F &in_rAt, const RectF &srcRect, const GFXBitmapFlip in_flip /*= GFXBitmapFlip_None*/, const GFXTextureFilterType filter /*= GFXTextureFilterPoint */ , bool in_wrap /*= true*/ )
{
   AssertFatal( texture != 0, "No texture specified for drawBitmapSR()" );

   RectF stretch( in_rAt.x, in_rAt.y, srcRect.len_x(), srcRect.len_y() );
   drawBitmapStretchSR( texture, stretch, srcRect, in_flip, filter, in_wrap );
}
示例#5
0
/**
 * Resizes the image so that the resulting sheet has a new size and the image
 * content is zoomed to fit best into the sheet, while keeping it's aspect ration.
 *
 * @param w the new width to resize to
 * @param h the new height to resize to
 */
void resize(int w, int h, struct IMAGE* image) {
    struct IMAGE newimage;
    int ww;
    int hh;
    float wRat;
    float hRat;
    
    if (verbose >= VERBOSE_NORMAL) {
        printf("resizing %dx%d -> %dx%d\n", image->width, image->height, w, h);
    }

    wRat = (float)w / image->width;
    hRat = (float)h / image->height;
    if (wRat < hRat) { // horizontally more shrinking/less enlarging is needed: fill width fully, adjust height
        ww = w;
        hh = image->height * w / image->width;
    } else if (hRat < wRat) {
        ww = image->width * h / image->height;
        hh = h;
    } else { // wRat == hRat
        ww = w;
        hh = h;
    }
    stretch(ww, hh, image);
    initImage(&newimage, w, h, image->bitdepth, image->color, image->background);
    centerImage(image, 0, 0, w, h, &newimage);
    replaceImage(image, &newimage);
}
示例#6
0
SkFontStyle FontDescription::skiaFontStyle() const {
    int width = static_cast<int>(stretch());
    SkFontStyle::Slant slant = SkFontStyle::kUpright_Slant;
    switch (style()) {
    case FontStyleNormal:
        slant = SkFontStyle::kUpright_Slant;
        break;
    case FontStyleItalic:
        slant = SkFontStyle::kItalic_Slant;
        break;
    case FontStyleOblique:
        slant = SkFontStyle::kOblique_Slant;
        break;
    default:
        NOTREACHED();
        break;
    }
    return SkFontStyle(numericFontWeight(weight()), width, slant);
    static_assert(
        static_cast<int>(FontStretchUltraCondensed) ==
        static_cast<int>(SkFontStyle::kUltraCondensed_Width),
        "FontStretchUltraCondensed should map to kUltraCondensed_Width");
    static_assert(static_cast<int>(FontStretchNormal) ==
                  static_cast<int>(SkFontStyle::kNormal_Width),
                  "FontStretchNormal should map to kNormal_Width");
    static_assert(static_cast<int>(FontStretchUltraExpanded) ==
                  static_cast<int>(SkFontStyle::kUltraExpanded_Width),
                  "FontStretchUltraExpanded should map to kUltraExpanded_Width");
}
示例#7
0
QVariant TimeSig::getProperty(P_ID propertyId) const
      {
      switch (propertyId) {
            case P_ID::SHOW_COURTESY:
                  return int(showCourtesySig());
            case P_ID::NUMERATOR_STRING:
                  return numeratorString();
            case P_ID::DENOMINATOR_STRING:
                  return denominatorString();
            case P_ID::GROUPS:
                  return QVariant::fromValue(groups());
            case P_ID::TIMESIG:
                  return QVariant::fromValue(_sig);
            case P_ID::TIMESIG_GLOBAL:
                  return QVariant::fromValue(globalSig());
            case P_ID::TIMESIG_STRETCH:
                  return QVariant::fromValue(stretch());
            case P_ID::TIMESIG_TYPE:
                  return int(_timeSigType);
            case P_ID::SCALE:
                  return _scale;
            default:
                  return Element::getProperty(propertyId);
            }
      }
示例#8
0
void
Canvas::stretch(const Canvas &src,
                PixelScalar src_x, PixelScalar src_y,
                UPixelScalar src_width, UPixelScalar src_height)
{
  stretch(0, 0, width, height, src, src_x, src_y, src_width, src_height);
}
示例#9
0
// 指定のCGを反転させたCGを作成
int scg_create_reverse(int wNumCG, int wNumSrcCG, int wReverseX, int wReverseY) {
	cginfo_t *i, *srccg;
	surface_t *src;
	
	spcg_assert_no(wNumCG);
	spcg_assert_no(wNumSrcCG);
	
	// 元にするCGを参照 (LINKCGなら読み込み)
	if (NULL == (srccg = scg_loadcg_no(wNumSrcCG, FALSE))) {
		return NG;
	}
	
	i = g_new(cginfo_t, 1);
	i->type = CG_REVERSE;
	i->no   = wNumCG;
	i->refcnt = 0;
	
	src = srccg->sf;
	i->sf = stretch(src, src->width, src->height, (wReverseX << 1) | wReverseY);
	// もし前に作成したものがあり、未開放の場合は開放
	scg_free(wNumCG);
	
	sact.cg[wNumCG] = i;
	
	return OK;
}
示例#10
0
void
Canvas::stretch(const Canvas &src,
                int src_x, int src_y,
                unsigned src_width, unsigned src_height)
{
  stretch(0, 0, width, height, src, src_x, src_y, src_width, src_height);
}
示例#11
0
文件: snake.c 项目: darksoul42/bitrig
void
snap(void)
{

	/* I don't see the graphical purpose of the next block of code.
	 * It just makes no sense.
	 *
	 * struct point p;
	 *
	 * if (you.line < 3)
	 *	pchar(point(&p, you.col, 0), '-');
	 * if (you.line > lcnt - 4)
	 *	pchar(point(&p, you.col, lcnt - 1), '_');
	 * if(you.col < 10)
	 *	pchar(point(&p, 0, you.line), '(');
	 * if(you.col > ccnt-10)
	 *	pchar(point(&p, ccnt-1, you.line), ')');
	 */
	if (!stretch(&money))
		if (!stretch(&finish)) {
			pchar(&you, '?');
			refresh();
			delay(10);
			pchar(&you, ME);
		}
	/* Again, I don't see the point of the following either.
	 *
	 * if (you.line < 3) {
	 * 	point(&p, you.col, 0);
	 * 	chk(&p);
	 * }
	 * if (you.line > lcnt - 4) {
	 * 	point(&p, you.col, lcnt - 1);
	 * 	chk(&p);
	 * }
	 * if (you.col < 10) {
	 * 	point(&p, 0, you.line);
	 * 	chk(&p);
	 * }
	 * if (you.col > ccnt-10) {
	 * 	point(&p, ccnt - 1, you.line);
	 * 	chk(&p);
	 * }
	 */
	refresh();
}
示例#12
0
文件: Canvas.cpp 项目: macsux/XCSoar
void
Canvas::stretch_transparent(const Bitmap &src, Color key)
{
  assert(src.defined());

  // XXX
  stretch(src);
}
示例#13
0
文件: Canvas.cpp 项目: macsux/XCSoar
void
Canvas::copy(int dest_x, int dest_y,
             unsigned dest_width, unsigned dest_height,
             const Bitmap &src, int src_x, int src_y)
{
  stretch(dest_x, dest_y, dest_width, dest_height,
          src, src_x, src_y, dest_width, dest_height);
}
示例#14
0
文件: Canvas.cpp 项目: macsux/XCSoar
void
Canvas::stretch(int dest_x, int dest_y,
                unsigned dest_width, unsigned dest_height,
                const GLTexture &texture)
{
  stretch(dest_x, dest_y, dest_width, dest_height,
          texture, 0, 0, texture.get_width(), texture.get_height());
}
示例#15
0
void GFXDrawUtil::drawBitmap( GFXTextureObject*texture, const Point2F &in_rAt, const GFXBitmapFlip in_flip /*= GFXBitmapFlip_None*/, const GFXTextureFilterType filter /*= GFXTextureFilterPoint */ , bool in_wrap /*= true*/ )
{
   AssertFatal( texture != 0, "No texture specified for drawBitmap()" );

   RectI subRegion( 0, 0, texture->mBitmapSize.x, texture->mBitmapSize.y );
   RectI stretch( in_rAt.x, in_rAt.y, texture->mBitmapSize.x, texture->mBitmapSize.y );
   drawBitmapStretchSR( texture, stretch, subRegion, in_flip, filter, in_wrap );
}
示例#16
0
void
Canvas::stretch(const Bitmap &src)
{
  assert(src.IsDefined());

  const PixelSize size = src.GetSize();
  stretch(src, 0, 0, size.cx, size.cy);
}
示例#17
0
 void stretch(PixelScalar dest_x, PixelScalar dest_y,
              UPixelScalar dest_width, UPixelScalar dest_height,
              const Canvas &src,
              PixelScalar src_x, PixelScalar src_y,
              UPixelScalar src_width, UPixelScalar src_height) {
   stretch(dest_x, dest_y, dest_width, dest_height,
           src.surface,
           src_x, src_y, src_width, src_height);
 }
示例#18
0
文件: page.c 项目: n-t-roff/DWB3.3
// Try, very hard, to put everything in the multicol into two columns
// so that the total height is at most htavail.
void multicol::compose(int defonly)
{
	int i;
	stream cd;
	if (!nonempty()) {
		setheight(0);
		return;
	}
	scratch.freeall();		// fill scratch with everything destined
					// for either column
	for (cd = definite; cd.more(); cd.advance())
		scratch.append(cd.current());
	if (!defonly)
		for (cd = *(currpage->stage); cd.more(); cd.advance())
			if (cd.current()->numcol() == 2)
				scratch.append(cd.current());
	scratch.restoreall();		// in particular, floatables' goals
	int rawht = scratch.rawht();
	int halfheight = (int)(coltol*rawht);
					// choose a goal height
	int maxht = defonly ? halfheight : htavail;
secondtry:
	for (i = 0; i < 2; i++)
		column[i].freeall();
	leftblocked = 0;
	cd = scratch;
	while (cd.more()) {
		queue ministage;	// for the minimally acceptable chunks
		ministage.freeall();	// that are to be added to either column
		while (cd.more() && !cd.current()->issentinel()) {
			ministage.enqueue(cd.current());
			cd.advance();
		}
		choosecol(&ministage, maxht);
		if (cd.more() && cd.current()->issentinel())
			cd.advance();	// past sentinel
	}
	if (height() > htavail && maxht != htavail) {
					// We tried to balance the columns, but
					// the result was too tall.  Go back
					// and try again with the less ambitious
					// goal of fitting the space available.
		maxht = htavail;
		goto secondtry;
	}
	for (i = 0; i < 2; i++) {
		movefloats(&(column[i]), ((double) column[i].rawht())/currpage->pagesize);
		trimspace(&(column[i]));
	}
	if (dbg & 32) {
		printf("#multicol::compose: htavail %d maxht %d dv %d\n",
			htavail, maxht, height());
		dump();
	}
	if (defonly)
		stretch(height());
}
示例#19
0
void
Canvas::stretch(const Canvas &src,
                int src_x, int src_y,
                unsigned src_width, unsigned src_height)
{
  // XXX
  stretch(0, 0, get_width(), get_height(),
          src, src_x, src_y, src_width, src_height);
}
示例#20
0
文件: Canvas.cpp 项目: macsux/XCSoar
void
Canvas::invert_stretch_transparent(const Bitmap &src, Color key)
{
  assert(src.defined());

  // XXX
  GLLogicOp invert(GL_COPY_INVERTED);
  stretch(src);
}
示例#21
0
void print_spec(int p,const char*s)
{
if(p<0){
print_char('*');
}else{
print_scaled(width(p));
if(s!=NULL)
tprint(s);
if(stretch(p)!=0){
tprint(" plus ");
print_glue(stretch(p),stretch_order(p),s);
}
if(shrink(p)!=0){
tprint(" minus ");
print_glue(shrink(p),shrink_order(p),s);
}
}
}
示例#22
0
void GLVDetachable::init(){
	mDetachedButton.attach(ntDetachedButton, glv::Update::Value, this);
	mDetachedButton.disable(glv::Momentary);
	mDetachedButton.symbolOn(glv::draw::viewChild);
	mDetachedButton.symbolOff(glv::draw::viewSibling);
	mDetachedButton.disable(glv::DrawBorder);
	stretch(1,1);
	this->disable(glv::DrawBack);
}
示例#23
0
文件: Canvas.hpp 项目: macsux/XCSoar
 void stretch(int dest_x, int dest_y,
              unsigned dest_width, unsigned dest_height,
              const Canvas &src,
              int src_x, int src_y,
              unsigned src_width, unsigned src_height) {
   stretch(dest_x, dest_y, dest_width, dest_height,
           src.surface,
           src_x, src_y, src_width, src_height);
 }
示例#24
0
void
Canvas::stretch(const Canvas &src,
                PixelScalar src_x, PixelScalar src_y,
                UPixelScalar src_width, UPixelScalar src_height)
{
  // XXX
  stretch(0, 0, get_width(), get_height(),
          src, src_x, src_y, src_width, src_height);
}
示例#25
0
bool TimeSig::operator==(const TimeSig& ts) const
      {
      return (timeSigType() == ts.timeSigType())
         && (sig().identical(ts.sig()))
         && (stretch() == ts.stretch())
         && (groups() == ts.groups())
         && (customText == ts.customText)
         && (!customText || (_numeratorString == ts._numeratorString && _denominatorString == ts._denominatorString))
         ;
      }
示例#26
0
bool TimeSig::operator==(const TimeSig& ts) const
      {
      return (timeSigType() == ts.timeSigType())
         && (sig().identical(ts.sig()))
         && (stretch() == ts.stretch())
         && (groups() == ts.groups())
         && (_numeratorString == ts._numeratorString)
         && (_denominatorString == ts._denominatorString)
         ;
      }
示例#27
0
void Entity::Draw(){
	modelMatrix.identity();
	spritesheet.set_position(sprite);
	glUniform3fv(coloruniform, 1, color_shift);
	modelMatrix.Translate(position.get_x(), position.get_y(), 0);
	if (mirrored){ modelMatrix.Scale(-1.0, 1.0, 0.0); }
	if (stretchy){ stretch(); }
	program->setModelMatrix(modelMatrix);
	spritesheet.Draw(program);

}
示例#28
0
void
Canvas::stretch(PixelScalar dest_x, PixelScalar dest_y,
                UPixelScalar dest_width, UPixelScalar dest_height,
                const Bitmap &src)
{
  assert(src.IsDefined());

  const PixelSize size = src.GetSize();
  stretch(dest_x, dest_y, dest_width, dest_height,
          src, 0, 0, size.cx, size.cy);
}
示例#29
0
void TimeSig::write(XmlWriter& xml) const
      {
      xml.stag("TimeSig");
      writeProperty(xml, P_ID::TIMESIG_TYPE);
      Element::writeProperties(xml);

      xml.tag("sigN",  _sig.numerator());
      xml.tag("sigD",  _sig.denominator());
      if (stretch() != Fraction(1,1)) {
            xml.tag("stretchN", stretch().numerator());
            xml.tag("stretchD", stretch().denominator());
            }
      writeProperty(xml, P_ID::NUMERATOR_STRING);
      writeProperty(xml, P_ID::DENOMINATOR_STRING);
      if (!_groups.empty())
            _groups.write(xml);
      writeProperty(xml, P_ID::SHOW_COURTESY);
      writeProperty(xml, P_ID::SCALE);

      xml.etag();
      }
示例#30
0
void
Canvas::stretch(PixelScalar dest_x, PixelScalar dest_y,
                UPixelScalar dest_width, UPixelScalar dest_height,
                const Bitmap &src)
{
  assert(IsDefined());
  assert(src.IsDefined());

  SDL_Surface *surface = src.GetNative();
  stretch(dest_x, dest_y, dest_width, dest_height,
          surface, 0, 0, surface->w, surface->h);
}