|
Since you allocted pixels as one block of char, it is a very bad idea to try to delete[] the chars individually. You either can leave the block at its original size (and have some unused memory) or allocate a new block, copy the contents you want across and then delete the old block.
As for copying the data across to the new size, you need to keep track of the old size and use that to find the location of the pixels you want to copy from the old data.
|