示例#1
0
void FreeImages(void) {
  int i; 
  for (i=0; i<numimages; i++) {
    DeallocateImage(imagelist[i]);
  }
  ResetImages();
}
示例#2
0
void FreeMIPMap(mipmap * mip) {
  int i;

  /* don't free the original image here, FreeImages() will */
  /* get it when all else is completed.                    */
  for (i=1; i<mip->levels; i++) {
    DeallocateImage(mip->images[i]);
  } 
  free(mip->images);
  free(mip);
}
示例#3
0
mipmap * LoadMIPMap(const char * filename, int maxlevels) {
  rawimage * img;
  mipmap * mip;

  img = AllocateImageFile(filename);
  if (img == NULL)
    return NULL;

  LoadRawImage(img);

  mip = CreateMIPMap(img, maxlevels); 
  if (mip == NULL) {
    DeallocateImage(img);
    free(mip);
    return NULL;
  }

  return mip;
}
示例#4
0
ImageClass& ImageClass::operator=(const ImageClass& objToCopy)
{
	//check to see if myImage.pixels == NULL and ; deallocate if != NULL
	if(myImage.pixels != NULL && objToCopy != *this)
	{
		//deallocate myImage
		DeallocateImage(myImage);
	}

	//copy the image
	myImage = CopyImage(objToCopy.myImage);

	//set name
	name = objToCopy.name + "-Assigned";
    	
	//print out constructor identification
	cout << "Operator: Assignment - " << name << endl;

	return *this;
}
示例#5
0
// Attempts to mark an entry as deleted
RETURN_TYPE AE_DeleteImage( char *Key )
{
  unsigned index = UHashMod( Key );
  unsigned indexStart = index;

  // Only search through clusters, don't hop over empty entries
  while(!IsEmpty( IMABE_TABLE, index ))
  {
    // Break from loop if found matching entry
    if(IMABE_TABLE[index] != DELETED)
    {
      if(strcmp(IMABE_TABLE[index]->ID, Key) == 0)
      {
        DeallocateImage( IMABE_TABLE[index]->ID );
        IMABE_TABLE[index] = DELETED;
        isTableFull = FALSE;
        return RETURN_SUCCESS;
      }
    }

    ++index;

    // wraparound to beginning of table
    if(index == TABLESIZE)
    {
      index = 0;
    }

    // If searched entire table
    if(indexStart == index)
    {
      break;
    }
  }

  printf("ERROR: Failed to delete: %s; (entry not found).\n", Key);

  return RETURN_FAILURE;
}
示例#6
0
ImageClass::~ImageClass()
{
	cout << "Deconstructor: - " << name << endl;
    DeallocateImage(myImage);
}