예제 #1
0
파일: LoadImage.cpp 프로젝트: Advi42/XCSoar
static void
Main()
{
  Bitmap bitmap;
  bool success =
#ifdef USE_GDI
    id.IsDefined()
    ? bitmap.Load(id)
    :
#endif
    bitmap.LoadFile(path);
  if (!success)
    fprintf(stderr, "Failed to load image\n");
}
예제 #2
0
파일: Bitmap.cpp 프로젝트: Adrien81/XCSoar
bool
Bitmap::Load(ResourceId _id, Type _type)
{
  assert(_id.IsDefined());

  Reset();

  id = _id;
  type = _type;
  AddSurfaceListener(*this);

  if (!surface_valid)
    return true;

  return Reload();
}
예제 #3
0
void
MaskedIcon::LoadResource(ResourceId id, ResourceId big_id, bool center)
{
  if (Layout::ScaleEnabled()) {
    if (big_id.IsDefined())
      bitmap.Load(big_id);
    else
      bitmap.LoadStretch(id, Layout::FastScale(1));
  } else
    bitmap.Load(id);

#ifdef ENABLE_OPENGL
  /* postpone CalculateLayout() call, because the OpenGL surface may
     be absent now */
  size.cx = 0;
  size.cy = center;
#else
  assert(IsDefined());

  CalculateLayout(center);
#endif
}