Exemple #1
0
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");
}
Exemple #2
0
bool
Bitmap::Load(ResourceId _id, Type _type)
{
  assert(_id.IsDefined());

  Reset();

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

  if (!surface_valid)
    return true;

  return Reload();
}
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
}