Re: [java2d] BufferedImage + scale

1999-02-18 Thread Jim Graham
One thing to check with "custom" buffered image object is that if the format you were trying to construct was one of the common formats that has a constant associated with it then you should call getType() and verify that it was recognized as that type. If it wasn't recognized, then unpack

Re: [java2d] Is Albert fixed?

1999-02-23 Thread Jim Graham
Hi, I was wondering if someone at Sun could let us know if the horrendous performance of methods like GeneralPath.intersects(), apparently due to a "fix" put into the albert package between beta4 and rc1, has been fixed in the maintenance release? You should be pleasantly surprised by the

RE: [java2d] Is Albert fixed?

1999-02-23 Thread Jim Graham
Does this mean that the Albert package no longer Correct. The Albert package is no longer there at all. (Though a different storage format is still used for Area in order to speed up doing the geometry calculations. The new format more closely matches the Shape/PathIterator requirements,

Re: [java2d] Palette Control?

1999-03-13 Thread Jim Graham
Is there any way to control the palette used by a BufferedImage? There is a constructor that takes an IndexColorModel as an argument. If you need a boilerplate for creating an IndexColorModel with a 6x6x6 color cube, then this code from the BufferedImage class will work: // Create a

Re: [java2d] Palette Control?

1999-03-13 Thread Jim Graham
However, despite what I said in the original post what I actually need to do is process an Image rather than a BufferedImage. Create the BufferedImage and then use: Graphics2D g2d = bufimg.createGraphics(); // After making sure that gifImage is fully loaded...

[java2d] Re: what java version to use?

1999-05-20 Thread Jim Graham
There are only 2 public final versions of the JDK. They are 1.2 FCS (I believe it is tagged as build "V" in fullversion) and 1.2.1. 1.2.1 contains only a security bug fix and is otherwise identical to 1.2 FCS. Both versions have *exactly* the same Area code and that code flattens all curves.

Re: [java2d] transform problem w/ rectangle (jdk1.2.1)

1999-05-21 Thread Jim Graham
Transforms on Area objects are problematic in the 1.2 and 1.2.1 releases. Try using a GeneralPath instead, or use createTransformedArea to create a new area in the new position rather than repositioning the old Area object. ...jim

RE: [java2d] Anti-aliasing Swing text

1999-06-08 Thread Jim Graham
Hi Ron, Still, from your feedback AA text without expansion should have been possible for Java2D and Swing (like Microsoft TT). If Java2D was going to alter text length, the Swing team should have been prepared a long time ago. One difference that you aren't taking into account with this

Re: [JAVA2D] Java2D Hardware

1999-09-07 Thread Jim Graham
Hi Jean-Marc, I would like to know if the Java 2D API takes advantage of the graphic card in my computer. If I have to render an image will it be faster with a good graphic card The current implementation of the API primarily uses DirectDraw to talk to the video memory of the display card

Re: [JAVA2D] Java2D Hardware

1999-09-08 Thread Jim Graham
I noticed that on X platforms, you use software rendering loops for ALL cases of drawImage. There is actually one case of X11 use for transparent GIFs since it is easier to send over a clip for the image than to do a read/modify/write. On Windows, all drawImage calls use software loops

Re: [JAVA2D] Java2D Hardware

1999-09-08 Thread Jim Graham
Why cant you use the same approach in JDK 1.2 for NON-Graphics2D versions of drawImage. The current approach (software rendering) leads to horrible performance for existing 1.1 applications on REMOTE displays. JDK 1.1 was fast because the XPixmap held on the X-Server avoided transfer of the

Re: [JAVA2D] Strange problem with Area

1999-09-16 Thread Jim Graham
Hi Josh, We currently don't have very good pipelines for drawing text through a complex clip. We render those characters as outlines in all cases. We also don't check to see if the result of scan converting an arbitrary clip shape ends up being a rectangle in the end. If it's not a

[JAVA2D] List of drawImage related performance bugs

1999-09-29 Thread Jim Graham
Here is a list of bugs that represent specific performance problems with drawImage. These bugs represent most, hopefully all, of the problems that developers have been experiencing that used to be tracked under the single umbrella bug 4185726. The problem with bug 4185726 was that it became the

Re: [JAVA2D] bug 4250270 - java.awt.image.WritableRaster.setRect()

1999-10-07 Thread Jim Graham
Hi Luc, I have however downloaded and tried the JDK1.3beta, and none of the 2 manifestations disappear, so is it possible that the bug is not solved or another is releated to ? Unfortunately the JDC does not indicate the release or dates when the bugs are fixed, but in this case the

Re: [JAVA2D] BufferedImage vs MemoryImageSource

1999-10-28 Thread Jim Graham
Hi Julian, The number of possible combinations for source and destination images and video hardware is rather large for me to make any definitive estimates of what you will see without further information. We have done nothing in 1.3 to improve the performance of copying offscreen images to the

Re: [JAVA2D] Affintransform

1999-11-03 Thread Jim Graham
could anyone explain how to interpret 'pixelstride' and 'scanlinestride' ? have looked for an explanation but its well-hidden. These terms are defined in the class comment for PixelInterleavedSampleModel. Pixel stride is the number of data array elements between two samples

Re: [JAVA2D] BufferedImage vs MemoryImageSource

1999-01-02 Thread Jim Graham
Hi Graeme, I can make some guesses as to how they were designed that might give better performance. If they store the images in VRAM, then they can take advantage of hardware acceleration for the blits to the screen. The downside is that the Windows APIs for doing this are very limited

Re: [JAVA2D] BufferedImage vs MemoryImageSource

1999-01-03 Thread Jim Graham
Then use direct draw. You have access to everything there. Actually we are already using DirectDraw, but we aren't using it to create surfaces since the DD surfaces don't solve the problem. I'll spell out all of the alternatives that we are aware of and their problems since we seem to be going

Re: [JAVA2D] Alpha Compositing Test

1999-11-15 Thread Jim Graham
I had figured that, as Swing components are double-buffered, that the default image buffers used would have alpha channels. The intention is that the images created by "createImage(w,h)" that Swing uses for double buffering will match the display as closely as possible - which means that the

Re: [JAVA2D] Animated GIF Flickering

2000-01-06 Thread Jim Graham
Hi Michael, Is there a way to access individual frames? Not directly. That is one of the things that the Image I/O interface, currently undergoing the JCP, will solve. For now, the best you can do is to listen for when a new frame is available. The ImageObserver that is passed to

Re: [JAVA2D] Graphics2D.dispose every paint?

2000-01-12 Thread Jim Graham
If you don't call the dispose method on a Graphics object when you are done with it, then that object may hold onto system resources until it is garbage collected and finalized. Note that the VM makes very loose promises on how often or soon objects will be GC'd and any dangling references to

Re: [JAVA2D] Drawing fill patterns

2000-01-31 Thread Jim Graham
Hi Gary, The current implementation of the TexturePaint object is optimized for ByteComponent and IntegerComponent images such as: TYPE_INT_XRGB TYPE_INT_ARGB TYPE_BYTE_INDEXED You should notice a drastic improvement in speed if you use one of those formats for your

Re: [JAVA2D] Convert Image object to Raster object

2000-02-01 Thread Jim Graham
Hi Darren, (Even though you found a more direct way of solving your problem, I wanted to respond to some of the points and questions made in this thread...) first, the application hangs at the DOS prompt and never completes although the final println _does_ happen. Whenever you use the AWT

Re: [JAVA2D] filling + antialiasing

2000-03-12 Thread Jim Graham
I switch antialiasing on, then fills with same color two really small polygons side by side. Then somehow there is small lines , that are following by edges of polygons, and these lines has color a bit brighter than fill color of both polygons (i.e if i fill it with black, lines will be

Re: [JAVA2D] setting clear pixels in an image

2000-03-13 Thread Jim Graham
What I'd like to see is that the black pixels of the watermark image are treated as "clear" so that shapes drawn there are not obscured at all. You need to give them 0 alpha somehow. If the watermark was something you drew yourself then you can start with a blank INT_ARGB image and just not

Re: [JAVA2D] HELP!!!!! displaying array of RGB to screen

2000-03-20 Thread Jim Graham
Hi Abel, If you read the comment for the MemoryImageSource constructor that you are using and the corresponding ColorModel.getRGBdefault() method which is where it states that it gets the ColorModel from, you should see that the format of pixels in an image of that format is a single integer per

Re: [JAVA2D] Help! Paint STILL not updating (thread issues)

2000-03-30 Thread Jim Graham
I am trying to display video from a file. My code is structured like... while (true) { getHeader() doLotsOfMath(); frameNumber++; update(getGraphics()); } What have you done to deal with either of these two issues: - throttling your updates - making sure you

Re: [JAVA2D] Help! Paint STILL not updating (thread issues)

2000-03-30 Thread Jim Graham
Hi Bill, Why should you write g = getGraphics() each time you want to update it? It's the most foolproof way. Why shouldn't you fix g at some early point in the component's life? You can, but there are a number of circumstances in which a Graphics can become invalid and then you are

Re: [JAVA2D] Help! Paint STILL not updating (thread issues)

2000-03-30 Thread Jim Graham
Don't think this'll fix your problem, but my understanding of AWT is that you should be calling the repaint() method, not the update() method. This is definately the recommended course of action and the safest bet generally. Be careful not to make assumptions about when your update method

Re: [JAVA2D] Questions on jdk1.4

2000-05-15 Thread Jim Graham
Hi Sergei, version java2d, which would have native core? What do you mean by a "native core" to 2D? The reference implementation of the 2D API has always been a blend of both native and Java code, each being used where it seems to work best... ...jim

Re: [JAVA2D] HELP: How can I improve draw performance when using BasicStroke?

2000-05-23 Thread Jim Graham
My application needs to draw a variety of arbitrary shapes using different pen styles. I think the problem you are running into is that our implementation currently only has two modes: Draw thin undashed lines Draw lines using full path widening/dashing geometry calculation

Re: [JAVA2D] GIF encoder?

2000-07-06 Thread Jim Graham
Hi Peter, If you use or distribute GIF encoder code, you may get a call from Unisys attorneys and a demand for licensing and payment, even if you wrote the software yourself and are only using it for non-commercial purposes or giving away the software free. Even if the algorithm doesn't use

Re: [JAVA2D] BufferedImage Internals Puzzler

2000-08-17 Thread Jim Graham
Hi Ted, I think others have shown how you can easily achieve the effect you want by using different SampleModels and DataBuffers with offsets defined and that is the best way to do this, but I wanted to address a philosophical issue that you raised in the way that you used subclassing here. To

Re: [JAVA2D] scale and translate question

2000-08-30 Thread Jim Graham
Hi Ted, The typical way that I do this kind of "transforming about a point other than the origin" is: imgx = imgw/2; imgy = imgh/2; translate(imgx, imgy); scale(scalex, scaley); translate(-imgx, -imgy); That lets the transform object do the calculations

Re: [JAVA2D] BufferedImage.TYPE_USHORT_GRAY

2000-09-05 Thread Jim Graham
What is actually used to represent an "unsigned short" in the DataBuffer? What is the upper limit gray scale value? The data values are stored in an array of shorts and are "interpretted" as unsigned. This is the same way that we deal with byte array data for ByteIndexed images. When you

Re: [JAVA2D] Graphics2D and doubles

2001-03-22 Thread Jim Graham
Hi Jesse, A problem that we have is when you zoom in or out to extreme distances Graphics2D eventually chokes and wont draw anything. And this is understandable since the numbers are running out of resolution at these large scaling. What is probably happening is that our rendering code is

Re: [JAVA2D] AffineTransform and Rotation

2001-04-19 Thread Jim Graham
An easy way to determine the rotation effects (or other effects) of a given affine transformation is to apply it to unit vectors and see what happens to them. Note that using only one unit vector and attempting to draw too many conclusions about the result can lead to mistaken conclusions, but

Re: [JAVA2D] are repeated antialiased renderings pixel for pixel equivalent?

2001-05-15 Thread Jim Graham
Should repeated antialiased renderings render pixels exactly the same on each pass with a rule like AlphaComposite.Src (or AlphaComposite.SrcOver on an onscreen buffer)? Each AA operation will individually take each partially covered pixel, compute the value that would be stored there if the

Re: [JAVA2D] masked image drawing

2001-08-01 Thread Jim Graham
Hi Eddie, The typical way to merge an alpha channel into another image is to use the AlphaComposite.DstIn mode. This takes the destination color and multiplies it by the source alpha. Wherever the source was transparent the destination becomes transparent. Wherever the source was opaque the

[JAVA2D] We're back and Beta 2 release issues

2001-09-04 Thread Jim Graham
This message will serve a couple of purposes. First the 2D team is now back in offices and reading their email (and this list) again after having moved offices to a new campus. Second, the beta 2 release of JDK 1.4 was published just before we moved and we did not get a chance to mention a

[JAVA2D] Playing with Transforms

2001-10-05 Thread Jim Graham
Handling ordering of operations with affine transforms is always one of the trickiest parts of mastering 2D transformations. A while back someone posted a pointer to this tutorial which both teaches some fundamental properties of affine transformations and also has a few applets that let you

Re: [JAVA2D] Feature requests for JDK1.5

2001-10-19 Thread Jim Graham
I would like to echo Ron's request to concentrate on rigid backward compatibility before adding new features. Like Ron we've been bitten by changes in behavior between 1.2 and 1.3/1.4 which is costing us inordinate amounts of time simply to stand still, i.e. to keep our application doing the

Re: [JAVA2D] High performance graphics on java.sun.com

2001-11-01 Thread Jim Graham
Hi Damon, Have you tried your application on 1.4 beta 3 yet? I believe that beta2 was missing support for the 25-bit format we use for transparent images in most Graphics Configurations. That should help with your transparent performance numbers quite a lot. 1.4 beta 3 also has much better

[JAVA2D] 1.4 beta 3 is available

2001-11-01 Thread Jim Graham
You can now download early access versions of 1.4 beta 3 from the Java Developer's Connection: http://java.sun.com/j2se/1.4/ Some interesting changes in this release include: - performance improvements to scaling and compositing VRAM images (including VolatileImage,

Re: [JAVA2D] 1.4 beta 3 is available

2001-11-01 Thread Jim Graham
D'oh! I knew I'd forget an important feature. Try running your application with either: -Dsun.java2d.trace=count or use: -Dsun.java2d.trace=help for more information on this feature... ...jim

Re: [JAVA2D] 1.4 beta 3 is available

2001-11-14 Thread Jim Graham
--On Wednesday, November 14, 2001 12:40:32 -0600 Ernest Hill [EMAIL PROTECTED] wrote: i tried it. it didn't seem to do anything. regards, ernest At 02:40 PM 11/1/2001 -0800, Jim Graham wrote: D'oh! I knew I'd forget an important feature. Try running your application with either

Re: [JAVA2D] irregular image resize

2002-01-02 Thread Jim Graham
Hi Jonathan, If you can't use Java 2 APIs (introduced in version 1.2) then there are going to be performance losses with having to deal with the ImageConsumer and ImageProducer system, but there's not anything you can do about that. (We created BufferedImages in 1.2 to facilitate the kinds of

Re: [JAVA2D] Alpha components

2002-01-07 Thread Jim Graham
is there any workaround for making an alpha enabled color in java 1.1? 1.1 supported alpha values for colors in images, but not for the Color object. It supported only the SrcOver mode of rendering images and the reference implementations did not actually blend the colors, but instead used a

Re: [JAVA2D] RenderingHints and drawImage( )

2002-01-25 Thread Jim Graham
Hi John, The ANTIALIAS hints only affect drawing and filling shapes and text. The hints that affect image rendering are the INTERPOLATION hints, but they only affect the rendering when you are scaling the image (i.e. the destination pixels don't match the source pixels 1:1...)

Re: [JAVA2D] drawing with Identity Transform

2002-03-22 Thread Jim Graham
Hi Ted, The answer is that you should restore the origAtx and not set an identity. In many cases, on the screen, the transform that appeared in the Graphics object that your Swing component was handed was Identity anyway. In earlier implementations, they would draw nested components by using

Re: [JAVA2D] question about the use of PathIterator

2002-04-01 Thread Jim Graham
Hi Aant, We would need to see some code here to understand what you are saying. The description is not precise enough. Can you write a small (less than 50 lines) test case for this? ...jim --On Thursday, March 28, 2002 16:02:37 +0100 aant [EMAIL PROTECTED]

Re: [JAVA2D] question about the use of PathIterator

2002-04-02 Thread Jim Graham
Hi Aant, This test case appears to demonstrate an idiosyncrasy of the way that we store the data internally in an Area object. Both paths represent their input polygons accurately - explicitly drawing a line back to the starting point before a closepath is superfluous but not incorrect. Thus

Re: [JAVA2D] question about the use of PathIterator

2002-04-02 Thread Jim Graham
Hi Aant, One more thing. You mentioned that the Area's iteration had the direction in reverse. The Area has digested the geometry and simplified it so there is no guarantee that the ordering or the number of subpaths or any aspect of the original geometry iteration will be preserved in the

Re: [JAVA2D] Blitting with an AffineTransform

2002-04-03 Thread Jim Graham
Hi Jerome, You sent out this question right before JavaOne so I don't think anyone got back to you. I was wondering what is the best way to draw fixed size images between : * drawImage(Image image, AffineTransform at, ImageObserver o) * drawImage(Image image, int x, int y, ...) ? I

Re: [JAVA2D] Using outline from pathiterator

2002-04-08 Thread Jim Graham
Hi Nicolas, I use your excellent class Area to merge polygon and extract the outline. So, i have lots of cases where the result is a mix of plain polygons and holes. But, the pathiterator doesnt tell when you iterate the subpaths if its a plain polygon or a hole Is there a field or an

Re: [JAVA2D] Alpha blending washed out

2002-04-24 Thread Jim Graham
Hi Todd, By any chance are you using a BYTE_INDEXED destination to do the blending? Often the data gets corrupted when we calculate a color and then try to put that color back into an image with a small fixed palette - we try to do some dithering and it can often introduce errors where you

Re: [JAVA2D] Performance of translucent line drawing

2002-05-13 Thread Jim Graham
Hi Jan, The short answer to the fillRect vs. drawLine question is for the developers to always use the simplest API call that matches their needs. Rectangles are, well, a box of pixels (unless you are transformed in which case it might be a tilted box of pixels). Lines are complicated little

Re: [JAVA2D] HSB values explained

2002-08-01 Thread Jim Graham
Hi Jan, Does anybody know any resources where these systems are explained (preferably with some conversion algorithms)? Foley and Van Dam's Computer Graphics: Principles and Practice describes a lot of the terms and protocols we use in the 2D API. In particular, they define the HSV (aka HSB)

Re: [JAVA2D] Convert THREE 16 bit shorts for RGB to ONE 32bit RGB representation...

2002-11-11 Thread Jim Graham
Square root will give you a non-linear translation into the destination space. Also, adding 32768 will mean that 32767 or 0x7fff will map to full intensity, 0 will map to half intensity, and -32768 will map to blackness - is that the mapping you want? If you want to convert a signed short

Re: [JAVA2D] Problem with BasicStroke and Graphics2D#scale on Mac OS X

2002-11-25 Thread Jim Graham
Hi Rhett, In 1.2 we tried to deal with stroke/fill pixelization and alignment issues by specifying a user-space offest for strokes so that the typical behavior on a screen using standard bresenham algorithms for drawing lines and polygon borders would be closely approximated in a theoretical

Re: [JAVA2D] STROKE_CONTROL

2002-11-25 Thread Jim Graham
Hi Ramón, Use the Area class to either subtract or intersect the original shape with/from the outline created with BasicStroke.createStrokedShape(). Intersection will produce the inside part, subtract will produce the outside part. As far as non-convex polygons, you will probably find lots of

[JAVA2D] Path fun (in Re: to both STROKE_CONTROL and GeneralPath expansion)

2002-11-26 Thread Jim Graham
Ted and Ramón, Using the Area and BasicStroke classes, you can achieve any of the effects that you two have been asking for. Assuming a source Shape object S, and wanting to outsideline, insideline, expand or contract it by N pixels... First get all your variables set up: BasicStroke

Re: [JAVA2D] Caching Colors

2002-12-02 Thread Jim Graham
In normal usage the private paintContext field of the Color object should never be used. The graphics code treats colors specially and simply fills the rectangles with the appropriate color rather than invoking its PaintContext object. But, if anyone ever calls the createContext() method of a

Re: [JAVA2D] Path fun (in Re: to both STROKE_CONTROL and GeneralPath expansion)

2002-12-02 Thread Jim Graham
, it would seem that I could use Strokes and Areas to expand and contract by different amounts in x and y. Thank you, Ted Hill - Original Message - From: Jim Graham [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, November 26, 2002 4:37 PM Subject: [JAVA2D] Path fun (in Re

Re: [JAVA2D] how can newbe create a .png or .jpg file from a JFrame oder other complex graphical container?

2003-01-02 Thread Jim Graham
Hi Sven, Component.createImage(width, height) does not take a snapshot of the window as you seem to expect, it simply creates a brand new blank image (cleared to the background color of the component) that is compatible with the component so that you can use it as an offscreen buffer for double

Re: [JAVA2D] How to create a smaller BufferedImage from larger one - help wanted

2003-03-04 Thread Jim Graham
Hi Eric, BufferedImage questions are always welcome on the Java2D list. You might have better luck getting the ColorModel, asking it to create you a compatible raster, and then using the BufferedImage constructor that takes a ColorModel and a Raster. But, if the original image was a GIF then

Re: [JAVA2D] Odd shaped circles revisited

2003-09-02 Thread Jim Graham
Hi Joe, --Joe Bowbeer wrote: Is any progress being made with bug 4151279? http://developer.java.sun.com/developer/bugParade/bugs/4151279.html Is this scheduled to be fixed in Tiger 1.5? Is this the right place to ask about this? This is the best place I can think of to ask this question. This

Re: [JAVA2D] Performance question...

2003-10-26 Thread Jim Graham
My current redraw strategy is to iterate the linkedlist in the paint method and pass the getBounds method of each element into the hitClip method of the graphics object to determine if I need to draw it. Try eliminating the hitClip call and see how things go. That method is not meant to be used

Re: [JAVA2D] Area inside a closed GeneralPath

2003-11-12 Thread Jim Graham
Hi Ted, We don't provide such a facility in the J2SE APIs, but I would think that someone would have created an area calculation module somewhere. One problem is that you have to be careful how you state the question because the answer depends on whether you are looking for: - The discrete

Re: [JAVA2D] Graphics2D.drawImage(Image, AffineTransform, ImageObserver) memory issues

2003-11-19 Thread Jim Graham
The AffineTransformOp can do affine transforms of images for you and the filter() method that does the work takes an optional second parameter that is the destination BufferedImage to store the data into. Try using that with your own temporary image to store the transformed results into. If you

Re: [JAVA2D] draw/fill mismatch on 1.4.2_02

2004-02-12 Thread Jim Graham
Rectangle2D bar = ...; g2.setPaint(gradientPaint); g2.fill(bar); g2.setColor(Color.black); g2.draw(bar); The issue here is that we could use completely different implementations to handle gradients vs. solid colors and while each of those pipelines enforces consistency between its own fills and

Re: [JAVA2D] zooming double buffering

2004-02-15 Thread Jim Graham
Hi Michael, Yes, I guess you do apply *a* transform to *a* graphics object before you get to the code that draws the text, but it's the wrong graphics object that you apply the scale to. You are scaling the graphics object that is passed to your paint method - the one that you subsequently hand

Re: [JAVA2D] draw/fill mismatch on 1.4.2_02

2004-02-15 Thread Jim Graham
So if I wanted the fill and draw of the same shape to align properly, I should stick to one type of Paint? Yes, and as you discovered through your test case, that may not even be enough because some of our pipelines still don't have agreement between their fills and draws. Fill/Draw status

Re: [JAVA2D] NoninvertibleTransformException

2004-02-16 Thread Jim Graham
Does anyone know under what circumstances AffineTransform.inverseTransform() is Mathematically, this occurs when the matrix has a zero determinant. Visually this happens when the transform specifies a transform that maps all coordinates in user space to a line or a point in device space. (To

Re: [JAVA2D] NoninvertibleTransformException

2004-02-17 Thread Jim Graham
An example of where something like this is likely to occur in practice is if you animate a figure to flip over by scaling it with values that vary from 1.0 (normal rendering) down to -1.0 (flipped rendering). As you iterate through the scale values from 1.0 to -1.0 you can at some point in the

Re: [JAVA2D] zooming double buffering

2004-02-18 Thread Jim Graham
sorry, i don't understand what i must do that my application work. can you show it to me in my example? has it woked for you? greetings michael All of the tips and tricks involved in doing a proper zoomable GUI make the subject far too involved for a forum like this. You really should look into

Re: [JAVA2D] Problem flipping grayscale medical image

2004-03-08 Thread Jim Graham
Hi Alfred, I would need to see a small test case that demonstrates this (which you can send just to me to not bother the list), because... Everything works great until I try to concatenate a flip operation to the AffineTranform object. Assuming I want to flip the image LEFT_RIGHT

Re: [JAVA2D] Saving ARGB BufferedImages as JPEG with ImageIO

2004-03-16 Thread Jim Graham
An image of TYPE_INT_ARGB uses a PackedColorModel with a Packed Raster with a TYPE_INT DataBuffer. It is incompatible with the Byte-based ComponentColorModel (and SampleModel) that you are creating. I'm not sure how these two pieces of data would interact in this case...

Re: [JAVA2D] FW: Trouble with colorfiltering with LookupOp

2004-03-16 Thread Jim Graham
First it looks to me like green affects red, not blue. Given that, then this looks like a byte endian issue. For integer data types: XRGB bigendian BGRX smallendian G and R would get confused and B would get confused with an unused channel. We're tracking down a few byte endian

Re: [JAVA2D] Angle between two lines

2004-06-02 Thread Jim Graham
int l1x = x2 - x1; int l1y = y2 - y1; int l2x = x3 - x1; int l2y = y3 - y1; float tan1 = (float)l1y/(float)l1x; float tan2 = (float)l2y/(float)l2x; double ang1 = Math.atan(tan1); double ang2 = Math.atan(tan2); This will fail because Math.atan(tangent) does not know which quadrant the line is in

Re: [JAVA2D] Area.getPathIterator() question

2004-06-23 Thread Jim Graham
When I iterate over the path iterator, I find many DUPLICATE CONSECUTIVE POINTS. Is there some way to get a PathIterator from an Area that will not have duplicate consecutive points? One question is whether or not you have discovered any practical problems from these extra points or is it just

Re: [JAVA2D] Swing/AWT Union of Bounds

2004-07-13 Thread Jim Graham
The repaint model is more targetted at applications which have a concept of the current state that needs to be displayed which tends to be updated mostly atomically. Repainting just a small rectangle is meant more as an optimization to indicate which parts of the screen have new data that needs

Re: [JAVA2D] Pixel collision in games with 2D api

2004-07-14 Thread Jim Graham
Hi Lincoln, One of the problems you may run into is that we only have routines that handle image formats that we recognize, whether accelerated or not. Thus, if you create some kind of custom 32-bit format you would end up causing us to invoke our general custom-format routines which use all of

Re: [JAVA2D] Strategies to manage BufferedImage size

2004-07-27 Thread Jim Graham
Before loading: Mem Usage: 18700K -- VM Size: 16856K After loading: Mem Usage: 28656K -- VM Size: 34304K All that it does is read the image in as a ImageIcon, convert the ImageIcon's getImage result to a BufferedImage, store a reference to the BufferedImage for later use in manipulations, and

Re: [JAVA2D] Connecting two semi-transparent shapes by a line

2004-09-07 Thread Jim Graham
--On 09/03/04 09:52:59 PM -0400 Gregory Pierce wrote: Okay here is the scenario (and I'm hoping there is something in the API that permits this because at this point I haven't found anything). What I have are two RoundRectangle2Ds that have an alpha of 50 percent. I want to draw a line connecting

Re: [JAVA2D] Connecting two semi-transparent shapes by a line

2004-09-07 Thread Jim Graham
2) Do a CAG adding all of the rounded rectangles together into one gigantic clipping shape. This is probably Er definitely the easiest to code since I'm already iterating through the RR2Ds anyways and can make this master shape. I'll probably do that one before I go to sleep. Since I'm at a

Re: [JAVA2D] Connecting two semi-transparent shapes by a line

2004-09-07 Thread Jim Graham
2) Do a CAG adding all of the rounded rectangles together into one gigantic clipping shape. This is probably Er definitely the BTW, Area is great for doing lots of complex CAG operations on arbitrary geometry, but for a specific subset of its capabilities: - All geometry is known to

Re: [JAVA2D] Connecting two semi-transparent shapes by a line

2004-09-07 Thread Jim Graham
g2d.setClip( clipArea ); // draw all of the links Iterator linkIterator = links.iterator(); while (linkIterator.hasNext()) { WidgetIF widget = (WidgetIF) linkIterator.next(); widget.draw( g2d ); } One minor optimization here.

Re: [JAVA2D] java2d.opengl=true

2004-09-08 Thread Jim Graham
What I did was compare renderingMethod0() which is the rendering of all of the shapes with no form of clipping with 1000 RR2Ds with a translucent color and it was taking about 1200-1300 ms. I considered this slow. I swapped the shape to a regular rectangle to make sure it wasn't the curve that

Re: [JAVA2D] Why isn't there a method for drawing Point2Ds, pixels, and the like

2004-09-09 Thread Jim Graham
The reason there is no method for drawing them is that they don't describe any geometry to draw. Also, the question of what exactly the user wants us to draw gets a little fuzzy as we introduce antialiasing, scaling, and printing on high resolution printers to the mix. If this were a pixel-based

Re: [JAVA2D] Why isn't there a method for drawing Point2Ds, pixels, and the like

2004-09-09 Thread Jim Graham
It would be nice to have an RFE filed on this. There are a lot of issues here, but at the very least the RFE would give us a place to increase awareness of the issues, even if we don't find an acceptable solution to put into our APIs. There are two parts to this - whether to have Point2D

Re: [JAVA2D] drawPolyline()-setting stroke width

2004-10-14 Thread Jim Graham
It's hard to know what is going on here without knowing what the transform is at the time of the drawPolyline call since the line width is relative to the current transform. Do you have an isolated standalone test case for this? ...jim --On Thursday, October

Re: [JAVA2D] drawPolyline()-setting stroke width

2004-10-15 Thread Jim Graham
Hi Nancy, The issue you encountered here is related to bug report #4114921 which asks for a way to scale coordinates independently of things like the line width. This isn't really a bug since the current system scales both together by design, but we could potentially add new capabilities to make

Re: [JAVA2D] setting color with Graphics2D on a BufferedImage with IndexColorModel

2004-10-20 Thread Jim Graham
My problem: if I use a color that is not contained in the palette, or if I call drawString() with font antialiasing , which will produce pixels with a color not contained in the palette. How is are these new colors mapped to the palette color? There is no specification to define how this mapping

Re: [JAVA2D] color depth

2004-10-21 Thread Jim Graham
Hi David, The short guess answer for your problem is that I imagine that doing a getColorModel() on one of your screen components will help you make this determination, but the fact that you have to check this screen depth concerns me for the following reasons: Robot always returns a 24-bit image

Re: [JAVA2D] SetToScale problem....AffineTransform

2004-11-01 Thread Jim Graham
It's hard to diagnose this problem without a complete example to run, but I can make some guesses and recommendations. Which release are you running this on? The reason I ask is that there is an image scaling regression in JDK 1.5.0 that causes us to use a slightly slower rendering path when the

Re: [JAVA2D] Soft blending between two images

2005-02-07 Thread Jim Graham
We don't support soft edged clipping currently since our antialiasing approach is currently done on a per-operation basis, rather than a global technique like Full Screen Antialiasing. This means that repeated AA operations over the same area will accumulate the coverages on the edges and if you

Re: [JAVA2D] AffineTransform question

2005-06-09 Thread Jim Graham
Another way of managing this is to keep various decomposed values around and then compose the matrix only at render time. For example, if you want to independently control scaling and rotation and set limits on them: On mouse motion: if (scaling motion) {

Re: [JAVA2D] Problem with non-stopping calls to update()

2005-08-25 Thread Jim Graham
public void update(Graphics g) { // Background: map field g.drawImage(backbuffer, 0, 0, this); // Foreground: headsup display headsup.draw(g); } public void paint(Graphics g) { update(g); } Now the

Re: [JAVA2D] Problem with non-stopping calls to update()

2005-08-25 Thread Jim Graham
From the Component javadocs: The update method of Component calls this component's paint method to redraw this component. and: Subclasses of Component that override this method should either call super.update(g), or call paint(g) directly from their update

  1   2   >