graphics

Drawing Colors in a picturebox?

心不动则不痛 提交于 2019-12-31 04:15:11
问题 In C# i have a picturebox. i would like to draw 4 colors. The default will be white, red, green, blue. How do i draw these 4 colors stritched in this picbox? or should i have 4 picbox? in that case how do i set the rgb color? 回答1: You need to specify what it is you would specifically like to draw. You can't draw a red - that makes no sense. You can, however, draw a red rectangle at location (0,0) which is 100 pixels tall and 100 wide. I will answer what I can, however. If you want to set the

Are there any arbitrary restrictions on maximum image pixel size in IE and Webkit mobile?

☆樱花仙子☆ 提交于 2019-12-31 03:38:06
问题 A recent project made use of very pixel-large (~5e3px2) but still byte-small (~100kb — GIF) images, which both IE8 and iOS Safari refused to render. Both seem aware of the image size, but simply do not render them. A practical solution is to slice the image, but are there any documented arbitrary restrictions on maximum image pixel size for these browsers? 回答1: Mobile Safari has a 3-megabit buffer for non JPG images. Anything larger than that will not display. Calculate size = w * h * 8 for

How to combine two opaque bitmaps into one with alpha channel?

喜欢而已 提交于 2019-12-31 02:46:25
问题 I have a PNG file with transparency that I'm using as OpenGL texture. I load it in Bitmap with BitmapFactory.decodeResource , then upload it to GPU. The PNG file is quite big and in order to cut down on APK size, I'm trying to use two JPGs instead--one with RGB data, and the other with alpha channel (grayscale). How do I combine the two JPGs together in one Bitmap object with alpha channel? I tried loading alpha channel as Bitmap.Config.ALPHA_8 , then drawing them on top of each other using

How to generate events from graphics generated by Java2D

落爺英雄遲暮 提交于 2019-12-31 02:22:27
问题 I have made an Ellipse with the help of java.awt.geom.Ellipse2D Now, I want that whenever user clicks on that ellipse, an event is generated so that I can listen to that event and peform subsequent tasks based on the ellipse which generated that event. 回答1: Here is a simple example of an object drawing program that demonstrates click, drag and multiple selection. Also consider JGraph, which is a much more advanced library for graph visualization. 回答2: I'm going to assume this is a question

Image not at proper place after rotating (graphics)

妖精的绣舞 提交于 2019-12-31 02:18:09
问题 I am trying to display two rotating wheels with diameter 512untis at different rates but i am not able to remove the previous drawn image graphics and set the rotated graphics at the correct position. For now i am doing a rotation with arbitrary angle. I tried affineTransform and got the rotations but it was weird like all pixels spread away. Im using a while loop with thread.sleep(). The following is the code : //The drawSmallCircle and drawBigCircle return two images. class MyFramePart2

Regarding arrays in layout std140 uniform block for OpenGL

旧巷老猫 提交于 2019-12-31 00:44:08
问题 According to specification: If the member is an array of scalars or vectors, the base alignment + * and array stride are set to match the base alignment of a single + * array element, according to rules (1), (2), and (3), and rounded up + * to the base alignment of a vec4. The array may have padding at the + * end; the base offset of the member following the array is rounded up + * to the next multiple of the base alignment. Does this mean that if I had an array of size 3 of a (float)vec3,

GDI+ .NET: LinearGradientBrush wider than 202 pixels causes color wrap-around

别来无恙 提交于 2019-12-30 18:49:10
问题 If i paint a rectangle that is wider than 202 pixels wide with a LinearGradientBrush , i get a color fringe on the left: Given the code for a 202px wide rectangle: private void MainForm_Paint(object sender, PaintEventArgs e) { Rectangle r = new Rectangle(50, 50, 202, 50); Color color1 = Color.FromArgb(unchecked((int)0xFF00024d)); Color color2 = Color.FromArgb(unchecked((int)0xFFd6a20f)); Brush b = new LinearGradientBrush(r, color1, color2, LinearGradientMode.Horizontal); e.Graphics

How to copy Graphics Image of one Swing Component to another in Java

二次信任 提交于 2019-12-30 13:56:09
问题 I just started my Java programming 3 months before and here with my issue that is- How to copy a JLabel or JPanel Graphics to another JLabel or JPanel . I have used - <!--Source JLabel srcLabel--> JLabel dest = new JLabel(); dest.paint(srcLabel.getGraphics()); panel.add(dest); dest.validate(); but due to lack of knowledge I stucked here. Please help. 回答1: Start by having a look at Painting in AWT and Swing and Performing Custom Painting for more information about how painting works. Never use

How to copy Graphics Image of one Swing Component to another in Java

与世无争的帅哥 提交于 2019-12-30 13:55:13
问题 I just started my Java programming 3 months before and here with my issue that is- How to copy a JLabel or JPanel Graphics to another JLabel or JPanel . I have used - <!--Source JLabel srcLabel--> JLabel dest = new JLabel(); dest.paint(srcLabel.getGraphics()); panel.add(dest); dest.validate(); but due to lack of knowledge I stucked here. Please help. 回答1: Start by having a look at Painting in AWT and Swing and Performing Custom Painting for more information about how painting works. Never use

How can I force any display resolution/timing I want?

喜夏-厌秋 提交于 2019-12-30 13:27:17
问题 I am having trouble finding a way to force any display resolution/timing I want in my C# program. I am running Windows 7 with a GeForce 210 graphics card. My current method to achieve these custom resolutions is to use the driver GUI to manually add the custom resolutions and then use Windows calls to change to those resolutions but I need a way to add new custom resolutions in real time. I have looked into the NVAPI but I was not able to find a way to do this. I also looked into the command