Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
crop_image(3)			  Arcan Lua API 		   crop_image(3)

NAME
     crop_image - Crop image to specific dimensions

SYNOPSIS
     nil
     crop_image( width, height )

DESCRIPTION
     For  some	cases,	primarily  resizing text, the default scale- and resize-
     function behavior is unappealing because any  under  or  oversampling  will
     rapidly  decrease	quality. This function act as a resize down to 1:1 scale
     for values larger than the initial size, and changes effective texture  co-
     ordinates	for values larger than the initial size. This will have the side
     effect of reverting other texture sampling  manipulations	like  mirroring,
     and it will reset any pending resize transformation chains.

NOTES
     1	    Another  option  to  obtain the same effect is to create a null_sur-
	    face, link the image to this surface and enable shallow clipping but
	    it results in a more complex structure to render and  more	code  to
	    properly set up.

EXAMPLE
     function crop_image0()
	   local img = load_image("test.png");
	   local props = image_surface_properties(img);
	   crop_image(img, 0.5 * props.width, 0.5 * props.height);
	   show_image(img);
     end

EXAMPLE
     function crop_image1()
	   local img = render_text([[onts/default.ttf,18      local props = image_surface_properties(img);
	   crop_image(img, 0.5 * props.width, 0.5 * props.height);
	   show_image(img);
     end

SEE ALSO:
image				   August 2026			   crop_image(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=crop_image&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help