Math - Resizing Container Height According to Scalable and Fixed Objects -


i'm try determine amount scale down image, in container other fixed height text fields, based on resizing of window layout container contents.

in problem i'm concerned height, when mention scale, i'm refering height scale or scaley.

in diagram below:

  1. blue = resizable main window.
  2. green = resizable container within main window.
  3. red = fixed-height text fields (non-scalable).
  4. black = scalable image.

    enter image description here

the contents (text fields , image) fill container, green container can represent height of text fields , image, or @ least difference between first text field's y coordinate , last text field's y coordinate , height.

resizing window larger green container have no affect on green container , remain current size. however, resizing window smaller must change container size fit. have access image height. resizing window smaller scale image height. new scaled image height determine height of container includes fixed height text fields.

problem: after resizing window lower height, how can find out how scale image (between 0.0 , 1.0) fixed height text fields remain distant each other , container resized bounds remain equally distant (10px apart in diagram) window.

image.scaley = ... 

reducing window size dh pixel must reduce image height dh pixel in order maintain other absolute values.

thus, scaling factor (given image_height current image height , dh number of pixels reduce)

scale_y = (image_height - dh) / image_height 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -