argb

How to create a window with a bit depth of 32

落花浮王杯 提交于 2019-11-30 08:28:48
问题 I'm trying to create a X11 window with a bit depth of 32 so that I can use ARGB colors. Here's what I do: XVisualInfo vinfo; int depth = 32; XMatchVisualInfo(dpy, XDefaultScreen(dpy), depth, TrueColor, &vinfo); XCreateWindow(dpy, XDefaultRootWindow(dpy), 0, 0, 150, 100, 0, depth, InputOutput, vinfo.visual, 0, NULL); Here's what happens: X Error of failed request: BadMatch (invalid parameter attributes) Major opcode of failed request: 1 (X_CreateWindow) Serial number of failed request: 7

convert Integers to RGB values and back with Python

被刻印的时光 ゝ 提交于 2019-11-30 07:19:55
I have two functions, one to return RGB values from a given Integer, and the other function does the reverse, providing it with RGB values it returns an Integer. I'm testing this by seeing if the integer i convert to RGB turns back from RGB into the original integer value, but I'm getting different values. def getRGBfromI(RGBint): blue = RGBint & 255 green = (RGBint >> 8) & 255 red = (RGBint >> 16) & 255 return red, green, blue def getIfromRGB(rgb): red = rgb[0] green = rgb[1] blue = rgb[2] print red, green, blue RGBint = (red<<16) + (green<<8) + blue return RGBint the test: i1 = 2147483647

Format of TYPE_INT_RGB and TYPE_INT_ARGB

梦想的初衷 提交于 2019-11-30 06:26:25
问题 Could anyone explain for me how java stores color in TYPE_INT_RGB and TYPE_INT_ARGB ? Do these lines of code work properly for calculating red, green and blue ? int red= (RGB>>16)&255; int green= (RGB>>8)&255; int blue= (RGB)&255; And what about TYPE_INT_ARGB ? How can I get red, green and blue from TYPE_INT_ARGB? 回答1: The TYPE_INT_ARGB represents Color as an int (4 bytes) with alpha channel in bits 24-31, red channels in 16-23, green in 8-15 and blue in 0-7. The TYPE_INT_RGB represents Color

ARGB Hex color not working in css html

一曲冷凌霜 提交于 2019-11-30 00:31:56
问题 Why is this ARGB hex not working? <td style="background-color: #FFFF9980"> 回答1: Use rgba(255,153,128,1.0) instead of your hex value (though if that really is ARGB it's the same as #ff9980 in RGB - if you meant RGBA then you'll need rgba(255,255,153,0.5) ). 回答2: the CSS3 spec says: Unlike RGB values, there is no hexadecimal notation for an RGBA value. so you will have to use the rgba(255,153,128,1.0) mentioned above. 回答3: ARGB Hex color RGBA color values are an extension of RGB color values

What are differences between RGB vs RGBA other than 'opacity'

梦想的初衷 提交于 2019-11-29 17:36:58
问题 I have moved beyond using standard colors in CSS by declaring them orange , blue , aquamarine , etc..., and have been using rgb() like so for the same colors respectively, rgb(255,165,0) , rgb(0,0,255) and rgb(127,255,212) (thanks to the ColorHighlighter package in ST3). Upon altering a gradient for bootstrap .btn I came across rgba() . Quick research explains that a stands for alpha , and theres a whole bunch of integral math attributed to Catmull and Smith. It is also somewhat easy to find

Convert RGBA values to hex color code

醉酒当歌 提交于 2019-11-29 14:41:38
I have some sliders in my application that allows the user to change ARGB colors, however I need to convert these values to a hex value like 0xff000000, which is solid black. This is what I have so far: protected int toHex(Color col) { String as = pad(Integer.toHexString(col.getAlpha())); String rs = pad(Integer.toHexString(col.getRed())); String gs = pad(Integer.toHexString(col.getGreen())); String bs = pad(Integer.toHexString(col.getBlue())); String hex = "0x" + as + rs + gs + bs; return Integer.parseInt(hex, 16); } private static final String pad(String s) { return (s.length() == 1) ? "0" +

Failing to decode as same length as input

丶灬走出姿态 提交于 2019-11-29 13:09:22
This is a Link Embedding Messages in Digital Images using JAVA, they provide the sample code also, but when i tried to embed over 38 characters, it will give different output when i run the decode part. I am using 111x115 (6.38k) image. my question is in this article, it said n=(p-32)/8 , n is the maximum length of message and P is the number of pixels. so if i calculate the image i used, it will be n=(6380-32)/8=793.5. Since like i could store 793.5 characters in this image, but when i tried to put more than 38 characters, it will give me different output when i did decode part. (under 38

Trying to convert Bilinear Interpolation code from Java to C/C++ on Android

删除回忆录丶 提交于 2019-11-29 12:47:55
Background I've made a tiny Android library for handling bitmaps using JNI (link here ) In the long past, I've made some code of Bilinear Interpolation as a possible algorithm for scaling of images. The algorithm is a bit complex and uses pixels around to form the target pixel. The problem Even though there are no errors (no compilation errors and no runtime errors), the output image look like this (scaled the width by x2) : The code Basically the original Java code used SWT and supported only RGB, but it's the same for the Alpha channel. It worked before just perfectly (though now that I look

Fast Converting RGBA to ARGB

感情迁移 提交于 2019-11-29 12:25:56
I am trying to convert a rgba buffer into argb, is there any way to improve the next algorithm, or any other faster way to perform such operation? Taking into account that the alpha value is not important once in the argb buffer, and should always end up as 0xFF. int y, x, pixel; for (y = 0; y < height; y++) { for (x = 0; x < width; x++) { pixel = rgbaBuffer[y * width + x]; argbBuffer[(height - y - 1) * width + x] = (pixel & 0xff00ff00) | ((pixel << 16) & 0x00ff0000) | ((pixel >> 16) & 0xff); } } I will focus only in the swap function: typedef unsigned int Color32; inline Color32

convert Integers to RGB values and back with Python

浪子不回头ぞ 提交于 2019-11-29 08:30:41
问题 I have two functions, one to return RGB values from a given Integer, and the other function does the reverse, providing it with RGB values it returns an Integer. I'm testing this by seeing if the integer i convert to RGB turns back from RGB into the original integer value, but I'm getting different values. def getRGBfromI(RGBint): blue = RGBint & 255 green = (RGBint >> 8) & 255 red = (RGBint >> 16) & 255 return red, green, blue def getIfromRGB(rgb): red = rgb[0] green = rgb[1] blue = rgb[2]