drawimage

How to pass object's property name to drawImage?

心已入冬 提交于 2019-12-11 04:13:51
问题 I need to pass property names of this object called source Object { one: "img/20160602_112823_001.jpg", two: "img/UHEGP 17.1.jpg", three: "img/UHEGP 17.3.jpg", badge: "img/badge-gold-big-no-shadow-tilted.png", top_layer: "img/watermark_bronze_GOLD_Final-70-opacity.png" } to drawImage function. function loadImages(source, callback) { var images = {}; var loadedImages = 0; var numImages = 0; // get num of sources for (var src in source) { numImages++; } for (var src in source) { images[src] =

Blank screen using DrawImage method

放肆的年华 提交于 2019-12-11 01:35:10
问题 I have to draw a bitmap image using DrawingContext.DrawImage method. Using the code below everything is working correctly: BitmapImage myImage = new BitmapImage(); myImage.BeginInit(); myImage.UriSource = new Uri("image.png", UriKind.Relative); myImage.EndInit(); Rect area = new Rect(new Size(myImage.PixelWidth, myImage.PixelHeight)); DrawingVisual myVisual = new DrawingVisual(); using (DrawingContext context = myVisual.RenderOpen()) { context.DrawImage(myImage, area); } But only if the image

canvas not drawing images

久未见 提交于 2019-12-10 17:11:28
问题 I'm just trying to figure out how to get an image to draw on a canvas. I followed a tutorial on W3 schools, but when i tried it on my own it doesn't seem to be working. I copy and paste the code below into an HTML file, and the image never loads into the canvas. I downloaded the picture into the same directory. I've been asking around, and looked online, but no one seems to know what the problem is. I'm using an updated version of chrome (Version 29.0.1547.76 m). <!DOCTYPE html> <html> <body>

drawImage is not drawing

做~自己de王妃 提交于 2019-12-10 12:14:37
问题 so this is basically how my code is working class Main extends JFrame implements Runnable { public Main() { //init everything } public void start() { running = true; Thread thread = new Thread(this); thread.start(); } public void run() { while(running) { render(); } } public void render() { Image dbImage = createImage(width, height); Graphics dbg = dbImage.getGraphics(); draw(dbg); Graphics g = getGraphics(); g.drawImage(dbImage, 0, 0, this); g.dispose(); } public void draw(Graphics g) { for

How do I add a mouse over tooltip to an Image using .DrawImage()

血红的双手。 提交于 2019-12-10 11:36:19
问题 Hey all, I am not sure if this is possible, but I am trying to dynamically add a tooltip to an image using the Graphics method - DrawImage. I dont see any properties or events for when the image is moused over or anything so I don't know where to begin. I am using WinForms (in C# - .NET 3.5). Any ideas or suggestions would be appreciated. Thanks. 回答1: I would guess that you have some sort of UserControl and you call DrawImage() in the OnPaint method. Given that, your tooltip will have to

Using drawImage with Canvas is very slow on Chrome

♀尐吖头ヾ 提交于 2019-12-09 10:18:47
问题 I've been trying to draw a large number of instances of an SVG file to a canvas using drawImage. By creating a single image element using the SVG as the source, then using drawImage for each instance on the canvas, I was hoping I could produce a composite image in the canvas very quickly even with a large number of instances. Performance-wise, this works well in Firefox - I can draw 60,000 instances in about 300ms. But on Chrome it is terribly slow: 16,000 instances is taking over 5 seconds.

CGContextDrawImage crashes

删除回忆录丶 提交于 2019-12-09 02:20:11
问题 The code is below: - (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx { CGContextRef context = ctx; CGContextRetain(context); CGContextSetInterpolationQuality(context, kCGInterpolationNone); CGContextSetLineCap(context, kCGLineCapButt); CGContextSetLineWidth(context, 1); CGContextSetRGBStrokeColor(context, 0, 0, 0, 0.8); // draw image CGContextSaveGState(context); CGAffineTransform flipVertical = CGAffineTransformMake( 1, 0, 0, -1, 0, layer.bounds.size.height ); CGContextConcatCTM

Trying to use Canvas and DrawImage to display low-rate video at 90 degrees

风流意气都作罢 提交于 2019-12-08 07:56:47
问题 I would like to display rotated camera video at a rate of 2 frames/second. The following code displays a 240 x 320 image rotated at 90 degrees. The image does not update unless I refresh the browser. The source that is changing is cam_1.jpg. It seems that once DrawImage has a src image, it does look for an update. What have I not learned yet? Thank You for your time and expertise. <title>CamDisplay</title></head><body> <canvas height="320" width="240"></canvas> <script type="text/javascript"

Using a JPanel extension class to set a background

前提是你 提交于 2019-12-08 04:16:28
问题 In my Main I want to create a JFrame , then I want to create a BackgroundPanel and I want to add this one in the JFrame . This is Main class: public class Main { public static void main(String args[]) { Frame frame = new Frame(); BackgroundPanel back = new BackgroundPanel(); frame.getContentPane().add(back); frame.setSize(400, 287); frame.setVisible(true); } } This is BackgroundPanel class: import java.awt.Graphics; import java.awt.Image; import java.awt.MediaTracker; import java.awt.Toolkit;

HTML5 drawImage slow on Chrome

こ雲淡風輕ζ 提交于 2019-12-08 03:56:33
问题 I'm having some real difficulty with offscreen rendering with HTML5! The code I have written runs perfectly fine with Firefox, using drawImage on canvas elements draws smooth images and does so very quickly. However, using Chrome 21, the drawImage performance is just terrible. I'm unable to see where I'm going wrong. Here is a jsfiddle with some sample code: http://jsfiddle.net/DXgum/3/ In Firefox, I can get about 60fps, chrome only delivers a framerate of 10fps. The performance does not