How can I make an application with the same ratio width/height? I have an application with width = 800 height = 600. Its width = 1.33*height and when I change the width to 1024 I want the height to change to 768 automatically.
Do you mean your swf change it´s size?
you would need swffit to do it.
if you want to change your content on your movie, you have to calculate the ratio, more or less like this:
ratio = width/height;
newHeight = newWidth/ratio;
and vice-versa for the width…
Related
I've been making a website with react and I've been using css with classNames. I also was following a figma document where the figma screens were a certain size lets say x pixels by y pixels. But, on other computers, it might have a larger or smaller pixel dimension (a pixels by b pixels). I've used the x by y pixel for div dimensions as well as button sizes and more. So, when I open my application on other computers with a larger pixel dimension, a portion of the screen is just white, and it still displays the website as if it were on a smaller screen. Is there a way to fix this so that even though I used pixel values my app will adjust to different sized screens? Or, do I have to go back and change everything to percentages?
You need to think about proportion when building your UI.
1- Use percentage(%) for width and aspectRatio for height, or vice versa.
container: {
width: "100%",
aspectRatio: 10 / 3, //height will be "30%" of your width
}
2- Use flex for the jobs percentage can't do. For example, if you have arbitrary size of items in a list and you want them to share equal sizes. Assign each of them with flex: 1
3- Use rem from EStyleSheet instead of pixels. rem is a scale factor. For example, if your rem is 2 and your “11rem” will become “11*2” = “22”. If we make rem proportion to the screen sizes, your UI will scale with any screen sizes.
//we define rem equals to the entireScreenWidth / 380
const entireScreenWidth = Dimensions.get('window').width;
EStyleSheet.build({$rem: entireScreenWidth / 380});
enter code here
//how to use rem
container: {
width: "100%",
aspectRatio: 10 / 3, //height will be "30%"
padding: "8rem", //it'll scale depend on the screen sizes.
}
4- Use scrollView for contents that could potentially scale out of the boxes. For example, a TextView
5- Every time you think about using pixels, consider use rem in method 3.
Just like in title: I'd like to add several external images to my .docx document. But when using body_add_img I need to specify width and height. Is there a way to set them to width and height of original image to be added?
Why I need that? My images (about 50 of them) have all different widths and heights, so it would be painful to manually put their widths and heights in (about 50) body_add_img calls.
If your image is a png you can png::readPNG to get the width and height in pixels, and divide by your DPI to get the dimensions in inches. (Replace 300 with your DPI)
dpi <- 300
img_size <- dim(png::readPNG('image/path/here.png'))/dpi
Edit:
If you want the dpi in the doc to be the same as the dpi in the image natively (assuming your png has the dpi stored, I think not all do), use dpi <- attr(readPNG('image.png', info=T), 'info')$dpi
I am write a paint program.
pix = QPixmap(600,500); // set size to 600X500
How to change size after this? Someting like:
pix.setSize(800,600); // Change size to 800X600
I think, QPixmap::scaled is what you need.
Returns a copy of the pixmap scaled to a rectangle with the given width and height according to the given aspectRatioMode and transformMode.
I am currently building an application that makes use of QML WebView (import QtWebKit 3.0). The users need to resize the WebView very often (I am using a QML SplitView), however this leads to the UI to lag extremely whenever the app window is resized. Is there any way to prevent this?
Instead of changing the width and height properties change scale property of the WebView.
At beginning of the resize save initial values of width and height.
On resize don't change width and height. Instead set scale to newWidth divided by width at beginning of the resize.
When resize ends set new values of width and height to these properties and set scale to 1.
EDIT:
Since you don't have control of width and height properties you can replace WebView with Rectangle with color set to "transparent". Then you can place WebView on Rectangle and watch how width and height of Rectangle are changing.
Now two things.
If you don't know when resize starts and when ends use Timer with interval for example 100ms. Restart Timer and update scale every time width and height of Rectangle changes. When Timer is triggered set real width and height.
If ratio of width and height of Rectangle is not constant use QML object Scale. With it you can change xScale and yScale independently.
I'm working on designing a website with photoshop, the problem is that the height limit of the PSD is reached.. and I'm still not finished
So how can I increase the size of the height without effecting the elements inside ?
Thank you
Using canvase size you want to increase you page height
path : image=>canvase size (shortcut:Alt + Cntr + C)
than using arrow left,top,right and bottom specified page increase