pixel

Calculating width from percent to pixel then minus by pixel in LESS CSS

北慕城南 提交于 2019-11-28 13:52:54
问题 I will calculate width in some element from percent to pixel so I will minus -10px via using LESS and calc() . It´s possible? div { span { width:calc(100% - 10px); } } I using CSS3 calc() so it doesn't work: calc(100% - 10px) Example: if 100% = 500px so width = 490px (500-10); I made a demo for testing : http://jsfiddle.net/4DujZ/55/ so padding will say: 5 (10px / 2) all the time when I resizing. Can I do it in LESS ? I know how to do in jQuery and simple CSS like margin padding or else...

Is it possible to change the color of one individual pixel in Python?

江枫思渺然 提交于 2019-11-28 13:16:48
I need python to change the color of one individual pixel on a picture, how do I go about that? ssokolow To build upon the example given in Gabi Purcaru's link , here's something cobbled together from the PIL docs . The simplest way to reliably modify a single pixel using PIL would be: x, y = 10, 25 shade = 20 from PIL import Image im = Image.open("foo.png") pix = im.load() if im.mode == '1': value = int(shade >= 127) # Black-and-white (1-bit) elif im.mode == 'L': value = shade # Grayscale (Luminosity) elif im.mode == 'RGB': value = (shade, shade, shade) elif im.mode == 'RGBA': value = (shade,

Get pixel colors of tkinter canvas

不羁的心 提交于 2019-11-28 12:48:30
I'd like to be able to create and interact with a Tkinter Canvas and, at any time, be able to iterate over each of its pixels and get their RGB values. Setting pixel by pixel is not necessary, just getting. However, methods analogous to Canvas's create_polygon(), create_line(), create_text(), and create_oval() must be available as well for interacting with the image overall. There are a number of restraints: Must work with Python 3 Must work with Linux, Mac, and Windows Must work with libraries that come with Python (no downloads) The second restraint is mainly the reason I've posted this

Pixel-perfect shader in Unity ShaderLab

喜欢而已 提交于 2019-11-28 12:03:13
In Unity, when writing shaders, is it possible for the shader itself to "know" what the screen resolution is, and indeed for the shader to control single physical pixels? I'm thinking only of the case of writing shaders for "2D" objects (such as for UI use, or at any event with an ortho camera). (Of course, normally to show a physical-pixel perfect PNG on screen, you merely have a say 400 pixel PNG, and you arrange scaling so that the shader, happens to be drawing to, precisely 400 physical pixels. What I'm wondering about is a shader that just draws, for example a physical-pixel perfect black

Swing and bitmaps on retina displays

喜你入骨 提交于 2019-11-28 10:19:43
I've got a Java desktop app that works, amongst other, on OS X. Now the new MacBook Pro has a retina display and I'm concerned: how is it going to work regarding Swing? What about when a Java app uses both Swing components and some bitmap graphics (like custom icons / ImageIcon)? Shall all desktop Java apps be automatically resized (for example by quadrupling every pixel) or am I going to need to create two versions of my icons set (for example one with 24x24 icons and the other with 96x96 icons) and somehow determine that the app is running on a retina display? Use IconLoader library. It

Getting the pixel value of BMP file

一世执手 提交于 2019-11-28 10:18:31
i got a question for reading an bmp image. How can i get the pixel value(R, G, B values) in an bmp image? Can anyone help me using the C programming language? The easy way would be to find a good image manipulation library for your chosen platform and use that. Linux ImLib / GDK-Pixbuf (Gnome/GTK) / QT Image (KDE/Qt) should be able to do what you need. Windows I'm not familiar with the appropriate system library, but an MSDN Search for "Bitmap" is probably a good place to start. Mac OSX Cocoa has some image manipulation capabilities, see this article . The hard way would be to open the file

Rotating a 2D pixel array by 90 degrees

喜夏-厌秋 提交于 2019-11-28 08:37:55
I have an array of pixel data for an image. The image I am getting is already rotated to 270 degrees. So I am trying to rotate it again by 90 degrees to have the correct image. I've tried a transpose algorithm, by changing data[x][y] to data[y][x] , but I don't think that's the correct way. Can anyone guide me what can I do to have it rotated? This can be done without using any extra space, so called In-place matrix transposition (not exact the same). Remember to do some mirroring after the transposition. If the image is square If the image is not square For non-square matrices, the algorithms

How to color a pixel?

孤者浪人 提交于 2019-11-28 08:29:02
I have to create a simple 2D animation without using various primitives for drawing line, circle etc for the purpose. It has to be done by manipulating pixels and implementing one of the algorithms for drawing line, circle etc by coloring pixels. I thought of using Turbo C for the purpose, but I use ubuntu. So I tried using dosbox to install and run turbo C but to no avail. Now my only option is Java. Is it possible to manipulate pixels in Java? I couldn't find myself any good tutorials for the same. It would be great if a sample code for the same can be given. The class java.awt.BufferedImage

iPhone OpenGL ES 2.0 - Pixel Perfect Textures

爷,独闯天下 提交于 2019-11-28 06:39:05
How can I get my textures to align with the screen pixels for pixel perfect graphics in OpenGL ES 2.0? This is critical for a project I'm working on which uses pixel art graphics. Any help on this would be great! datenwolf See my answer here: OpenGL Texture Coordinates in Pixel Space This has been asked a few times, but I don't have the links at hand, so a quick and rough explanation. Let's say the texture is 8 pixels wide: | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | ^ ^ ^ ^ ^ ^ ^ ^ ^ 0.0 | | | | | | | 1.0 | | | | | | | | | 0/8 1/8 2/8 3/8 4/8 5/8 6/8 7/8 8/8 The digits denote the texture's pixels, the

Get the color a pixel on the screen in objective-c cocoa app

泪湿孤枕 提交于 2019-11-28 06:07:08
I am trying to create a color picker cocoa app in objective-c so I can get the color of any pixel on my screen. Is there a way to get the color a certain screen pixel in objective-c? You can use CGDisplayCreateImageForRect to get a CGImageRef that encompasses the point you're interested in. Once you have a CGImage, you can get a color value out of it by rendering the image into custom buffer, or by using NSBitmapImageRep's initWithCGImage and then colorAtX:y:. The "written in stack overflow code window" code for the NSBitmapImageRep method would look something like: NSColor