pixels

What are the units for form widths and heights in VBA?

自古美人都是妖i 提交于 2019-12-30 06:56:25
问题 I'm programming VBA for Word 2007. I've created a UserForm which I need to resize with script. I noticed that its not pixels Me.Width = pixelW // form appears about 20% larger than the pixel width And its not twips either Me.Width = (((1 / TwipsPerPixelX()) * pixelW)) / 1) // form appears very small So how are form widths and heights measured in Office 2007 VBA? 回答1: When manipulating controls on forms through code the sizes are in twips by default (I believe if you change the form's

Convert Pixels to Inches and vice versa in C#

纵然是瞬间 提交于 2019-12-30 04:38:05
问题 I am looking to convert pixes to inches and vice versa. I understand that I need DPI, but I am not sure how to get this information (e.g. I don't have the Graphics object, so that's not an option). Is there a way? 回答1: On a video device, any answer to this question is typically not very accurate. The easiest example to use to see why this is the case is a projector. The output resolution is, say, 1024x768, but the DPI varies by how far away the screen is from the projector apeture. WPF, for

How do I access the pixels of an image using OpenCV-Python?

时光总嘲笑我的痴心妄想 提交于 2019-12-30 01:12:08
问题 I want to know how to loop through all pixels of an image. I tried this: import cv2 import numpy as np x = np.random.randint(0,5,(500,500)) img = cv2.imread('D:\Project\Capture1.jpg',0) p = img.shape print p rows,cols = img.shape for i in range(rows): for j in range(cols): k = x[i,j] print k It prints a vertical set of numbers which is not in the form of an array. I am also getting an array out of bounds exception. Please suggest a method. 回答1: Access specific pixel in Python import cv2 image

Android OpenGL Screenshot

廉价感情. 提交于 2019-12-28 12:12:08
问题 I've searched a lot about taking screenshot of my OpenGL object on Android and come up with this solution. It worked great but in my case I have camera view and opengl view(with transparent background) on top of camera view. So what I want to do is to get opengl screenshot with transparent background instead of black. As I said I have tried link above and it worked but I'm stuck with black background. It's little bit complicated to figure out how to get rid of the black background in this

How do I load and edit a bitmap file at the pixel level in Swift for iOS?

ぃ、小莉子 提交于 2019-12-28 05:46:31
问题 I want to manipulate an image at the pixel level in Swift. This question was answered for objective c: How do I access and manipulate JPEG image pixels?, but I would like to see the equivalent source for Swift. 回答1: This is how I am getting a color from an image at a touch location. I translated this answer: https://stackoverflow.com/a/12579413/359578 (This sample does no error checking for nil) func createARGBBitmapContext(inImage: CGImage) -> CGContext { var bitmapByteCount = 0 var

Is 1 CSS point equal to 75% to a CSS Pixel? [duplicate]

ⅰ亾dé卋堺 提交于 2019-12-25 16:57:37
问题 This question already has answers here : Pixels vs. Points in HTML/CSS (9 answers) Closed 2 years ago . I'm trying to understand the how CSS pixels relates to CSS points nowadays and what I've read is that one css point is a 3/4 pixel. Is that correct? And I can ignore the old idea that 1pt would be 1/72 of 1in because of difference in resolution and physical monitor sizes. If I want to convert css points to pixels a formula could look like this then? Xpt/75*100 = Ypx And if want to convert

How do I prevent a memory leak with UIImage.FromImage(context.ToImage())?

社会主义新天地 提交于 2019-12-24 10:40:40
问题 I have the following function to convert a byte array of pixels into an image. However, I have a memory leak in the line: unpackedImage = UIImage.FromImage(context.ToImage()); When I comment out the line above, the leak goes away. The leak is so bad that iOS is killing my app within about 30 seconds of startup. It's because of this line of code. How do I prevent this memory leak? Is there a better way to do what I am trying to do? public static void DrawCustomImage2(IntPtr buffer, int width,

how to efficiently track the use of space on a map, both objects and free areas

孤街醉人 提交于 2019-12-24 00:03:50
问题 OK I start with a blank map, which is 512x512 = 262144 pixels/locations. I need a way to efficiently draw some objects on it, and then be able to find the areas of free space, so that later more different objects can be added to these free areas. I cant figure out the best way to store this data, or algorithms to find the free areas. I had a working solution, but it took forever to compute. I'm working with AS3, in case that impacts what would be the best solution. Any Advice? thanks. 回答1:

MS PowerPoint: how to convert a shape's position and size into screen coordinates?

时间秒杀一切 提交于 2019-12-23 18:13:56
问题 I wrote me a little VBA Macro for PowerPoint (2010) that opens a popup with explanations when hovering over some Shape. This works fine. Alas, there is no event that is triggered when leaving the area again and so I now want to extend the code such that it monitors the area of the popup and when the pointer leaves that area it removes the popup again. But now I ran into some stupid problem: the coordinates of the Shape (.Left, .Top, .Width, and .Height) are given in some "document units" (don

How to convert dp to px in xamarin.android?

时间秒杀一切 提交于 2019-12-23 07:27:33
问题 I want to convert dp to px in my C# code in xamarin.android , but all I could find were java codes in android studio that have some problems in xamarin . I tried to use equivalent like using Resources instead of getResources() and I could solve some little problems, but there are some problems yet that I couldn't find any equivalent for them. here are original codes, my codes, and my codes problems in xamarin: First code (found from Programatically set height on LayoutParams as density