pixels

CSS width/height pixel and percentage calculation combintaion?

本小妞迷上赌 提交于 2019-12-04 07:05:55
Is there a way to set the height/width CSS properties to something like that: 100% - 50px So if the total 100% is 1000px, then the end result would be 950px. And the 100% is set by the browser size. UPDATE: What I'm trying to do is: I have two div, the first div's height is 50px, I would like the second div's height to cover the remaining space. patricjansson There is a solution in css3, and I also actually think it has been supported in IE for sometime. Example: width: -moz-calc(25% - 1em); See http://hacks.mozilla.org/2010/06/css3-calc/ After search though the net, I realized that it can't

How to determine and interpret the pixel format of a CGImage

我是研究僧i 提交于 2019-12-04 04:49:14
I'm loading this (very small) image using: UIImage* image = [UIImage named:@"someFile.png"]; The image is 4x1 and it contains a red, green, blue and white pixel from left to right, in that order. Next, I get the pixel data out of the underlying CGImage: NSData* data = (NSData*)CGDataProviderCopyData(CGImageGetDataProvider(image.CGImage)); Now, for some reason, the pixel data is laid out differently depending on the iOS device. When I run the app in the simulator or on my iPhone 4, the pixel data looks like this: (255,0,0),(0,255,0),(0,0,255),(255,255,255) So, the pixels are 3 bytes per pixel,

algorithm for finding out pixel coordinates on a circumference of a circle

雨燕双飞 提交于 2019-12-04 03:54:21
how do i find out pixel value at certain degree on the circumference of a circle if I know the pixel co-ordinates of the center of the circle, radius of the circle ,and perpendicular angle. Basically, I am trying to draw the hands of a clock at various times ( 1 o clock , 2 o clock etc ) Let h be the hour as a floating point number ( h=2.25 would be 02:15, etc.) between 0 and 12. (cX,cY) are the coordinates of the center. hLength and mLength are the lengths of the hour and min hands. // Hour hand hAngle = 2.0*Pi*h/12.0; // 0..12 mapped to 0..2*Pi hX = cX + hLength * sin(hAngle); hY = cY -

Need Faster way to get RGB value for each Pixel of a Buffered Image

匆匆过客 提交于 2019-12-04 01:20:37
问题 What is the fastest way to get the RGB value of each pixel of a BufferedImage ? Right now I am getting the RGB values using two for loops as shown in the code below, but it took too long to get those values as the nested loop runs a total of 479999 times for my image. If I use a 16-bit image this number would be even higher! I need a faster way to get the pixel values. Here is the code I am currently trying to work with: BufferedImage bi=ImageIO.read(new File("C:\\images\\Sunset.jpg")); int

Browsers truncate border values to integers

浪尽此生 提交于 2019-12-04 00:33:58
Whenever a non-integer pixel value is used for the border of an element, the browser simply truncates the value to become an integer. Why is this the case? I'm aware that the border will not actually take up part of a pixel, but these types of values are sometimes used in combination with others to form full pixels. For example, the left and right border having widths of 1.6px should cause the total width of the element to increase by 3px. This works because the full value is stored in memory and used for calculations . However, this seems to not be the case when rendering the border even

Poor resolution in knitr using Rmd

帅比萌擦擦* 提交于 2019-12-03 11:37:40
问题 I have a .Rmd file and I am trying to create a .docx file via the function pandoc. I want to have a figure with final resolution of 504x504 pixels (i.e., 7x7inch with 72dpi). Unfortunately, the default 72 dpi is too poor in quality, and I would like to increase it to, say, 150 dpi without altering the final resolution (so it will already have the correct size within the .docx file). If I keep options fig.width and fig.height=7 and set dpi=150, I get the quality I want but the final resolution

Relation between dp - sp and PX

霸气de小男生 提交于 2019-12-03 11:31:25
问题 I am not asking what is the difference between dp,sp and px. I am designing a website based on google's new material design, all the measurements are in dp (for grid) and sp(for text). My question is how do they translate to pixels. I have been designing websites for more than 4 years and all the measurements (grid and font) are in pixels. For Example: A headline is 24sp, how many pixels does it equate to? (its not 24px, I've tried matching them, it's around 28px but there has to be a

How can I stretch bitmap in WPF without smoothing pixels

柔情痞子 提交于 2019-12-03 08:42:46
问题 I'm working on SEM image processing application, written in WPF. I have an image display control, derived from Canvas, which displays image & overlays using DrawingVisuals (one for each "layer"). It also implements Zoom & Pan using scale & translate transform, applied on DrawingVisuals. When I zoom in the image to see individual pixels, they are displayed smooth, evidently using bilinear filtering to stretch the bitmap (no surprise, as WPF is rendered through Direct3D). However, for my use

Relation between dp - sp and PX

天涯浪子 提交于 2019-12-03 01:52:23
I am not asking what is the difference between dp,sp and px. I am designing a website based on google's new material design, all the measurements are in dp (for grid) and sp(for text). My question is how do they translate to pixels. I have been designing websites for more than 4 years and all the measurements (grid and font) are in pixels. For Example: A headline is 24sp, how many pixels does it equate to? (its not 24px, I've tried matching them, it's around 28px but there has to be a standard measuring systems). Grid Guideline: "All components align to an 8 dp square baseline grid." - how

Poor resolution in knitr using Rmd

可紊 提交于 2019-12-03 01:11:08
I have a .Rmd file and I am trying to create a .docx file via the function pandoc. I want to have a figure with final resolution of 504x504 pixels (i.e., 7x7inch with 72dpi). Unfortunately, the default 72 dpi is too poor in quality, and I would like to increase it to, say, 150 dpi without altering the final resolution (so it will already have the correct size within the .docx file). If I keep options fig.width and fig.height=7 and set dpi=150, I get the quality I want but the final resolution increases and the figure blows outside the .docx margins. I tried playing with the arguments out.width