对于CSS,垂直边界崩溃,但为什么浮动的div不会折叠垂直边缘?(For CSS, vertical margin collapses, but why floated divs don't collapse vertical margins?)
对于CSS,我们知道垂直边缘崩溃了,例如:
(div之间的垂直边距只有30px。)
但是浮动的div呢? 为什么垂直边界不会崩溃?
例如: http : //jsfiddle.net/rbxL7/3/
(div之间的水平和垂直边距都是60px)。
For CSS, we know that vertical margin collapses, such as in example:
(The vertical margin between the divs are only 30px.)
But what about floated divs? Why do the vertical margins not collapse?
example: http://jsfiddle.net/rbxL7/3/
(the horizontal and vertical margins between the divs both end up as 60px).
原文:https://stackoverflow.com/questions/6222209
最满意答案
你在这里做的是复制整个屏幕并在坐标
Rect(442,440,792,520);
处绘制Rect(442,440,792,520);
在你的新位图中......哪个是画布上的。坐标
Rect(442,440,792,520)
对应于你想要从源位图获得的部分。 你想把它复制到你的新位图的“内部”,所以在rectRect(0,0,350,80)
你可以简单地调整你的矩形:
rect_source := Rect(442,440,792,520); rect_destination := Rect(0,0,350,80);
其余的代码看起来是正确的。
What you are doing here is copying the whole screen and draw it at coordinate
Rect(442,440,792,520);
in your new bitmap... Which is off its canvas.The coordinate
Rect(442,440,792,520)
correspond to the part you want to get from the source bitmap. You want to copy it "inside" your new bitmap, so within the rectRect(0,0,350,80)
You can simply adjust your rect like this :
rect_source := Rect(442,440,792,520); rect_destination := Rect(0,0,350,80);
The rest of your code seems correct.
相关问答
更多-
我们可以通过剪切整个页面截图来获取元素屏幕截图如下所示: driver.get("http://www.google.com"); WebElement ele = driver.findElement(By.id("hplogo")); // Get entire page screenshot File screenshot = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE); BufferedImage fullImg = Im ...
-
您可以使用以下方法获取显示屏幕的屏幕截图 public static Bitmap getScreenShot() { // get the current screen . Bitmap bitmap; bitmap = new Bitmap(Display.getWidth(), Display.getHeight()); Display.screenshot(bitmap); // return the screen shot return bitmap ...
-
以下是一些让您开始的代码: public void CaptureApplication(string procName) { var proc = Process.GetProcessesByName(procName)[0]; var rect = new User32.Rect(); User32.GetWindowRect(proc.MainWindowHandle, ref rect); int width = rect.right - rect.left; ...
-
截取屏幕上未完全显示的“缩放”图像的屏幕截图(taking screenshot of a 'zoom' ed image which is not shown completely on screen)[2023-10-23]
它比我想象的要简单得多。 只需在调用“DrawToBitmap”之前将缩放设置为100%并保存图像。 之后重新分配prev变焦值。 而已。 奇迹般有效。 It was much more simple than i had expected. just make zoom to 100% before calling 'DrawToBitmap' and save the image. after that re assign the prev zoom value. thats it. works lik ... -
你在这里做的是复制整个屏幕并在坐标Rect(442,440,792,520);处绘制Rect(442,440,792,520); 在你的新位图中......哪个是画布上的。 坐标Rect(442,440,792,520)对应于你想要从源位图获得的部分。 你想把它复制到你的新位图的“内部”,所以在rect Rect(0,0,350,80) 你可以简单地调整你的矩形: rect_source := Rect(442,440,792,520); rect_destination := Rect(0,0,350 ...
-
你不想要: Bitmap viewBmp = Bitmap.createBitmap(view.getLayoutParams().width, view.getLayoutParams().height, Bitmap.Config.ARGB_8888); LayoutParams通常不具有实际的宽度和高度。 通常它有负值,表示wrap_content或match_parent 。 相反,尝试: Bitmap viewBmp = Bitmap.createBitmap(view.getW ...
-
正如您所理论的那样,UIWebView没有时间加载页面。 该方法将异步启动页面加载; 在您返回运行循环之前, UIWebView可能无法完成任何工作。 尝试实现webViewDidFinishLoad:并在完成后进行渲染。 As you theorized, there isn't time for the UIWebView to load the page. That method will asynchronously start the page load; the UIWebView probab ...
-
您可以截取整个页面,然后将图像裁剪为您想要的元素: const fs = require('fs'); const PNG = require('pngjs').PNG; var elem = element(by.model('model.username')); promise.all([ elem.getLocation(), elem.getSize(), browser.takeScreenshot() ]).then(function(result) { va ...
-
新的html2canvas版本1有width , height , x和y选项。 您可以利用这些选项来实现Firefox屏幕截图的裁剪功能。 document.onmousedown = startDrag; document.onmouseup = endDrag; document.onmousemove = expandDrag; var dragging = false, dragStart = { x: 0, y: 0 }, dragEnd = { ...
-
在Android上截取屏幕截图(Take a screenshot on Android)[2022-12-17]
这是一个安全漏洞。 你应该有一个root设备才能做到这一点。 您可以将此代码与您自己的应用程序一起使用:(我从这个答案获得了另一个问题的代码: https : //stackoverflow.com/a/5651242/237838 ) // image naming and path to include sd card appending name you choose for file String mPath = Environment.getExternalStorageDirectory() ...