本文整理汇总了C++中Bitmap::GetNative方法的典型用法代码示例。如果您正苦于以下问题:C++ Bitmap::GetNative方法的具体用法?C++ Bitmap::GetNative怎么用?C++ Bitmap::GetNative使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bitmap
的用法示例。
在下文中一共展示了Bitmap::GetNative方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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());
}
示例3: Copy
void
Canvas::Copy(const Bitmap &_src)
{
ConstImageBuffer src = _src.GetNative();
Copy(0, 0, src.width, src.height, src, 0, 0);
}
示例4: scope
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)
{
/* note that this implementation ignores the background color; it is
not mandatory, and we can assume that the background is already
set; it is only being passed to this function because the GDI
implementation will be faster when erasing the background
again */
OpenGL::glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE);
/* replace the texture color with the selected text color */
OpenGL::glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_REPLACE);
OpenGL::glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_PREVIOUS);
OpenGL::glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);
/* invert texture alpha (our bitmaps have black text on white
background) */
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_ONE_MINUS_SRC_ALPHA);
const GLEnable scope(GL_TEXTURE_2D);
const GLBlend blend(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
GLTexture &texture = *src.GetNative();
texture.Bind();
texture.Draw(dest_x, dest_y, dest_width, dest_height,
src_x, src_y, src_width, src_height);
}
示例5: 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
}
示例6: copy
void
Canvas::copy(PixelScalar dest_x, PixelScalar dest_y,
UPixelScalar dest_width, UPixelScalar dest_height,
const Bitmap &src, PixelScalar src_x, PixelScalar src_y)
{
copy(dest_x, dest_y, dest_width, dest_height,
src.GetNative(), src_x, src_y);
}
示例7: 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);
}
示例8: assert
void
Brush::Set(const Bitmap &bitmap)
{
/* GDI works best when the bitmap is 8x8 - to avoid bad performance,
disallow using any other bitmap size */
assert(bitmap.GetSize().cx == 8);
assert(bitmap.GetSize().cy == 8);
Reset();
brush = ::CreatePatternBrush(bitmap.GetNative());
}
示例9: assert
void
Canvas::StretchNot(const Bitmap &src)
{
assert(IsDefined());
assert(src.IsDefined());
const PixelSize size = src.GetSize();
Stretch(0, 0, GetWidth(), GetHeight(),
src.GetNative(), 0, 0, size.cx, size.cy,
NOTSRCCOPY);
}
示例10: 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);
}
示例11: 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);
}
示例12: 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);
}
示例13: CopyAnd
void
Canvas::CopyAnd(const Bitmap &src)
{
CopyAnd(0, 0, GetWidth(), GetHeight(),
src.GetNative(), 0, 0);
}