Ticket #1724 (closed defect: fixed)

Opened 4 months ago

Last modified 4 months ago

Image is put to an inaccurate place

Reported by: zoltan Owned by: judit
Priority: critical Milestone: GeoGebraWeb Alpha 2
Component: General Keywords:
Cc: michael, gabor, arpad, zbynek Estimate (h): 0
Progress (%): 100

Description

The http://www.geogebra.org/web/milestones/ggbFiles/_MandelbrotVisualization.ggb file is put to the correct place in the desktop version, but not in the web version (http://www.geogebra.org/web/test42/?f=_MandelbrotVisualization.ggb).

(OK, now I learned that [15086] is already about this, but for future reference I record the issue. :-)

Attachments

bug1724.PNG (25.0 KB) - added by michael 4 months ago.

Change History

comment:1 Changed 4 months ago by michael

This file has the different test cases for images:
http://www.geogebra.org/web/test42/?f=_images.ggb

comment:2 Changed 4 months ago by judit

The images appears in the right place with this change (maybe need some tests yet):
http://www.geogebra.org/trac/changeset/15188

But if there are more drawable on the canvas, and one of them an image, an exception causes.
I didn't find the reason of this yet.

comment:3 Changed 4 months ago by michael

  • Priority changed from medium to critical
  • Progress (%) changed from 0 to 60

http://www.geogebra.org/web/20120126/?f=_images.ggb
http://www.geogebra.org/web/20120126/?f=_images2.ggb
http://www.geogebra.org/web/20120126/?f=_images3.ggb

1) Looks like there's an error with reflecting an image which is killing the later objects eg points)

2) hit rectangles etc are wrong
3) translated image is OK
4) rotated image is wrong (move slider)
5) transparency not working

Last edited 4 months ago by michael (previous) (diff)

comment:4 Changed 4 months ago by michael

for _images3.ggb, GeoElement.setAlphaValue() isn't being called with anything other than 1.0. Perhaps a bug in XML loading??

comment:5 follow-up: ↓ 6 Changed 4 months ago by michael

comment:6 in reply to: ↑ 5 Changed 4 months ago by michael

Replying to michael:

Most things working now :)
http://www.geogebra.org/trac/changeset/15246

Correction: just one thing working better, still plenty of problems to fix :)

comment:8 Changed 4 months ago by michael

Something's going wrong here as labelRectangle is definitely OK (if we draw it, it's in the right place) but then highlighting is drawn wrong eg with double rotation

					geogebra.common.awt.Point2D corner1 = geogebra.common.factories.AwtFactory.prototype.newPoint2D(
							labelRectangle.getMinX(), labelRectangle.getMinY());
					geogebra.common.awt.Point2D corner2 = geogebra.common.factories.AwtFactory.prototype.newPoint2D(
							labelRectangle.getMinX(), labelRectangle.getMaxY());
					geogebra.common.awt.Point2D corner3 = geogebra.common.factories.AwtFactory.prototype.newPoint2D(
							labelRectangle.getMaxX(), labelRectangle.getMaxY());
					geogebra.common.awt.Point2D corner4 = geogebra.common.factories.AwtFactory.prototype.newPoint2D(
							labelRectangle.getMaxX(), labelRectangle.getMinY());
					at.transform(corner1, corner1);
					at.transform(corner2, corner2);
					at.transform(corner3, corner3);
					at.transform(corner4, corner4);
					if (highlighting == null)
						highlighting = geogebra.common.factories.AwtFactory.prototype.newGeneralPath();
					else
						highlighting.reset();
					highlighting.moveTo((float) corner1.getX(),
							(float) corner1.getY());
					highlighting.lineTo((float) corner2.getX(),
							(float) corner2.getY());
					highlighting.lineTo((float) corner3.getX(),
							(float) corner3.getY());
					highlighting.lineTo((float) corner4.getX(),
							(float) corner4.getY());
					highlighting.lineTo((float) corner1.getX(),
							(float) corner1.getY());
					g3.setTransform(oldAT);
					g3.draw(highlighting);

comment:9 Changed 4 months ago by michael

  • Cc arpad added

comment:10 Changed 4 months ago by michael

  • Cc zbynek added

Changed 4 months ago by michael

comment:11 Changed 4 months ago by judit

The highlighting is in incorrect place, because the value of oldAT wrong in web.

If in this row we use the identity matrix instead of oldAT, it works well in most (all?) cases:

g3.setTransform(oldAT);

What kind of cases necessary to save the oldAT matrix? Is there any case, when the value of this other than identity?

comment:12 Changed 4 months ago by judit

fixed: highlighting of images in the right place
http://www.geogebra.org/trac/changeset/15252

comment:13 Changed 4 months ago by judit

(oldAT sometimes different from identity matrix)

comment:14 Changed 4 months ago by zoltan

  • Summary changed from Image is put to an unaccurate place to Image is put to an inaccurate place

comment:15 Changed 4 months ago by michael

Highlighting working, thanks Judit :)
http://www.geogebra.org/trac/changeset/15252/trunk/geogebra

Just transparency not working now

comment:16 Changed 4 months ago by arpad

I do not understand the geogebra.web.awt.Graphics2D.setComposite method... Why does it set setGlobalAlpha two times and then reset? Compare it with the alpha handling in GeoGebraMobile's DrawImage.draw.

comment:17 Changed 4 months ago by arpad

geogebra.web.awt.Graphics2D.getComposite should call Context2d.getGlobalAlpha and create a Composite object from that. geogebra.web.awt.Graphics2D.setComposite should only call Context2d.setGlobalAlpha and not do anything else.

comment:18 Changed 4 months ago by judit

I think it's not lucky matter to use the context.save() and context.restore() functions in this case, because these functions work with stack, and if one of them called more times while the other don't called, we don't get the desirable effect. This happens at DrawImage too.

http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html#the-canvas-state

I changed the implementations of setComposite(comp) and getComposite() and it works in the current situation, but maybe it's neccessary to make some complements yet (later?), because currently only the transparency resolved in these functions, but the composite not means only the transparency.

The transparency works after my changes, I'll commit these later.

comment:19 Changed 4 months ago by michael

  • Progress (%) changed from 60 to 100

comment:20 Changed 4 months ago by michael

  • Status changed from new to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.