mirror of
https://github.com/aseprite/aseprite.git
synced 2025-02-05 18:40:37 +00:00
Replace image_new* functions with Image:create*() member functions.
This commit is contained in:
parent
34eef40876
commit
1345919aaa
@ -139,7 +139,7 @@ protected:
|
||||
|
||||
int sheet_w = sprite->getWidth()*columns;
|
||||
int sheet_h = sprite->getHeight()*((nframes/columns)+((nframes%columns)>0?1:0));
|
||||
UniquePtr<Image> resultImage(image_new(sprite->getImgType(), sheet_w, sheet_h));
|
||||
UniquePtr<Image> resultImage(Image::create(sprite->getImgType(), sheet_w, sheet_h));
|
||||
image_clear(resultImage, 0);
|
||||
|
||||
int oldFrame = sprite->getCurrentFrame();
|
||||
|
@ -159,7 +159,7 @@ protected:
|
||||
// As first step, we cut each tile and add them into "animation" list.
|
||||
for (int y=m_rect.y; y<sprite->getHeight(); y += m_rect.h) {
|
||||
for (int x=m_rect.x; x<sprite->getWidth(); x += m_rect.w) {
|
||||
UniquePtr<Image> resultImage(image_new(sprite->getImgType(), m_rect.w, m_rect.h));
|
||||
UniquePtr<Image> resultImage(Image::create(sprite->getImgType(), m_rect.w, m_rect.h));
|
||||
|
||||
// Clear the image with mask color.
|
||||
image_clear(resultImage, 0);
|
||||
|
@ -119,7 +119,7 @@ void MergeDownLayerCommand::onExecute(Context* context)
|
||||
// Copy this cel to the destination layer...
|
||||
|
||||
// Creating a copy of the image
|
||||
dst_image = image_new_copy(src_image);
|
||||
dst_image = Image::createCopy(src_image);
|
||||
|
||||
// Adding it in the stock of images
|
||||
index = sprite->getStock()->addImage(dst_image);
|
||||
|
@ -118,7 +118,7 @@ void PreviewCommand::onExecute(Context* context)
|
||||
|
||||
// Render the sprite
|
||||
Image* render = NULL;
|
||||
Image* doublebuf = image_new(IMAGE_RGB, JI_SCREEN_W, JI_SCREEN_H);
|
||||
Image* doublebuf = Image::create(IMAGE_RGB, JI_SCREEN_W, JI_SCREEN_H);
|
||||
|
||||
do {
|
||||
// Update scroll
|
||||
|
@ -109,9 +109,9 @@ protected:
|
||||
continue;
|
||||
|
||||
// rotate the image
|
||||
Image* new_image = image_new(image->imgtype,
|
||||
m_angle == 180 ? image->w: image->h,
|
||||
m_angle == 180 ? image->h: image->w);
|
||||
Image* new_image = Image::create(image->imgtype,
|
||||
m_angle == 180 ? image->w: image->h,
|
||||
m_angle == 180 ? image->h: image->w);
|
||||
image_rotate(image, new_image, m_angle);
|
||||
|
||||
undoTransaction.replaceStockImage(i, new_image);
|
||||
|
@ -91,7 +91,7 @@ protected:
|
||||
// Resize the image
|
||||
int w = scale_x(image->w);
|
||||
int h = scale_y(image->h);
|
||||
Image* new_image = image_new(image->imgtype, MAX(1, w), MAX(1, h));
|
||||
Image* new_image = Image::create(image->imgtype, MAX(1, w), MAX(1, h));
|
||||
|
||||
image_fixup_transparent_colors(image);
|
||||
image_resize(image, new_image,
|
||||
|
@ -198,7 +198,7 @@ static Image* render_text(Sprite* sprite, FONT *f, const char *text, int color)
|
||||
clear_to_color(bmp, makecol32 (255, 0, 255));
|
||||
textout_ex(bmp, f, text, 0, 0, makecol32 (255, 255, 255), -1);
|
||||
|
||||
image = image_new(sprite->getImgType(), w, h);
|
||||
image = Image::create(sprite->getImgType(), w, h);
|
||||
if (!image) {
|
||||
destroy_bitmap(bmp);
|
||||
return NULL;
|
||||
|
@ -86,7 +86,7 @@ Document* Document::createBasicDocument(int imgtype, int width, int height, int
|
||||
// Create the main image.
|
||||
int indexInStock;
|
||||
{
|
||||
UniquePtr<Image> image(image_new(imgtype, width, height));
|
||||
UniquePtr<Image> image(Image::create(imgtype, width, height));
|
||||
|
||||
// Clear the image with mask color.
|
||||
image_clear(image, 0);
|
||||
@ -250,7 +250,7 @@ void Document::prepareExtraCel(int x, int y, int w, int h, int opacity)
|
||||
m_extraImage->w != w ||
|
||||
m_extraImage->h != h) {
|
||||
delete m_extraImage; // image
|
||||
m_extraImage = image_new(getSprite()->getImgType(), w, h);
|
||||
m_extraImage = Image::create(getSprite()->getImgType(), w, h);
|
||||
image_clear(m_extraImage,
|
||||
m_extraImage->mask_color = 0);
|
||||
}
|
||||
@ -344,7 +344,7 @@ void Document::copyLayerContent(const Layer* sourceLayer0, Document* destDoc, La
|
||||
const Image* sourceImage = sourceLayer->getSprite()->getStock()->getImage(sourceCel->getImage());
|
||||
ASSERT(sourceImage != NULL);
|
||||
|
||||
Image* newImage = image_new_copy(sourceImage);
|
||||
Image* newImage = Image::createCopy(sourceImage);
|
||||
newCel->setImage(destLayer->getSprite()->getStock()->addImage(newImage));
|
||||
|
||||
if (undo->isEnabled()) {
|
||||
|
@ -1035,7 +1035,7 @@ static Cel *ase_file_read_cel_chunk(FILE *f, Sprite *sprite, int frame, int imgt
|
||||
int h = fgetw(f);
|
||||
|
||||
if (w > 0 && h > 0) {
|
||||
Image* image = image_new(imgtype, w, h);
|
||||
Image* image = Image::create(imgtype, w, h);
|
||||
if (!image) {
|
||||
delete cel;
|
||||
// Not enough memory for frame's image
|
||||
@ -1070,7 +1070,7 @@ static Cel *ase_file_read_cel_chunk(FILE *f, Sprite *sprite, int frame, int imgt
|
||||
|
||||
if (link) {
|
||||
// Create a copy of the linked cel (avoid using links cel)
|
||||
Image* image = image_new_copy(sprite->getStock()->getImage(link->getImage()));
|
||||
Image* image = Image::createCopy(sprite->getStock()->getImage(link->getImage()));
|
||||
cel->setImage(sprite->getStock()->addImage(image));
|
||||
}
|
||||
else {
|
||||
@ -1087,7 +1087,7 @@ static Cel *ase_file_read_cel_chunk(FILE *f, Sprite *sprite, int frame, int imgt
|
||||
int h = fgetw(f);
|
||||
|
||||
if (w > 0 && h > 0) {
|
||||
Image* image = image_new(imgtype, w, h);
|
||||
Image* image = Image::create(imgtype, w, h);
|
||||
if (!image) {
|
||||
delete cel;
|
||||
// Not enough memory for frame's image
|
||||
|
@ -542,9 +542,9 @@ void fop_operate(FileOp *fop)
|
||||
Sprite* sprite = fop->document->getSprite();
|
||||
|
||||
// Create a temporary bitmap
|
||||
fop->seq.image = image_new(sprite->getImgType(),
|
||||
sprite->getWidth(),
|
||||
sprite->getHeight());
|
||||
fop->seq.image = Image::create(sprite->getImgType(),
|
||||
sprite->getWidth(),
|
||||
sprite->getHeight());
|
||||
if (fop->seq.image != NULL) {
|
||||
int old_frame = sprite->getCurrentFrame();
|
||||
|
||||
@ -722,7 +722,7 @@ Image* fop_sequence_image(FileOp* fop, int imgtype, int w, int h)
|
||||
}
|
||||
|
||||
// Create a bitmap
|
||||
Image* image = image_new(imgtype, w, h);
|
||||
Image* image = Image::create(imgtype, w, h);
|
||||
|
||||
fop->seq.image = image;
|
||||
fop->seq.last_cel = new Cel(fop->seq.frame++, 0);
|
||||
|
@ -99,8 +99,8 @@ bool FliFormat::onLoad(FileOp* fop)
|
||||
h = fli_header.height;
|
||||
|
||||
/* create the bitmaps */
|
||||
bmp = image_new(IMAGE_INDEXED, w, h);
|
||||
old = image_new(IMAGE_INDEXED, w, h);
|
||||
bmp = Image::create(IMAGE_INDEXED, w, h);
|
||||
old = Image::create(IMAGE_INDEXED, w, h);
|
||||
pal = new Palette(0, 256);
|
||||
if (!bmp || !old || !pal) {
|
||||
fop_error(fop, "Not enough memory.\n");
|
||||
@ -142,7 +142,7 @@ bool FliFormat::onLoad(FileOp* fop)
|
||||
frpos_out++;
|
||||
|
||||
/* add the new frame */
|
||||
image = image_new_copy(bmp);
|
||||
image = Image::createCopy(bmp);
|
||||
if (!image) {
|
||||
fop_error(fop, "Not enough memory\n");
|
||||
break;
|
||||
@ -247,8 +247,8 @@ bool FliFormat::onSave(FileOp* fop)
|
||||
fseek(f, 128, SEEK_SET);
|
||||
|
||||
/* create the bitmaps */
|
||||
bmp = image_new(IMAGE_INDEXED, sprite->getWidth(), sprite->getHeight());
|
||||
old = image_new(IMAGE_INDEXED, sprite->getWidth(), sprite->getHeight());
|
||||
bmp = Image::create(IMAGE_INDEXED, sprite->getWidth(), sprite->getHeight());
|
||||
old = Image::create(IMAGE_INDEXED, sprite->getWidth(), sprite->getHeight());
|
||||
if ((!bmp) || (!old)) {
|
||||
fop_error(fop, "Not enough memory for temporary bitmaps.\n");
|
||||
if (bmp) image_free(bmp);
|
||||
|
@ -189,7 +189,7 @@ bool GifFormat::onLoad(FileOp* fop)
|
||||
}
|
||||
|
||||
// Create a temporary image to load frame pixels.
|
||||
UniquePtr<Image> frame_image(image_new(IMAGE_INDEXED, frame_w, frame_h));
|
||||
UniquePtr<Image> frame_image(Image::create(IMAGE_INDEXED, frame_w, frame_h));
|
||||
IndexedTraits::address_t addr;
|
||||
|
||||
if (gif_file->Image.Interlace) {
|
||||
@ -348,8 +348,8 @@ bool GifFormat::onPostLoad(FileOp* fop)
|
||||
// The previous image is used to support the special disposal method
|
||||
// of GIF frames DISPOSAL_METHOD_RESTORE_PREVIOUS (number 3 in
|
||||
// Graphics Extension)
|
||||
UniquePtr<Image> current_image(image_new(imgtype, data->sprite_w, data->sprite_h));
|
||||
UniquePtr<Image> previous_image(image_new(imgtype, data->sprite_w, data->sprite_h));
|
||||
UniquePtr<Image> current_image(Image::create(imgtype, data->sprite_w, data->sprite_h));
|
||||
UniquePtr<Image> previous_image(Image::create(imgtype, data->sprite_w, data->sprite_h));
|
||||
|
||||
// Clear both images with the transparent color (alpha = 0).
|
||||
uint32_t bgcolor = (imgtype == IMAGE_RGB ? _rgba(0, 0, 0, 0):
|
||||
@ -407,7 +407,7 @@ bool GifFormat::onPostLoad(FileOp* fop)
|
||||
// Create a new Cel and a image with the whole content of "current_image"
|
||||
Cel* cel = new Cel(frame_num, 0);
|
||||
try {
|
||||
Image* cel_image = image_new_copy(current_image);
|
||||
Image* cel_image = Image::createCopy(current_image);
|
||||
try {
|
||||
// Add the image in the sprite's stock and update the cel's
|
||||
// reference to the new stock's image.
|
||||
@ -511,8 +511,8 @@ bool GifFormat::onSave(FileOp* fop)
|
||||
throw base::Exception("Error writing GIF header.\n");
|
||||
|
||||
UniquePtr<Image> buffer_image;
|
||||
UniquePtr<Image> current_image(image_new(IMAGE_INDEXED, sprite_w, sprite_h));
|
||||
UniquePtr<Image> previous_image(image_new(IMAGE_INDEXED, sprite_w, sprite_h));
|
||||
UniquePtr<Image> current_image(Image::create(IMAGE_INDEXED, sprite_w, sprite_h));
|
||||
UniquePtr<Image> previous_image(Image::create(IMAGE_INDEXED, sprite_w, sprite_h));
|
||||
int frame_x, frame_y, frame_w, frame_h;
|
||||
int u1, v1, u2, v2;
|
||||
int i1, j1, i2, j2;
|
||||
@ -520,7 +520,7 @@ bool GifFormat::onSave(FileOp* fop)
|
||||
// If the sprite is not Indexed type, we will need a temporary
|
||||
// buffer to render the full RGB or Grayscale sprite.
|
||||
if (sprite_imgtype != IMAGE_INDEXED)
|
||||
buffer_image.reset(image_new(sprite_imgtype, sprite_w, sprite_h));
|
||||
buffer_image.reset(Image::create(sprite_imgtype, sprite_w, sprite_h));
|
||||
|
||||
image_clear(current_image, background_color);
|
||||
image_clear(previous_image, background_color);
|
||||
|
@ -139,7 +139,7 @@ bool IcoFormat::onLoad(FileOp* fop)
|
||||
sprite->getFolder()->add_layer(layer);
|
||||
|
||||
// Create the first image/cel
|
||||
Image* image = image_new(imgtype, width, height);
|
||||
Image* image = Image::create(imgtype, width, height);
|
||||
int image_index = sprite->getStock()->addImage(image);
|
||||
Cel* cel = new Cel(0, image_index);
|
||||
layer->addCel(cel);
|
||||
@ -279,9 +279,9 @@ bool IcoFormat::onSave(FileOp* fop)
|
||||
offset += size;
|
||||
}
|
||||
|
||||
Image* image = image_new(sprite->getImgType(),
|
||||
sprite->getWidth(),
|
||||
sprite->getHeight());
|
||||
Image* image = Image::create(sprite->getImgType(),
|
||||
sprite->getWidth(),
|
||||
sprite->getHeight());
|
||||
|
||||
for (n=0; n<num; ++n) {
|
||||
image_clear(image, 0);
|
||||
|
@ -63,7 +63,7 @@ int Image::getMemSize() const
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
Image* image_new(int imgtype, int w, int h)
|
||||
Image* Image::create(int imgtype, int w, int h)
|
||||
{
|
||||
switch (imgtype) {
|
||||
case IMAGE_RGB: return new ImageImpl<RgbTraits>(w, h);
|
||||
@ -74,7 +74,7 @@ Image* image_new(int imgtype, int w, int h)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Image* image_new_copy(const Image* image)
|
||||
Image* Image::createCopy(const Image* image)
|
||||
{
|
||||
ASSERT(image);
|
||||
return image_crop(image, 0, 0, image->w, image->h, 0);
|
||||
@ -154,7 +154,7 @@ Image* image_crop(const Image* image, int x, int y, int w, int h, int bgcolor)
|
||||
if (w < 1) throw std::invalid_argument("image_crop: Width is less than 1");
|
||||
if (h < 1) throw std::invalid_argument("image_crop: Height is less than 1");
|
||||
|
||||
Image* trim = image_new(image->imgtype, w, h);
|
||||
Image* trim = Image::create(image->imgtype, w, h);
|
||||
trim->mask_color = image->mask_color;
|
||||
|
||||
image_clear(trim, bgcolor);
|
||||
|
@ -52,6 +52,9 @@ public:
|
||||
uint8_t** line; // Start of each scanline.
|
||||
uint32_t mask_color; // Skipped color in merge process.
|
||||
|
||||
static Image* create(int imgtype, int w, int h);
|
||||
static Image* createCopy(const Image* image);
|
||||
|
||||
Image(int imgtype, int w, int h);
|
||||
virtual ~Image();
|
||||
|
||||
@ -68,8 +71,6 @@ public:
|
||||
virtual void to_allegro(BITMAP* bmp, int x, int y, const Palette* palette) const = 0;
|
||||
};
|
||||
|
||||
Image* image_new(int imgtype, int w, int h);
|
||||
Image* image_new_copy(const Image* image);
|
||||
void image_free(Image* image);
|
||||
|
||||
int image_depth(Image* image);
|
||||
|
@ -62,7 +62,7 @@ Image* read_image(std::istream& is)
|
||||
int height = read16(is); // Height
|
||||
uint32_t maskColor = read32(is); // Mask color
|
||||
|
||||
UniquePtr<Image> image(image_new(imgtype, width, height));
|
||||
UniquePtr<Image> image(Image::create(imgtype, width, height));
|
||||
int size = image_line_size(image, image->w);
|
||||
|
||||
for (int c=0; c<image->h; c++)
|
||||
|
@ -324,7 +324,7 @@ LayerImage* layer_new_flatten_copy(Sprite* dst_sprite, const Layer* src_layer,
|
||||
// Does this frame have cels to render?
|
||||
if (has_cels(src_layer, frame)) {
|
||||
// Create a new image
|
||||
Image* image = image_new(flatLayer->getSprite()->getImgType(), w, h);
|
||||
Image* image = Image::create(flatLayer->getSprite()->getImgType(), w, h);
|
||||
|
||||
try {
|
||||
// Create the new cel for the output layer (add the image to stock too).
|
||||
|
@ -141,7 +141,7 @@ void Mask::replace(int x, int y, int w, int h)
|
||||
m_bounds = gfx::Rect(x, y, w, h);
|
||||
|
||||
delete m_bitmap;
|
||||
m_bitmap = image_new(IMAGE_BITMAP, w, h);
|
||||
m_bitmap = Image::create(IMAGE_BITMAP, w, h);
|
||||
|
||||
image_clear(m_bitmap, 1);
|
||||
}
|
||||
@ -378,7 +378,7 @@ void Mask::reserve(int x, int y, int w, int h)
|
||||
m_bounds.y = y;
|
||||
m_bounds.w = w;
|
||||
m_bounds.h = h;
|
||||
m_bitmap = image_new(IMAGE_BITMAP, w, h);
|
||||
m_bitmap = Image::create(IMAGE_BITMAP, w, h);
|
||||
image_clear(m_bitmap, 0);
|
||||
}
|
||||
else {
|
||||
|
@ -99,7 +99,7 @@ void Pen::regenerate_pen()
|
||||
|
||||
clean_pen();
|
||||
|
||||
m_image = image_new(IMAGE_BITMAP, m_size, m_size);
|
||||
m_image = Image::create(IMAGE_BITMAP, m_size, m_size);
|
||||
image_clear(m_image, 0);
|
||||
|
||||
switch (m_type) {
|
||||
|
@ -55,7 +55,7 @@ Palette* quantization::create_palette_from_rgb(const Sprite* sprite)
|
||||
false); // forWrite=false, read only
|
||||
|
||||
// Add a flat image with the current sprite's frame rendered
|
||||
flat_image = image_new(sprite->getImgType(), sprite->getWidth(), sprite->getHeight());
|
||||
flat_image = Image::create(sprite->getImgType(), sprite->getWidth(), sprite->getHeight());
|
||||
image_clear(flat_image, 0);
|
||||
sprite->render(flat_image, 0, 0);
|
||||
|
||||
@ -98,7 +98,7 @@ Image* quantization::convert_imgtype(const Image* image, int imgtype,
|
||||
return ordered_dithering(image, 0, 0, rgbmap, palette);
|
||||
}
|
||||
|
||||
new_image = image_new(imgtype, image->w, image->h);
|
||||
new_image = Image::create(imgtype, image->w, image->h);
|
||||
if (!new_image)
|
||||
return NULL;
|
||||
|
||||
@ -273,7 +273,7 @@ static Image* ordered_dithering(const Image* src_image,
|
||||
int nearestcm;
|
||||
int c, x, y;
|
||||
|
||||
dst_image = image_new(IMAGE_INDEXED, src_image->w, src_image->h);
|
||||
dst_image = Image::create(IMAGE_INDEXED, src_image->w, src_image->h);
|
||||
if (!dst_image)
|
||||
return NULL;
|
||||
|
||||
|
@ -414,7 +414,7 @@ int Sprite::getPixel(int x, int y) const
|
||||
int color = 0;
|
||||
|
||||
if ((x >= 0) && (y >= 0) && (x < m_width) && (y < m_height)) {
|
||||
Image* image = image_new(m_imgtype, 1, 1);
|
||||
Image* image = Image::create(m_imgtype, 1, 1);
|
||||
image_clear(image, (m_imgtype == IMAGE_INDEXED ? getTransparentColor(): 0));
|
||||
render(image, -x, -y);
|
||||
color = image_getpixel(image, 0, 0);
|
||||
|
@ -42,7 +42,7 @@ Stock::Stock(const Stock& stock)
|
||||
if (!stock.getImage(i))
|
||||
addImage(NULL);
|
||||
else {
|
||||
Image* image_copy = image_new_copy(stock.getImage(i));
|
||||
Image* image_copy = Image::createCopy(stock.getImage(i));
|
||||
addImage(image_copy);
|
||||
}
|
||||
}
|
||||
|
@ -210,9 +210,9 @@ void UndoTransaction::autocropSprite(int bgcolor)
|
||||
x1 = y1 = INT_MAX;
|
||||
x2 = y2 = INT_MIN;
|
||||
|
||||
Image* image = image_new(m_sprite->getImgType(),
|
||||
m_sprite->getWidth(),
|
||||
m_sprite->getHeight());
|
||||
Image* image = Image::create(m_sprite->getImgType(),
|
||||
m_sprite->getWidth(),
|
||||
m_sprite->getHeight());
|
||||
|
||||
for (int frame=0; frame<m_sprite->getTotalFrames(); ++frame) {
|
||||
m_sprite->setCurrentFrame(frame);
|
||||
@ -472,9 +472,9 @@ void UndoTransaction::backgroundFromLayer(LayerImage* layer, int bgcolor)
|
||||
|
||||
// create a temporary image to draw each frame of the new
|
||||
// `Background' layer
|
||||
UniquePtr<Image> bg_image_wrap(image_new(m_sprite->getImgType(),
|
||||
m_sprite->getWidth(),
|
||||
m_sprite->getHeight()));
|
||||
UniquePtr<Image> bg_image_wrap(Image::create(m_sprite->getImgType(),
|
||||
m_sprite->getWidth(),
|
||||
m_sprite->getHeight()));
|
||||
Image* bg_image = bg_image_wrap.get();
|
||||
|
||||
CelIterator it = layer->getCelBegin();
|
||||
@ -509,7 +509,7 @@ void UndoTransaction::backgroundFromLayer(LayerImage* layer, int bgcolor)
|
||||
image_copy(cel_image, bg_image, 0, 0);
|
||||
}
|
||||
else {
|
||||
replaceStockImage(cel->getImage(), image_new_copy(bg_image));
|
||||
replaceStockImage(cel->getImage(), Image::createCopy(bg_image));
|
||||
}
|
||||
}
|
||||
|
||||
@ -517,7 +517,7 @@ void UndoTransaction::backgroundFromLayer(LayerImage* layer, int bgcolor)
|
||||
for (int frame=0; frame<m_sprite->getTotalFrames(); frame++) {
|
||||
Cel* cel = layer->getCel(frame);
|
||||
if (!cel) {
|
||||
Image* cel_image = image_new(m_sprite->getImgType(), m_sprite->getWidth(), m_sprite->getHeight());
|
||||
Image* cel_image = Image::create(m_sprite->getImgType(), m_sprite->getWidth(), m_sprite->getHeight());
|
||||
image_clear(cel_image, bgcolor);
|
||||
|
||||
// Add the new image in the stock
|
||||
@ -558,9 +558,9 @@ void UndoTransaction::flattenLayers(int bgcolor)
|
||||
int frame;
|
||||
|
||||
// create a temporary image
|
||||
UniquePtr<Image> image_wrap(image_new(m_sprite->getImgType(),
|
||||
m_sprite->getWidth(),
|
||||
m_sprite->getHeight()));
|
||||
UniquePtr<Image> image_wrap(Image::create(m_sprite->getImgType(),
|
||||
m_sprite->getWidth(),
|
||||
m_sprite->getHeight()));
|
||||
Image* image = image_wrap.get();
|
||||
|
||||
/* get the background layer from the sprite */
|
||||
@ -605,7 +605,7 @@ void UndoTransaction::flattenLayers(int bgcolor)
|
||||
else {
|
||||
/* if there aren't a cel in this frame in the background, we
|
||||
have to create a copy of the image for the new cel */
|
||||
cel_image = image_new_copy(image);
|
||||
cel_image = Image::createCopy(image);
|
||||
/* TODO error handling: if (!cel_image) { ... } */
|
||||
|
||||
/* here we create the new cel (with the new image `cel_image') */
|
||||
@ -769,7 +769,7 @@ void UndoTransaction::copyPreviousFrame(Layer* layer, int frame)
|
||||
return;
|
||||
|
||||
// copy the image
|
||||
Image* dst_image = image_new_copy(src_image);
|
||||
Image* dst_image = Image::createCopy(src_image);
|
||||
int image_index = addImageInStock(dst_image);
|
||||
|
||||
// create the new cel
|
||||
@ -1088,7 +1088,7 @@ void UndoTransaction::pasteImage(const Image* src_image, int x, int y, int opaci
|
||||
ASSERT(cel);
|
||||
|
||||
Image* cel_image = m_sprite->getStock()->getImage(cel->getImage());
|
||||
Image* cel_image2 = image_new_copy(cel_image);
|
||||
Image* cel_image2 = Image::createCopy(cel_image);
|
||||
image_merge(cel_image2, src_image, x-cel->getX(), y-cel->getY(), opacity, BLEND_MODE_NORMAL);
|
||||
|
||||
replaceStockImage(cel->getImage(), cel_image2); // TODO fix this, improve, avoid replacing the whole image
|
||||
|
@ -216,7 +216,7 @@ void copy_cel(DocumentWriter& document)
|
||||
dst_cel_opacity = 255;
|
||||
}
|
||||
else {
|
||||
dst_image = image_new_copy(src_image);
|
||||
dst_image = Image::createCopy(src_image);
|
||||
dst_cel_x = src_cel->getX();
|
||||
dst_cel_y = src_cel->getY();
|
||||
dst_cel_opacity = src_cel->getOpacity();
|
||||
|
@ -157,7 +157,7 @@ void clipboard::copy(const DocumentReader& document)
|
||||
|
||||
void clipboard::copy_image(Image* image, Palette* pal, const gfx::Point& point)
|
||||
{
|
||||
set_clipboard(image_new_copy(image),
|
||||
set_clipboard(Image::createCopy(image),
|
||||
pal ? new Palette(*pal): NULL, true);
|
||||
|
||||
clipboard_x = point.x;
|
||||
|
@ -186,10 +186,10 @@ static void get_win32_clipboard_bitmap(Image*& image, Palette*& palette)
|
||||
}
|
||||
|
||||
try {
|
||||
image = image_new(bi->bmiHeader.biBitCount == 8 ? IMAGE_INDEXED:
|
||||
IMAGE_RGB,
|
||||
bi->bmiHeader.biWidth,
|
||||
ABS(bi->bmiHeader.biHeight));
|
||||
image = Image::create(bi->bmiHeader.biBitCount == 8 ? IMAGE_INDEXED:
|
||||
IMAGE_RGB,
|
||||
bi->bmiHeader.biWidth,
|
||||
ABS(bi->bmiHeader.biHeight));
|
||||
|
||||
bool valid_image = false;
|
||||
switch (bi->bmiHeader.biBitCount) {
|
||||
|
@ -55,7 +55,7 @@ ExpandCelCanvas::ExpandCelCanvas(Document* document, Sprite* sprite, Layer* laye
|
||||
// If there is no Cel
|
||||
if (m_cel == NULL) {
|
||||
// Create the image
|
||||
m_celImage = image_new(m_sprite->getImgType(), m_sprite->getWidth(), m_sprite->getHeight());
|
||||
m_celImage = Image::create(m_sprite->getImgType(), m_sprite->getWidth(), m_sprite->getHeight());
|
||||
image_clear(m_celImage, sprite->getTransparentColor());
|
||||
|
||||
// create the cel
|
||||
@ -90,7 +90,7 @@ ExpandCelCanvas::ExpandCelCanvas(Document* document, Sprite* sprite, Layer* laye
|
||||
y1-m_cel->getY(), x2-x1, y2-y1,
|
||||
m_sprite->getTransparentColor());
|
||||
|
||||
m_dstImage = image_new_copy(m_srcImage);
|
||||
m_dstImage = Image::createCopy(m_srcImage);
|
||||
|
||||
// We have to adjust the cel position to match the m_dstImage
|
||||
// position (the new m_dstImage will be used in RenderEngine to
|
||||
|
@ -53,7 +53,7 @@ Image* NewImageFromMask(const Document* srcDocument)
|
||||
ASSERT(srcBitmap);
|
||||
ASSERT(src);
|
||||
|
||||
dst = image_new(srcSprite->getImgType(), srcBounds.w, srcBounds.h);
|
||||
dst = Image::create(srcSprite->getImgType(), srcBounds.w, srcBounds.h);
|
||||
if (!dst)
|
||||
return NULL;
|
||||
|
||||
|
@ -75,7 +75,7 @@ Image *load_pic_file(const char *filename, int *x, int *y, RGB *palette)
|
||||
}
|
||||
|
||||
/* read image */
|
||||
image = image_new(IMAGE_INDEXED, w, h);
|
||||
image = Image::create(IMAGE_INDEXED, w, h);
|
||||
|
||||
for (v=0; v<h; v++)
|
||||
for (u=0; u<w; u++)
|
||||
@ -117,7 +117,7 @@ Image *load_pic_file(const char *filename, int *x, int *y, RGB *palette)
|
||||
|
||||
size -= 64; /* the header uses 64 bytes */
|
||||
|
||||
image = image_new (bpp == 8 ? IMAGE_INDEXED: IMAGE_BITMAP, w, h);
|
||||
image = Image::create(bpp == 8 ? IMAGE_INDEXED: IMAGE_BITMAP, w, h);
|
||||
|
||||
/* read blocks to end of file */
|
||||
while (size > 0) {
|
||||
|
@ -400,7 +400,7 @@ Image* RenderEngine::renderSprite(const Document* document,
|
||||
}
|
||||
|
||||
// Create a temporary RGB bitmap to draw all to it
|
||||
image = image_new(IMAGE_RGB, width, height);
|
||||
image = Image::create(IMAGE_RGB, width, height);
|
||||
if (!image)
|
||||
return NULL;
|
||||
|
||||
|
@ -46,7 +46,7 @@ PixelsMovement::PixelsMovement(Document* document, Sprite* sprite, const Image*
|
||||
, m_isDragging(false)
|
||||
, m_adjustPivot(false)
|
||||
, m_handle(NoHandle)
|
||||
, m_originalImage(image_new_copy(moveThis))
|
||||
, m_originalImage(Image::createCopy(moveThis))
|
||||
{
|
||||
m_initialData = gfx::Transformation(gfx::Rect(initialX, initialY, moveThis->w, moveThis->h));
|
||||
m_currentData = m_initialData;
|
||||
@ -366,7 +366,7 @@ Image* PixelsMovement::getDraggedImageCopy(gfx::Point& origin)
|
||||
|
||||
int width = rightBottom.x - leftTop.x;
|
||||
int height = rightBottom.y - leftTop.y;
|
||||
UniquePtr<Image> image(image_new(m_sprite->getImgType(), width, height));
|
||||
UniquePtr<Image> image(Image::create(m_sprite->getImgType(), width, height));
|
||||
image_clear(image, image->mask_color);
|
||||
image_parallelogram(image, m_originalImage,
|
||||
corners.leftTop().x-leftTop.x, corners.leftTop().y-leftTop.y,
|
||||
|
@ -794,7 +794,7 @@ static void monitor_thumbnail_generation(void *_data)
|
||||
data->palette = new Palette(*sprite->getPalette(0));
|
||||
|
||||
// Render the 'sprite' in one plain 'image'
|
||||
image = image_new(sprite->getImgType(), sprite->getWidth(), sprite->getHeight());
|
||||
image = Image::create(sprite->getImgType(), sprite->getWidth(), sprite->getHeight());
|
||||
sprite->render(image, 0, 0);
|
||||
|
||||
// Calculate the thumbnail size
|
||||
@ -808,7 +808,7 @@ static void monitor_thumbnail_generation(void *_data)
|
||||
thumb_h = MID(1, thumb_h, MAX_THUMBNAIL_SIZE);
|
||||
|
||||
// Stretch the 'image'
|
||||
data->thumbnail = image_new(image->imgtype, thumb_w, thumb_h);
|
||||
data->thumbnail = Image::create(image->imgtype, thumb_w, thumb_h);
|
||||
image_clear(data->thumbnail, 0);
|
||||
image_scale(data->thumbnail, image, 0, 0, thumb_w, thumb_h);
|
||||
image_free(image);
|
||||
|
Loading…
x
Reference in New Issue
Block a user