GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
crop_image(3) Arcan Lua API crop_image(3)

crop_image - Crop image to specific dimensions

nil
crop_image( width, height )

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 coordinates 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.

1
Another option to obtain the same effect is to create a null_surface, 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.

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

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

June 2022 image

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.