当前位置: 首页>>代码示例>>C++>>正文


C++ Bitmap::IsDefined方法代码示例

本文整理汇总了C++中Bitmap::IsDefined方法的典型用法代码示例。如果您正苦于以下问题:C++ Bitmap::IsDefined方法的具体用法?C++ Bitmap::IsDefined怎么用?C++ Bitmap::IsDefined使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Bitmap的用法示例。


在下文中一共展示了Bitmap::IsDefined方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: assert

void
Canvas::StretchMono(PixelScalar dest_x, PixelScalar dest_y,
                    UPixelScalar dest_width, UPixelScalar dest_height,
                    const Bitmap &src,
                    PixelScalar src_x, PixelScalar src_y,
                    UPixelScalar src_width, UPixelScalar src_height,
                    Color fg_color, Color bg_color)
{
  assert(IsDefined());
  assert(src.IsDefined());

  SDL_Surface *src_surface = src.GetNative();
  assert(src_surface->format->palette != NULL &&
         src_surface->format->palette->ncolors == 2);

  SDL_Surface *zoomed =
    ::zoomSurface(src_surface, (double)dest_width / (double)src_width,
                  (double)dest_height / (double)src_height,
                  SMOOTHING_OFF);
  if (zoomed == NULL)
    return;

  assert(zoomed->format->palette != NULL &&
         zoomed->format->palette->ncolors == 2);

  ::SDL_SetColorKey(zoomed, 0, 0);
  zoomed->format->palette->colors[0] = text_color;
  zoomed->format->palette->colors[1] = bg_color;

  copy(dest_x, dest_y, dest_width, dest_height,
       zoomed, (src_x * dest_width) / src_width,
       (src_y * dest_height) / src_height);
  ::SDL_FreeSurface(zoomed);
}
开发者ID:mobotics,项目名称:XCSoar,代码行数:34,代码来源:Canvas.cpp

示例2: scope

void
Canvas::StretchNot(const Bitmap &src)
{
  assert(src.IsDefined());

#ifdef USE_GLSL
  OpenGL::invert_shader->Use();
#else
  const GLEnable scope(GL_TEXTURE_2D);

  OpenGL::glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);

  /* invert the texture color */
  OpenGL::glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE);
  OpenGL::glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE);
  OpenGL::glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_ONE_MINUS_SRC_COLOR);

  /* copy the texture alpha */
  OpenGL::glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, GL_REPLACE);
  OpenGL::glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA, GL_TEXTURE);
  OpenGL::glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA);
#endif

  GLTexture &texture = *src.GetNative();
  texture.Draw(0, 0, GetWidth(), GetHeight(),
               0, 0, src.GetWidth(), src.GetHeight());
}
开发者ID:Adrien81,项目名称:XCSoar,代码行数:27,代码来源:Canvas.cpp

示例3: assert

void
Canvas::StretchMono(int dest_x, int dest_y,
                    unsigned dest_width, unsigned dest_height,
                    const Bitmap &src,
                    int src_x, int src_y,
                    unsigned src_width, unsigned src_height,
                    Color fg_color, Color bg_color)
{
  assert(IsDefined());
  assert(src.IsDefined());

#ifndef _WIN32_WCE
  if (bg_color == COLOR_BLACK && (src_width != dest_width ||
                                  src_height != dest_height)) {
    /* workaround for a WINE bug: stretching a mono bitmap ignores the
       text color; this kludge makes the text color white */
    SetTextColor(COLOR_BLACK);
    SetBackgroundColor(COLOR_WHITE);
    Stretch(dest_x, dest_y, dest_width, dest_height,
            src, src_x, src_y, src_width, src_height,
            MERGEPAINT);
    return;
  }
#endif

  /* on GDI, monochrome bitmaps are special: they are painted with the
     destination HDC's current colors */
  SetTextColor(fg_color);
  SetBackgroundTransparent();

  Stretch(dest_x, dest_y, dest_width, dest_height,
          src, src_x, src_y, src_width, src_height);
}
开发者ID:CnZoom,项目名称:XcSoarPull,代码行数:33,代码来源:Canvas.cpp

示例4: inverted

void
Canvas::invert_stretch_transparent(const Bitmap &src, Color key)
{
  assert(IsDefined());
  assert(src.IsDefined());

  HDC virtual_dc = GetCompatibleDC();
  HBITMAP old = (HBITMAP)::SelectObject(virtual_dc, src.GetNative());
  const PixelSize size = src.GetSize();

  BufferCanvas inverted(*this, size.cx, size.cy);
  ::BitBlt(inverted, 0, 0, size.cx, size.cy,
           virtual_dc, 0, 0, NOTSRCCOPY);
  ::SelectObject(virtual_dc, old);

#ifdef _WIN32_WCE
  ::TransparentImage(dc, 0, 0, get_width(), get_height(),
                     inverted, 0, 0, size.cx, size.cy,
                     key);
#else
  ::TransparentBlt(dc, 0, 0, get_width(), get_height(),
                   inverted, 0, 0, size.cx, size.cy,
                   key);
#endif
}
开发者ID:mobotics,项目名称:XCSoar,代码行数:25,代码来源:Canvas.cpp

示例5: assert

void
Canvas::stretch_transparent(const Bitmap &src, Color key)
{
  assert(src.IsDefined());

  // XXX
  Stretch(src);
}
开发者ID:damianob,项目名称:xcsoar,代码行数:8,代码来源:Canvas.cpp

示例6: IsDefined

  gcc_pure
  bool IsDefined() const {
#if defined(USE_GDI) || defined(ENABLE_OPENGL)
    return bitmap.IsDefined();
#else
    return buffer.data != nullptr;
#endif
  }
