pixel

Fast pixel drawing library

旧街凉风 提交于 2019-12-21 21:22:36
问题 My application produces an "animation" in a per-pixel manner, so i need to efficiently draw them. I've tried different strategies/libraries with unsatisfactory results especially at higher resolutions. Here's what I've tried: SDL : ok, but slow; OpenGL : inefficient pixel operations; xlib : better, but still too slow; svgalib , directfb , (other frame buffer implementations): they seem perfect but definitely too tricky to setup for the end user. (NOTE: I'm maybe wrong about these assertions,

Get PixelValue when click on a picturebox

爷,独闯天下 提交于 2019-12-21 18:33:39
问题 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! 回答1: Use this: private void pictureBox2_MouseUp(object sender, MouseEventArgs e) { Bitmap b = new Bitmap(pictureBox1.Image); Color color = b.GetPixel(e.X, e.Y); } 回答2: As @Hans pointed out Bitmap.GetPixel should work unless you have different SizeMode than

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

那年仲夏 提交于 2019-12-21 12:23:46
问题 This question already has answers here : Changing pixel color value in PIL (4 answers) Closed 11 months ago . 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

'imagecolorat' and transparency

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-21 12:11:19
问题 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. 回答1: 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

Converting Pixel values to mm - Android

自闭症网瘾萝莉.ら 提交于 2019-12-21 05:36:13
问题 Because of specific needs, in my android layout, I have used "mm" to provide size. In TextView also, I have provided sizes in "mm". When I do textView.getTextSize() , the size returned is always in pixel values. I want to convert that pixel value in "mm". For example, if I have set font size as "2mm", then on any device, when I do getTextSize() , I would like to get "2mm". Should I use any specific method for that? I could find answers to convert "mm" to "pixel" but could not find anything

WPF Canvas - Single Pixel Grid

巧了我就是萌 提交于 2019-12-21 04:52:13
问题 I have a custom WPF Canvas, upon which I would like to show a grid. I do so by overriding the OnRender method on Canvas, and using the DrawingContext drawing functions. IsGridVisible, GridWidth, GridHeight are the number of pixels between each grid line horizontally and vertically respectively. I also use a ScaleTransform on the Canvas.LayoutTransform property to zoom the Canvas items and as one expects, the grid line thicknesses are multiplied by the ScaleTransform scaling factors as shown

Drawing aliased, pixel-perfect 1px splines (Catmull-Rom, specifically)

徘徊边缘 提交于 2019-12-21 04:36:06
问题 A brief background: I'm working on a web-based drawing application and need to draw 1px thick splines that pass through their control points. The issue I'm struggling with is that I need to draw each of the pixels between p1 and p2 as if I were using a 1px pencil tool. So, no anti-aliasing and one pixel at a time. This needs to be done manually without the use of any line/curve library code as my brush system depends upon having a pixel coordinate to apply the brush tip to the canvas.

Draw image from pixel array on canvas with putImageData

爷,独闯天下 提交于 2019-12-21 04:07:02
问题 I am working on a project that can encrypt an image and redraw the decrypted image on canvas. As I am still pretty new to coding and programming, I am currently having issues redrawing the decrypted image data, which is a pixel array in the form R,G,B,A. I thought this would be possible by simply putting the data into ctx.putImageData(imgd,0,0); But firebug tells me that the value does not implement the interface for imagedata. I have posted the entire array here. The image is 160px wide and

android fast pixel access and manipulation

你说的曾经没有我的故事 提交于 2019-12-20 12:43:12
问题 I'm trying to port an emulator that i have written in java to android. Things have been going nicely, I was able to port most of my codes with minor changes however due to how emulation works, I need to render image at pixel level. As for desktop java I use int[] pixelsA = ((DataBufferInt) src.getRaster().getDataBuffer()).getData(); which allow me to get the reference to the pixel buffer and update it on the fly(minimize object creations) Currently this is what my emulator for android does

What's the best way to “round” a Color object to the nearest Color Constant?

冷暖自知 提交于 2019-12-20 10:49:30
问题 I will be retrieving the exact color of a pixel and would like to relate that exact color to a constant like Color.blue . Is there an easy way to "round" to the nearest Color Constant? Additionally, is there a way to define your own Color Constants? 回答1: The basic approach is to find the closest standard color to your sample by simply comparing the sample to each of them. The problem, of course, is in defining "closest." The most obvious would be use the Euclidean distance in RGB space. The