pixel

Get PixelValue when click on a picturebox

浪子不回头ぞ 提交于 2019-12-04 09:51:45
I'm working on a .NET C# project and would like to get the pixel value when I click a picturebox, how can I achieve that? The basic idea is that when I click anywhere in the picturebox, I get the pixelvalue of that image point.. Thanks! Use this: private void pictureBox2_MouseUp(object sender, MouseEventArgs e) { Bitmap b = new Bitmap(pictureBox1.Image); Color color = b.GetPixel(e.X, e.Y); } As @Hans pointed out Bitmap.GetPixel should work unless you have different SizeMode than PictureBoxSizeMode.Normal or PictureBoxSizeMode.AutoSize . To make it work all the time let's access private

how to handle SVG pixel snapping

安稳与你 提交于 2019-12-04 08:35:24
I am trying to render two svg lines using path element. The first line has 1px width and it is sharp The second line has 2px width and it is blurred The stroke-width is the same for both. How to fix this <svg xmlns="http://www.w3.org/2000/svg" version="1.1"> <path style="stroke-width:1;stroke:red;opacity:1;" d="M 300.5 250 L 300.5 300 "></path> <path style=" stroke-width:1;stroke:red;opacity:1;" d="M 350 250 L 350 300 "></path> </svg> Mainly it's the 0.5 offset that makes the line sharp. By default, integer coordinates map to the intersections of the pixel squares. So a width-1 horizontal

How to display pixels on screen directly from a raw array of RGB values faster than SetPixel()?

混江龙づ霸主 提交于 2019-12-04 08:31:33
问题 I enjoy making "animations" in c++ such as a MandelBrot Set zoomer, Game of Life simulator etc. by setting pixels directly to the screen frame-by-frame. The SetPixel() command makes this incredibly easy, although unfortunately it's also painfully slow. Here is the sort of set-up I use for each frame, if I wanted to paint the entire screen with the contents of the array R: #include <windows.h> using namespace std; int main() { int xres = 1366; int yres = 768; char *R = new char [xres*yres*3];

What is the fastest way to draw pixels in Java

*爱你&永不变心* 提交于 2019-12-04 08:12:36
问题 I have some code that generates particles at random locations, and moving in random directions and speed. Each iteration through a loop, I move all the particles, and call repaint on my jpanel. For 1,000 particles, I'm getting around 20 to 30 frames per second. I plan to eventually have 100,000 to 1,000,000 particles. In paint, I only create a new bufferedimage if the window has changed size. I draw the pixels to the bufferedimage, and then call drawImage to display the image. Each particle

Create a swing gui to manipulate png pixel by pixel [closed]

岁酱吖の 提交于 2019-12-04 07:26:51
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 3 years ago . As i've declared in title of my question, I'm about to make a sort of editor of particular areas of a given png image to change colours pixel by pixel by clicking on it, maybe helping myself magnifying the area... I'm mainly stuck because I don't know, ad I didn't find so far a

Is modifying the dp size as opposed to pixels recommended for various screen sizes?

こ雲淡風輕ζ 提交于 2019-12-04 06:35:54
问题 Say, for an ImageButton on screen A (240X320: ldpi) and screen B (720X1280: xhdpi), is it recommended to manually change the dp (layout-width and height) size of it in each unique layout resource file for various screens? Or, create scaled nine-patch bitmaps for each dpi size of the image, call it on the drawable resource file, and then set it as the src for the ImageButton? To justify, here's what I mean: https://www.youtube.com/watch?v=OtsZbdbC370 ... Most likely, the video is outdated,

How to get the X Y coordinates and pixel size of a TextView?

别等时光非礼了梦想. 提交于 2019-12-04 05:39:19
Given a TextView , is it possible to know at runtime the X and Y coordinates of where it is drawn? Is it also possible to know the size (width/length) in pixels? There are getLeft() , getTop() , getWidth() , getHeight() methods for a view, it works for textView too. for more information , see the following link... getLeft() and getTop() will return you the starting x,y co-ordinates. http://developer.android.com/reference/android/view/View.html Coordinates relative to parent int x = textView.getLeft(); int y = textView.getTop(); Absolute coordinates int[] location = new int[2]; textView

Poor results with source-over alpha blending (HTML5 canvas)

两盒软妹~` 提交于 2019-12-04 05:26:57
Edit: I don't necessarily need a solution to this problem--rather I'd like to understand why it's occurring. I don't see why I should be getting the odd results below... Although this question is directed towards an issue I'm having with an HTML5 canvas application, I think the problem is less specific. I have an HTML5 canvas app that allows you to stamp images on the screen. These images are 32bit PNG's, so I'm working with transparency. If I stamp a highly transparent image in the same location many times (roughly 100), I end up with an absolutely terrible result: The color of the image that

How to change the pixel values of an Image? [duplicate]

一笑奈何 提交于 2019-12-04 05:03:25
This question already has an answer here: Changing pixel color value in PIL 4 answers I am working on an Image Processing Project and I am a beginner at Python and using PIL. Any help would be appreciated. So, what I am doing is, I have an image of space with stars and noise. What I want to do is keep only the brighter pixels and filter out the dull ones. For now, this is my basic step at trying to remove the noise. After studying the image data, I found that values of 205 are quite possibly the ones I want to keep the threshold at. So what I am doing in the code is, open the image and change

'imagecolorat' and transparency

扶醉桌前 提交于 2019-12-04 04:59:51
How it's possible to get the transparency value of a pixel on an image ? 'imagecolorat' picks only the index of the color of the pixel at the specified location in the image. With that index I can get the RGB values but not the transparent one. Hope you understand, and thank you in advance. As far as I know, the transparency value is returned by the function imagecolorat . Could you try: $color = imagecolorat($image, $x, $y); $transparency = ($color >> 24) & 0x7F; The transparency is a integer between 0 and 127 so we need to mask the first 8 bits of the 32bit color integer. the solution could