graphics

Extracting InDesign CS4 Graphics using C# and COM

巧了我就是萌 提交于 2021-02-16 09:30:22
问题 I'm trying to get details of the graphics in an InDesign file. For technical reasons I'm using COM. Not my favourite, as (discussed elsewhere in StackOverflow) you have to spend half your life casting. In Theory (!), the code snippet belwo should work. Intellisense shows doc.AllGraphics as returning objects . The CS3 scripting reference at http://www.indesignscriptingreference.com/CS3/JavaScript/Document.htm shows it as Array of Graphic for (int g = 1; g <= doc.AllGraphics.Count; g++) {

Copy a section of an image and paste it in another?

混江龙づ霸主 提交于 2021-02-11 15:24:49
问题 Lets say I got two images in VB.NET. Both are 100x100. Then I want to copy a section of the first image and paste it on the second image. For example, lets say I want to pickup the rectangle (25,25,75,75) from the first image, and paste it at (25,25) point of the second image. Sorry, it is hard to explain, so here's an example image: 回答1: This looks like what you are looking for. http://www.vb-helper.com/howto_net_drawimage_copy_part.html 来源: https://stackoverflow.com/questions/4811100/copy-a

Copy a section of an image and paste it in another?

我的梦境 提交于 2021-02-11 15:24:09
问题 Lets say I got two images in VB.NET. Both are 100x100. Then I want to copy a section of the first image and paste it on the second image. For example, lets say I want to pickup the rectangle (25,25,75,75) from the first image, and paste it at (25,25) point of the second image. Sorry, it is hard to explain, so here's an example image: 回答1: This looks like what you are looking for. http://www.vb-helper.com/howto_net_drawimage_copy_part.html 来源: https://stackoverflow.com/questions/4811100/copy-a

How to add a paintComponent() to a JPanel

白昼怎懂夜的黑 提交于 2021-02-11 15:14:49
问题 I have 2 classes, Class2 and Class4. I wish to add the paint in Class2 from Class4 onto a JPanel in Class4 using the p4.add(c2o) and f.add(p4) methods. I have no problems adding GUI but I simply couldn't add graphics. Class4: import java.awt.BorderLayout; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; public class Class4 { public void mainMethod(int event){ JFrame f = new JFrame("Love Test"); if(event == 0){ f.setDefaultCloseOperation(JFrame.EXIT_ON

Changing direction of rotation Pygame

女生的网名这么多〃 提交于 2021-02-11 12:36:17
问题 How would you change the direction of a rotating image/rect in Pygame? Applying positive and negative degree values works but it seems to only be able to rotate one direction throughout my window. Is there a way to ensure a change in direction of rotation? Perhaps change up rotation of a spinning image every 5 seconds, or if able to change the direction of the spin when hitting a X or Y axis. I've added some code below. It seems like switching movement directions is easy with rect.move_ip as

How to save a drawing made with java graphics as a independent object

别等时光非礼了梦想. 提交于 2021-02-11 12:20:25
问题 my problem is that I need to save the things that I draw with java graphics as independent objects, to later recolor them, erase them indepently... Here is my eclipse project for you to import. (The main class is the Paint class) This is the method I use to draw: protected void paintComponent(Graphics g) { if (imagen == null) { imagen = createImage(getSize().width, getSize().height); graficos = (Graphics2D) imagen.getGraphics(); graficos.setRenderingHint(RenderingHints.KEY_ANTIALIASING,

Java on Eclipse won't show the JPanel even when I add it to JFrame

安稳与你 提交于 2021-02-10 18:16:06
问题 These are the files. I have set JFrame to be visible, and have added JPanel to it, but still, the code only shows the window without anything in it. import java.util.List; import java.util.ArrayList; import java.util.Random; import javax.swing.JFrame; import javax.swing.JPanel; import java.util.Collections; public static void main(String[] args) { JFrame frame = new JFrame(); frame.setSize(350, 300); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setTitle("My Empty Window");

Loading non-power-of-two textures in Vulkan

孤人 提交于 2021-02-09 11:47:37
问题 My 2D texture loader works fine if my texture dimensions are power-of-two, but when they are not, the texture data displays as skewed. How do I fix this? I assume the issue has something to do with memory alignment and row pitch. Here's relevant parts of my loader code: VkMemoryRequirements memReqs; vkGetImageMemoryRequirements( GfxDeviceGlobal::device, mappableImage, &memReqs ); VkMemoryAllocateInfo memAllocInfo = {}; memAllocInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO; memAllocInfo

How to implement the scanline access of TBitmap correctly?

帅比萌擦擦* 提交于 2021-02-08 15:26:10
问题 I am trying to access the scanline of a Bitmap according to an article on Embarcadero. Using scanlines like for y := 0 to n do begin line := bitmap.scanline [y]; for x := 0 to n do line [x] := value; I have implemented before. I noticed that accessing a scanline takes relatively much time and the article mentioned above offers a solution to that. I am not able to implement it correctly. My code is: unit SCTester; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics,

Rotate and Scale rectangle as per user control

痞子三分冷 提交于 2021-02-08 10:45:33
问题 I have UserControl of Size 300*200. and rectangle of size 300*200. graphics.DrawRectangle(Pens.Black, 0, 0, 300, 200); When I rotate rectangle in userControl by 30 degree, I get rotated rectangle but it is outsized. PointF center = new PointF(150,100); graphics.FillRectangle(Brushes.Black, center.X, center.Y, 2, 2); // draw center point. using (Matrix matrix = new Matrix()) { matrix.RotateAt(30, center); graphics.Transform = matrix; graphics.DrawRectangle(Pens.Black, 0, 0, 300, 200); graphics