Пример #1
0
//
/// Add new cel(s) to the CelArray - return index of new addition.
/// No mask bitmap is added.
//
int
TCelArray::Add(const TBitmap& image)
{
  int width = image.Width();
  int count = width / CelSize().cx;

  if (!MaybeResize(count))
    return -1;

  OwlCopyBmp(*Bitmap, image, CelOffset(NCelsUsed,0), image.Size());

  int index = NCelsUsed;
  NCelsUsed += count;

  TRACEX(OwlGadget, 1, "TCelArray @" << (void*)this << " added bitmap @" <<
    (void*)&image);

  return index;
}
Пример #2
0
//
/// Constructs a TImageList from a bitmap, slicing it up into a horizontal array of
/// the given number of evenly sized images.
// !CQ add an optional mask color? or mask?
//
TImageList::TImageList(const TBitmap& bmp, uint flags, int imageCount, int growBy)
{
  if (!TCommCtrl::IsAvailable())
    TXCommCtrl::Raise();

  if (!imageCount)
    imageCount = 1;

  ImageSize = TSize(bmp.Width() / imageCount, bmp.Height());
  Bitmap = 0;

  Handle = TCommCtrl::Dll()->ImageList_Create(ImageSize.cx, ImageSize.cy,
                                       flags, imageCount, growBy);

  CheckValid();
  WARNX(OwlCommCtrl, !Handle, 0, "Cannot create ImageList");

  // Use masked support with 3dFace color as background color
  //
  Add(bmp, TColor::Sys3dFace); // !CQ
}