pixel

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

ε祈祈猫儿з 提交于 2019-11-29 18:51:01
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... but i will try to do functional in LESS with calc() You can escape the calc arguments in order to prevent

How does alpha blending work, mathematically, pixel-by-pixel?

回眸只為那壹抹淺笑 提交于 2019-11-29 16:54:59
Seems like it's not as simple as RGB1*A1 + RGB2*A2...how are values clipped? Weighted? Etc. And is this a context-dependent question? Are there different algorithms, that produce different results? Or one standard implementation? I'm particularly interested in OpenGL-specific answers, but context from other environments is useful too. I don't know about OpenGL, but one pixel of opacity A is usually drawn on another pixel like so: result.r = background.r * (1 - A) + foreground.r * A result.g = background.g * (1 - A) + foreground.g * A result.b = background.b * (1 - A) + foreground.b * A Repeat

Cocoa Point vs Pixel and PPI

主宰稳场 提交于 2019-11-29 16:44:16
Well, I have basically two questions regarding screen resolution in iOS devices. 1) In iOS documentation, on the Point vs Pixels section, it states the coordinates are passed in to framework as points, and that "One point does not necessarily correspond to one pixel on the screen." as found here: https://developer.apple.com/library/ios/#documentation/WindowsViews/Conceptual/ViewPG_iPhoneOS/WindowsandViews/WindowsandViews.html When they are different? Up until now I was assuming they were equal and passing in pixel coordinates. Is this a parameter that changes from device to device? 2) I'm also

Rendering pixels from array of RGB values in SDL 1.2?

最后都变了- 提交于 2019-11-29 15:12:27
I'm working on a NES emulator right now and I'm having trouble figuring out how to render the pixels. I am using a 3 dimensional array to hold the RGB value of each pixel. The array definition looks like this for the 256 x 224 screen size: byte screenData[224][256][3]; For example, [0][0][0] holds the blue value, [0][0][1] holds the green values and [0][0][2] holds the red value of the pixel at screen position [0][0] . When the vblank flag goes high, I need to render the screen. When SDL goes to render the screen, the screenData array will be full of the RGB values for each pixel. I was able

001: Opencv 4.0代码执行

爷,独闯天下 提交于 2019-11-29 14:17:21
1. int main(int argc,char* argv[])详解 argc记录了用户在运行程序的命令行中输入的参数的个数。 arg[]指向的数组中至少有一个字符指针,即arg[0].他通常指向程序中的可执行文件的文件名。在有些版本的编译器中还包括程序 文件所在的路径。 #include <iostream> #include <string> #include <sstream> using namespace std; // OpenCV includes #include "opencv2/core.hpp" #include "opencv2/highgui.hpp" using namespace cv; int main( int argc, const char** argv ) { //argv[1]第一个参数是图像名 Mat color = imread(argv[1]); Mat gray = imread(argv[1], IMREAD_GRAYSCALE); ///以灰度图的形式读取图像 ///判断图像是否为空 if(! color.data ) // Check for invalid input { cout << "Could not open or find the image" << std::endl ; return -1; } //

C# Getting the pixel data efficiently from System.Drawing.Bitmap

天涯浪子 提交于 2019-11-29 12:21:00
问题 I have several (~2GB) raw 24bpp RGB files on HDD. Now I want to retrieve a portion of it and scale it to the desired size. (The only scales allowed are 1, 1/2, 1/4, 1/8, ..., 1/256) So I'm currently reading every line from the rectangle of interest into an array, which leaves me with a bitmap which has correct height but wrong width. As the next step I'm creating a Bitmap from the newly created array. This is done with by using a pointer so there is no copying of data involved. Next I'm

How does Robot's getPixelColor(int x, int y) method work?

狂风中的少年 提交于 2019-11-29 11:52:02
How exactly does the method getPixelColor(int x,int y) from the Robot class work? I tried this code fragment: try { Robot robos = new Robot(); } catch (AWTException e) { } for (int i = 0; i < 100; i++) robos.getPixelColor(0, 0); System.out.println("fsadf"); on my PC, which is a core 2 duo, and it took one second or less to execute the print statement. However, when I ran this same code on my laptop, which is a core i3, it took much more time (about 2-3 seconds). What is the reason behind this? Does it have to do with the screen quality or something like that? How can I solve this problem? how

Vb.Net Check If Image Existing In Another Image

纵然是瞬间 提交于 2019-11-29 11:11:32
I Tried To Check If Part Of Image Existing In Another Image Explanation: full image: http://imageshack.us/photo/my-images/526/part1g.png/ second part of image that i want to check if he existing in the full image : http://imageshack.us/photo/my-images/706/part2p.png/ if the second part is Exist then the function return true there is a function that can check if it exist? (if it was only Single pixel then it was verey easy, but i want to check if Part Of Image Existing In Another Image) there is a code that works , but it check if Single pixel exist in image : Dim bmp As Bitmap = PictureBox1

DX下实现图片的遮罩(Mask)

狂风中的少年 提交于 2019-11-29 10:44:22
虽然传统的用含遮罩信息的24bit图片来保存一个32bit的图像已经很少见了(以前的游戏比较常见),基本上随着png的流行,已经让32bit格式的图像普及网络以及游戏界了,当然更多的游戏采用dx原生支持的dds,或者可以自定义形状的更加灵活的tga格式等.不过这里还是介绍下在DX下Mask的实现,因为我的项目里涉及到可能要使用旧的游戏资源. 储存mask信息的图片: D3DLOCKED_RECT locked_rect; temp->tex->tex->LockRect(0, &locked_rect, NULL, 0); BYTE *pByte = (BYTE *) locked_rect.pBits; BYTE *pmaskByte = (BYTE *) locked_rect.pBits + width*4; int iOffset = locked_rect.Pitch/2; //偏移字节数 int i=0; for( int iRow=0; iRow<height; iRow++ ) { for( int iCol=0; iCol<width; iCol++ ) { masked_pixel_buf[i] = pByte[0]; masked_pixel_buf[i+1] = pByte[1]; masked_pixel_buf[i+2] = pByte[2];

WPF how to show an Image.Source (BitmapSource) pixel position?

99封情书 提交于 2019-11-29 10:30:42
问题 Let's suppose I've got an image which shows its source in a scaled way, how could i use a MouseMove event to show in a label or textblock the pixel position in which the cursor is? (I need the pixel coordinates not the coordinates of the image relative to its size) Thanks in advance. 回答1: You can find out the actual pixel height and width from the ImageSource. ImageSource imageSource = image.Source; BitmapImage bitmapImage = (BitmapImage) imageSource ; Now since you got the image displayed in