Exemple #1
0
void
TFB_DrawImage_FixScaling (TFB_Image *image, int target, int type)
{
	if (image->dirty || !image->ScaledImg ||
			target != image->last_scale ||
			type != image->last_scale_type)
	{
		image->dirty = FALSE;
		image->ScaledImg = TFB_DrawCanvas_New_ScaleTarget (image->NormalImg,
			image->ScaledImg, type, image->last_scale_type);
		
		if (type == TFB_SCALE_NEAREST)
			TFB_DrawCanvas_Rescale_Nearest (image->NormalImg,
					image->ScaledImg, target, &image->NormalHs,
					&image->extent, &image->last_scale_hs);
		else if (type == TFB_SCALE_BILINEAR)
			TFB_DrawCanvas_Rescale_Bilinear (image->NormalImg,
					image->ScaledImg, target, &image->NormalHs,
					&image->extent, &image->last_scale_hs);
		else
			TFB_DrawCanvas_Rescale_Trilinear (image->NormalImg,
					image->MipmapImg, image->ScaledImg, target,
					&image->NormalHs, &image->MipmapHs,
					&image->extent, &image->last_scale_hs);

		image->last_scale_type = type;
		image->last_scale = target;
	}
}
Exemple #2
0
// stretch_frame
// create a new frame of size neww x newh, and blit a scaled version FramePtr
// into it.
// destroy the old frame if 'destroy' is 1
FRAME stretch_frame (FRAME FramePtr, int neww, int newh, int destroy)
{
	FRAME NewFrame;
	CREATE_FLAGS flags;
	TFB_Image *tfbImg;
	TFB_Canvas src, dst;

	flags = GetFrameParentDrawable (FramePtr)->Flags;
	NewFrame = CaptureDrawable (
				CreateDrawable (flags, (SIZE)neww, (SIZE)newh, 1));
	tfbImg = FramePtr->image;
	LockMutex (tfbImg->mutex);
	src = tfbImg->NormalImg;
	dst = NewFrame->image->NormalImg;
	TFB_DrawCanvas_Rescale_Nearest (src, dst, -1, NULL, NULL, NULL);
	UnlockMutex (tfbImg->mutex);
	if (destroy)
		DestroyDrawable (ReleaseDrawable (FramePtr));
	return (NewFrame);
}