开发者ID:nkgautam,项目名称:XCSoar,代码行数:8,代码来源:UnitSymbol.hpp

示例7: invert

void
Canvas::StretchNot(const Bitmap &src)
{
  assert(src.IsDefined());

  GLLogicOp invert(GL_COPY_INVERTED);
  Stretch(src);
}
开发者ID:DRIZO,项目名称:xcsoar,代码行数:8,代码来源:Canvas.cpp

示例8: invert

void
Canvas::invert_stretch_transparent(const Bitmap &src, Color key)
{
  assert(src.IsDefined());

  // XXX
  GLLogicOp invert(GL_COPY_INVERTED);
  Stretch(src);
}
开发者ID:damianob,项目名称:xcsoar,代码行数:9,代码来源:Canvas.cpp

示例9: assert

void
Canvas::CopyAnd(int dest_x, int dest_y,
                unsigned dest_width, unsigned dest_height,
                const Bitmap &src, int src_x, int src_y)
{
  assert(src.IsDefined());

  CopyAnd(dest_x, dest_y, dest_width, dest_height,
          src.GetNative(), src_x, src_y);
}
开发者ID:ThomasXBMC,项目名称:XCSoar,代码行数:10,代码来源:Canvas.cpp

示例10: logic_op

void
Canvas::CopyAnd(int dest_x, int dest_y,
                 unsigned dest_width, unsigned dest_height,
                 const Bitmap &src, int src_x, int src_y)
{
  assert(src.IsDefined());

  GLLogicOp logic_op(GL_AND);
  Copy(dest_x, dest_y, dest_width, dest_height,
       src, src_x, src_y);
}
开发者ID:DRIZO,项目名称:xcsoar,代码行数:11,代码来源:Canvas.cpp

示例11: logic_op

void
Canvas::CopyNot(PixelScalar dest_x, PixelScalar dest_y,
                 UPixelScalar dest_width, UPixelScalar dest_height,
                 const Bitmap &src, PixelScalar src_x, PixelScalar src_y)
{
  assert(src.IsDefined());

  GLLogicOp logic_op(GL_COPY_INVERTED);
  copy(dest_x, dest_y, dest_width, dest_height,
       src, src_x, src_y);
}
开发者ID:damianob,项目名称:xcsoar,代码行数:11,代码来源:Canvas.cpp

示例12: canvas

void
Canvas::StretchAnd(int dest_x, int dest_y,
               unsigned dest_width, unsigned dest_height,
               const Bitmap &src, 
               int src_x, int src_y, unsigned src_width, unsigned src_height)
{
  assert(IsDefined());
  assert(src.IsDefined());
  
  ConstImageBuffer srcImg = src.GetNative();  
  
  SDLRasterCanvas canvas(buffer);
  BitAndPixelOperations<ActivePixelTraits> operations;

  canvas.ScaleRectangle(dest_x, dest_y, dest_width, dest_height,
                       srcImg.At(src_x, src_y), srcImg.pitch, src_width, src_height,
                       operations);
}
开发者ID:jaaaaf,项目名称:LK8000,代码行数:18,代码来源:Canvas.cpp

示例13: canvas

void
Canvas::StretchNot(const Bitmap &_src)
{
  assert(_src.IsDefined());

  ConstImageBuffer src = _src.GetNative();
  const unsigned src_x = 0, src_y = 0;
  const unsigned dest_x = 0, dest_y = 0;
  const unsigned dest_width = GetWidth();
  const unsigned dest_height = GetHeight();

  SDLRasterCanvas canvas(buffer);
  BitNotPixelOperations<ActivePixelTraits> operations;

  canvas.ScaleRectangle(dest_x, dest_y, dest_width, dest_height,
                        src.At(src_x, src_y), src.pitch, src.width, src.height,
                        operations);
}
开发者ID:ThomasXBMC,项目名称:XCSoar,代码行数:18,代码来源:Canvas.cpp

示例14: scope

void
Canvas::Stretch(int dest_x, int dest_y,
                unsigned dest_width, unsigned dest_height,
                const Bitmap &src)
{
#ifdef HAVE_GLES
  assert(offset == OpenGL::translate);
#endif
  assert(src.IsDefined());

  OpenGL::glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);

  GLTexture &texture = *src.GetNative();
  GLEnable scope(GL_TEXTURE_2D);
  texture.Bind();
  texture.Draw(dest_x, dest_y, dest_width, dest_height,
               0, 0, src.GetWidth(), src.GetHeight());
}
开发者ID:DRIZO,项目名称:xcsoar,代码行数:18,代码来源:Canvas.cpp

示例15: scope

void
Canvas::Stretch(PixelScalar dest_x, PixelScalar dest_y,
                UPixelScalar dest_width, UPixelScalar dest_height,
                const Bitmap &src, PixelScalar src_x, PixelScalar src_y,
                UPixelScalar src_width, UPixelScalar src_height)
{
#ifdef HAVE_GLES
  assert(x_offset == OpenGL::translate_x);
  assert(y_offset == OpenGL::translate_y);
#endif
  assert(src.IsDefined());

  OpenGL::glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);

  GLTexture &texture = *src.GetNative();
  GLEnable scope(GL_TEXTURE_2D);
  texture.Bind();
  texture.Draw(dest_x, dest_y, dest_width, dest_height,
               src_x, src_y, src_width, src_height);
}
开发者ID:damianob,项目名称:xcsoar,代码行数:20,代码来源:Canvas.cpp


注:本文中的Bitmap::IsDefined方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。