pixel

What is the current state of sub-pixel accuracy in the major browsers?

空扰寡人 提交于 2019-11-27 14:21:48
问题 I'm working on a drawing application which requires high levels of accuracy, and I'm wondering which of the major browser platforms (including the HTML Canvas element, and Flash) give the best sub-pixel layout accuracy, both for drawn elements (rectangles in the Canvas or Flash, absolutely positioned DIVs in the browser), and for text. There are a number of posts related to this, both on this site and others, (see list at bottom), but many are quite old, and none summarises the current

Getting pixel color in C++

╄→гoц情女王★ 提交于 2019-11-27 14:09:07
问题 I would like to get the RGB values of a pixel at different x, y coordinates on the screen. How would I go about this in C++? I'm trying to create my own gaussian blur effect. This would be in Windows 7. Edit What libraries need to be included for this to run? What I have going: #include <iostream> using namespace std ; int main(){ HDC dc = GetDC(NULL); COLORREF color = GetPixel(dc, 0, 0); ReleaseDC(NULL, dc); cout << color; } 回答1: As mentioned in a previous post, you want the GetPixel

python tkinter: how to work with pixels?

风流意气都作罢 提交于 2019-11-27 13:56:51
问题 using google (and this site) i have seen some similar questions but my problem is still here: "i want to draw an image (without reading a file) , being able to manipulate every single pixel's colour in that image." i have seen another question where was suggested to do something like this: from tkinter import * A=Tk() B=Canvas(A) B.place(x=0,y=0,height=256,width=256) for a in range(256): for b in range(256): B.create_line(a,b,a+1,b+1,fill=pyList[a][b])#where pyList is a matrix of hexadecimal

Position of Div in relation to the Top of the Viewport

眉间皱痕 提交于 2019-11-27 12:43:59
问题 I am wondering how I can get the number of pixels (or measurement in general) from a div to the top of the window in Javascript. I am not looking for an offset y in relation to the document, simply to the top of where the browser is displaying. I tried the "answered" solution here: Is it possible to get the position of div within the browser viewport? Not within the document. Within the window, but at least in Safari, I am running into a problem where it returns the same number no matter

c++ and opencv get and set pixel color to Mat

自作多情 提交于 2019-11-27 11:06:46
问题 I'm trying to set a new color value to some pixel into a cv::Mat image my code is below: Mat image = img; for(int y=0;y<img.rows;y++) { for(int x=0;x<img.cols;x++) { Vec3b color = image.at<Vec3b>(Point(x,y)); if(color[0] > 150 && color[1] > 150 && color[2] > 150) { color[0] = 0; color[1] = 0; color[2] = 0; cout << "Pixel >200 :" << x << "," << y << endl; } else { color.val[0] = 255; color.val[1] = 255; color.val[2] = 255; } } imwrite("../images/imgopti"+to_string(i)+".tiff",image); It seems

Pixel density, retina display and font-size in CSS

牧云@^-^@ 提交于 2019-11-27 10:56:32
问题 I don't have a Retina MacBook myself to test these things out, and there seems to be a lot of confusion on the internet about web design on high pixel density displays. Now, I assume that WebKit on a MacBook with Retina display scales the page about twice it's size as most web pages are not built to adapt to the higher pixel density? In my view the ideal case when designing for these, or actually any type of display is to use ems instead of pixels as you could just do; @media only screen and

Axis coordinates to pixel coordinates? (Matlab)

青春壹個敷衍的年華 提交于 2019-11-27 09:21:07
How can i convert the axis coordinates into pixel coordinates? I have a set of data which include the negative and floating values, i need to put all of the data into the image. But the pixel coordinates are all positive integer. how to solve the negative issue? You can pass vectors of coordinates to scatter . x = [-1.2 -2.4 0.3 7]; y = [2 -1 1 -3]; scatter(x,y,'.'); If you need the image matrix, h = figure(); scatter(x,y); F = getframe(h); img = F.cdata; You can also use print to save the plot to a file (or simply export from figure window), then use imread to read the file. There is also

How a CSS pixel size is calculated?

孤街浪徒 提交于 2019-11-27 09:09:32
问题 While delving into CSS units I've encountered a definition of the reference pixel. However, I wasn't able to find a consistent and comprehensive description of its relation to the CSS pixel unit. I've done some research on this matter, yet it's still a little bit unclear to me. 1. Gathered information 1.1 A pixel definition There are two distinct types/definitions of a pixel: "Device pixel" — a single physical point on a display. And: CSS pixel — a unit most closely matching the reference

Get color of each pixel of an image using BufferedImages

人走茶凉 提交于 2019-11-27 08:41:18
I am trying to get every single color of every single pixel of an image. My idea was following: int[] pixels; BufferedImage image; image = ImageIO.read(this.getClass.getResources("image.png"); int[] pixels = ((DataBufferInt)image.getRaster().getDataBuffer()).getData(); Is that right? I can't even check what the "pixels" array contains, because i get following error: java.awt.image.DataBufferByte cannot be cast to java.awt.image.DataBufferInt I just would like to receive the color of every pixel in an array, how do i achieve that? import java.io.*; import java.awt.*; import javax.imageio

react 移动端 1像素线的使用

谁都会走 提交于 2019-11-27 07:33:54
   //1像素线文件 @mixin border($color,$width) { & { position: relative; &:before { content: ""; position: absolute; top: 0; left: 0; border-style: solid; border-color: $color; border-width: $width; transform-origin: 0 0; // padding: 1px; box-sizing: border-box; pointer-events: none; } &:last-child:before { // border-top:none; } } @media (-webkit-min-device-pixel-ratio:1),(min-device-pixel-ratio:1) { &:before { width: 100%; height: 100%; transform: scale(1); } } @media (-webkit-min-device-pixel-ratio:2),(min-device-pixel-ratio:2) { &:before { width: 200%; height: 200%; transform: scale(0.5); } }