Table of Contents

 
ClipImage
 

Purpose

Creates a clipping rectangle to clip blits to the surface

 

Protoype

void CImageMngr::ClipImage (string str_img_id, int i_rx = 0, int i_ry = 0, int i_rw = -1, int i_rh = -1)
 

Parameters

img_id the ID if the image object to clip
rx the X position of the clip rectangle
ry the Y position of the clip rectangle
rw the width of the clip rectangle
rh the height of the clip rectangle
 

Description

This function imposes a clipping rectangle upon an image. When the image is blitted onto a surface, only the part of the image within the clipping rectangle will be included in the blit. The rest will not be displayed. You must pass in the ID of the image object you want to assign this clipping rectangle to and then set the rectangle's position and size in pixels. To disable a clip window you should call this function again passing only the image ID.

 

Use

CImageMngr image;
// set the clip window
image.ClipImage("my_image", 25, 25, 100, 100);
// reset it to the surface size
image.ClipImage("my_image"); 
 

Prev: ChangeAlpha