Affine transformation in creation of S-box(AES)
hi,
I am trying to implemeant a toy version of AES. I am working on bits(instead of bytes) of 64.
I am unable to do affine transformation on
Not a Java question. You might try posting to sci.crypt on Usenet: http://groups.google.com/group/sci.crypt/search?q=AES+S-boxes&
Similar Messages
-
Problem: Scalable canvas with affine transformation
I'm trying to create a canvas that can be scrolled and is scalable through affine transformations. This, I'm trying to achieve by adding a control component to an existing Canvas that listens for MouseEvents and masks the area outside the area defined by the canvas when the control component is created. The base for this component was http://gasi.ch/blog/zooming-in-flash-flex/.
Next I'm explain how the component is supposed to work and then on to the problem.
This is how the canvas is created. In the constructor MouseListeners and a mask canvas is added to dragCanvas.
var canvasControl:MatrixCanvasMouseControl = new MatrixCanvasMouseControl(dragCanvas);
The listeners work pretty much the same way as in the link I mentioned earlier. So on to the scaling which is the problem.
The scaling is done by first scaling the dragCanvas with method scaleAt(...):
/** START OF MOUSE WHEEL LISTENER */
// CUT
// get the mouseevent position in stage
var eventStagePoint:Point = new Point();
eventStagePoint.x = event.stageX;
eventStagePoint.y = event.stageY;
// scale dragCanvas at that point with scaleAt
scaleAt(canvas, zoomIn, zoomIn, canvas.globalToLocal(eventStagePoint).x, canvas.globalToLocal(eventStagePoint).y);
// CUT
/** END OF MOUSE WHEEL LISTENER */
* Scales the matrix through affine transformation.
public static function scaleAt(sprite:Sprite, scaleX:Number, scaleY:Number, originX:Number, originY:Number):void
var translateMatrix:Matrix = sprite.transform.matrix;
// move to origo to preserve form
translateMatrix.translate(-originX, -originY);
// scale the matrix
translateMatrix.scale(scaleX, scaleY);
// move back to originX, originY
translateMatrix.translate(originX, originY);
sprite.transform.matrix = translateMatrix;
This scales the maskCanvas also. Next I'm trying to scale the maskCanvas back to it's original position by:
MatrixHelper.scaleAt(maskCanvas, (1 / zoomIn), (1 / zoomIn), maskCanvas.globalToLocal(eventStagePoint).x * (1 / zoomIn), maskCanvas.globalToLocal(eventStagePoint).y * (1 / zoomIn));
The problem is that when the Canvas is scaled, the mask changes it's position when I try to scale it back to it's original size and position (as it's size and position changed when dragCanvas was scaled because maskCanvas is a child of dragCanvas).
This might not be the best way to achieve scrolling. I also thought about extending Canvas and creating a parent Canvas that would contain dragCanvas and maskCanvas as it's children. That way scaling one would not affect the other. The problem with this was that I didn't find a way to do that without overriding Canvas functionality. If anyone knows and could explain how this could be done effectively for example by "decorating" it would be great.
I would really appreciate if anyone could help me with this. I've struggled with it for quite a few hours already.
I know I haven't explained everything clearly, so, please, ask me to clarify things more, if this was not understandable.
Message was edited by: Kimmo Jokinen
Message was edited by: Kimmo JokinenOK, I found a hacky solution to my problem by going through every rawChildren of the canvas and then scaling it if it's id didn't match with the one I created in the mouseControl component.
This does not seem like a very elegant way but at least it works.
I'm pretty sure that this should be done whole differently architecturally but I'm not experienced enough to find that way.
So this is how I did it.
for (i = 0; i < canvas.rawChildren.numChildren; i++) {
child = canvas.rawChildren.getChildAt(i) as Object;
if (!child is DisplayObject) {
continue;
transformAllowed = false;
displayChild = DisplayObject(child);
if (displayChild.hasOwnProperty("id") && (displayChild["id"] == "maskCanvas" || displayChild["id"] == "mouseControlArea")) {
transformAllowed = false;
} else {
transformAllowed = true;
if (transformAllowed) {
MatrixHelper.scaleAt(displayChild, zoomOut, zoomOut, canvas.globalToLocal(eventStagePoint).x, canvas.globalToLocal(eventStagePoint).y); -
Dynamic Creation of list box on excel sheet and handling events
hi all ,
i m working on excel to sap integration application and for that i need to create dynmicaly list boxes in excel and also needs to handler events of each boxes..
please suggest me somehting asap/
thanks in advance,
jigs
helpful ans will be rewarded.hi all ,
i m working on excel to sap integration application and for that i need to create dynmicaly list boxes in excel and also needs to handler events of each boxes..
please suggest me somehting asap/
thanks in advance,
jigs
helpful ans will be rewarded. -
Creation of check boxes in the ALV report
Hi All,
With all your support i'm gaining more knowledge, thank's for that,
in my ALV report i want to create a check boxes if the check boxs are elected and processed then the particular records is going to disappear,
How can we do this,
Thanks & Regards
Krishnahi,
i have done this one.please check my code.
TYPE-POOLS : slis.
TYPES : BEGIN OF st_ekko,
ebeln TYPE ekko-ebeln, "Purchasing Document Number
bstyp TYPE ekko-bstyp, "Purchasing Document Category
bsart TYPE ekko-bsart, "Purchasing Document Type
aedat TYPE ekko-aedat, "record created on
ernam TYPE ekko-ernam, "Person who Created the Object
check(1),
END OF st_ekko.
TYPES : BEGIN OF st_ekpo,
ebeln TYPE ekko-ebeln,
ebelp TYPE ekpo-ebelp, "Item Number of Purchasing Document
ematn TYPE ekpo-ematn, "Material number
matkl TYPE ekpo-matkl, "Material group
netpr TYPE ekpo-netpr, "Net price in purchasing document
END OF st_ekpo.
TYPES : BEGIN OF st_ebeln,
ebeln TYPE ekpo-ebeln,
END OF st_ebeln.
TYPES : BEGIN OF st_eine,
ebeln TYPE ekko-ebeln,
ekorg TYPE eine-ekorg,
ekgrp TYPE eine-ekgrp,
END OF st_eine.
TYPES : BEGIN OF st_check,
check(1),
END OF st_check.
DATA : it_ekpo TYPE STANDARD TABLE OF st_ekpo,
it_ekko TYPE STANDARD TABLE OF st_ekko,
wa_ekko LIKE LINE OF it_ekko,
it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat LIKE LINE OF it_fieldcat,
wa_layout TYPE slis_layout_alv,
it_events TYPE slis_t_event,
st_event LIKE LINE OF it_events,
it_listheadr TYPE slis_t_listheader ,
wa_listheadr LIKE LINE OF it_listheadr,
st_printparams TYPE slis_print_alv,
it_sortinfo TYPE slis_t_sortinfo_alv,
wa_sortinfo LIKE LINE OF it_sortinfo,
it_ekposortinfo TYPE slis_t_sortinfo_alv,
wa_ekposortinfo LIKE LINE OF it_ekposortinfo,
it_filter TYPE slis_t_filter_alv,
it_ebeln TYPE STANDARD TABLE OF st_ebeln,
it_eine TYPE STANDARD TABLE OF st_eine,
wa_eine TYPE st_eine,
it_popup TYPE STANDARD TABLE OF st_eine,
wa_popup TYPE st_eine,
it_check TYPE STANDARD TABLE OF st_check,
wa_check TYPE st_check.
DATA : v_ebeln TYPE ekko-ebeln.
SELECTION-SCREEN
SELECTION-SCREEN BEGIN OF BLOCK b WITH FRAME TITLE tit.
SELECT-OPTIONS: so_ebeln FOR v_ebeln OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b.
INITIALIZATION
INITIALIZATION.
tit = text-000.
AT SELECTION-SCREEN ON
AT SELECTION-SCREEN ON so_ebeln.
PERFORM validate_ebeln.
START-OF-SELECTION
START-OF-SELECTION.
PERFORM get_ekko_data.
PERFORM get_eine_data.
END-OF-SELECTION
END-OF-SELECTION.
PERFORM populate_fieldcat1.
PERFORM populate_layout.
PERFORM get_eventlist.
PERFORM get_ekkosortinfo.
PERFORM ekkodisplay_onalv.
*& Form POPULATE_FIELDCAT1
FORM populate_fieldcat1.
wa_fieldcat-fieldname = 'EBELN'.
wa_fieldcat-seltext_l = text-004.
wa_fieldcat-no_zero = 'X'.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-fieldname = 'BSTYP'.
wa_fieldcat-seltext_l = text-005.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-fieldname = 'BSART'.
wa_fieldcat-seltext_l = text-006.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-fieldname = 'AEDAT'.
wa_fieldcat-seltext_l = text-007.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-fieldname = 'ERNAM'.
wa_fieldcat-seltext_l = text-008.
APPEND wa_fieldcat TO it_fieldcat.
ENDFORM. "POPULATE_FIELDCAT1
*& Form populate_fieldcat2
FORM populate_fieldcat2 .
CLEAR wa_fieldcat.
CLEAR it_fieldcat.
REFRESH it_fieldcat.
wa_fieldcat-fieldname = 'EBELN'.
wa_fieldcat-seltext_l = text-004.
wa_fieldcat-hotspot = 'X'.
wa_fieldcat-no_zero = 'X'.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-fieldname = 'EBELP'.
wa_fieldcat-seltext_l = text-009.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-fieldname = 'EMATN'.
wa_fieldcat-seltext_l = text-010.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-fieldname = 'MATKL'.
wa_fieldcat-seltext_l = text-011.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-fieldname = 'NETPR'.
wa_fieldcat-seltext_l = text-012.
wa_fieldcat-datatype = 'CURR'. "Obligatory to perform SUM
wa_fieldcat-do_sum = 'X'.
APPEND wa_fieldcat TO it_fieldcat.
ENDFORM. "populate_fieldcat2
*& Form GET_EVENTLIST
FORM get_eventlist.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = it_events[]
EXCEPTIONS
list_type_wrong = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
READ TABLE it_events WITH KEY name = slis_ev_pf_status_set INTO st_event.
IF sy-subrc EQ 0.
st_event-form = 'SET_PF_STATUS1'.
APPEND st_event TO it_events.
CLEAR st_event.
ENDIF.
READ TABLE it_events WITH KEY name = slis_ev_end_of_page INTO st_event.
IF sy-subrc EQ 0.
st_event-form = 'END_OF_PAGE'.
APPEND st_event TO it_events.
CLEAR st_event.
ENDIF.
ENDFORM. "GET_EVENTLIST
*& Form ekpodisplay_onalv
FORM ekpodisplay_onalv .
IF it_ekpo[] IS INITIAL.
MESSAGE 'NO DATA FOUND' TYPE 'I'.
ELSE.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'AT_USER_COMMAND1'
i_callback_top_of_page = 'TOP_OF_PAGE'
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME = I_STRUCTURE_NAME
I_BACKGROUND_ID = ' '
I_GRID_TITLE = I_GRID_TITLE
I_GRID_SETTINGS = I_GRID_SETTINGS
is_layout = wa_layout
it_fieldcat = it_fieldcat
IT_EXCLUDING = IT_EXCLUDING
IT_SPECIAL_GROUPS = IT_SPECIAL_GROUPS
it_sort = it_ekposortinfo[]
IT_FILTER = IT_FILTER
IS_SEL_HIDE = IS_SEL_HIDE
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT = IS_VARIANT
it_events = it_events
IT_EVENT_EXIT = IT_EVENT_EXIT
IS_PRINT = IS_PRINT
IS_REPREP_ID = IS_REPREP_ID
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS = IT_ALV_GRAPHICS
IT_HYPERLINK = IT_HYPERLINK
IT_ADD_FIELDCAT = IT_ADD_FIELDCAT
IT_EXCEPT_QINFO = IT_EXCEPT_QINFO
IR_SALV_FULLSCREEN_ADAPTER = IR_SALV_FULLSCREEN_ADAPTER
IMPORTING
E_EXIT_CAUSED_BY_CALLER = E_EXIT_CAUSED_BY_CALLER
ES_EXIT_CAUSED_BY_USER = ES_EXIT_CAUSED_BY_USER
TABLES
t_outtab = it_ekpo
EXCEPTIONS
program_error = 1
OTHERS = 2 .
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDFORM. "ekpodisplay_onalv
*& Form SET_PF_STATUS1
FORM set_pf_status1 USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'MENU' excluding rt_extab. "Copy from SALV .
ENDFORM. "SET_PF_STATUS1
*& Form SET_PF_STATUS
FORM set_pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'STANDARD' excluding rt_extab. "Copy from SALV .
ENDFORM. "SET_PF_STATUS
*& Form AT_user_command
FORM at_user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN '&IC1'.
IF rs_selfield-fieldname EQ 'EBELN'.
READ TABLE it_ekko INTO wa_ekko INDEX rs_selfield-tabindex.
SELECT ebeln ebelp ematn matkl netpr
FROM ekpo
INTO TABLE it_ekpo
WHERE ebeln EQ wa_ekko-ebeln.
PERFORM populate_fieldcat2.
PERFORM populate_layout2.
PERFORM get_ekposortinfo.
PERFORM ekpodisplay_onalv.
ELSE.
MESSAGE i020(z50871msg) WITH text-013.
ENDIF.
WHEN 'SE16'.
CALL TRANSACTION 'SE16'.
WHEN 'SE37'.
CALL TRANSACTION 'SE37'.
WHEN 'DISP'.
PERFORM get_popupdata.
PERFORM get_popupfcat.
PERFORM display_popup.
ENDCASE.
ENDFORM. "AT_user_command
*& Form TOP_OF_PAGE
FORM top_of_page.
REFRESH it_listheadr.
wa_listheadr-typ = 'H'.
wa_listheadr-info = text-001.
APPEND wa_listheadr TO it_listheadr.
CLEAR wa_listheadr.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_listheadr[]
i_logo = 'ENJOYSAP_LOGO'. "From OAER transaction
ENDFORM. "TOP_OF_PAGE
*& Form build_print_params
FORM build_print_params.
st_printparams-reserve_lines = '3'. "Lines reserved for footer
st_printparams-no_coverpage = 'X'.
ENDFORM. "build_print_params
*& Form end_of_page
FORM end_of_page.
REFRESH it_listheadr.
wa_listheadr-typ = 'H'.
wa_listheadr-info = sy-pagno.
APPEND wa_listheadr TO it_listheadr.
CLEAR wa_listheadr.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_listheadr[].
ENDFORM. "end_of_page
*& Form GET_EKPOSORTINFO
FORM get_ekposortinfo.
wa_ekposortinfo-up = 'X'.
wa_ekposortinfo-spos = 1.
wa_ekposortinfo-fieldname = 'EBELP'.
wa_ekposortinfo-tabname = 'EKPO'.
APPEND wa_ekposortinfo TO it_ekposortinfo.
CLEAR wa_ekposortinfo.
wa_ekposortinfo-up = 'X'.
wa_ekposortinfo-spos = 2.
wa_ekposortinfo-fieldname = 'EMATN'.
wa_ekposortinfo-tabname = 'EKPO'.
APPEND wa_ekposortinfo TO it_ekposortinfo.
CLEAR wa_ekposortinfo.
ENDFORM. "GET_EKPOSORTINFO
*& Form POPULATE_LAYOUT
FORM populate_layout.
wa_layout-colwidth_optimize = 'X'. "column width
wa_layout-zebra = 'X'.
wa_layout-no_hline = 'X'.
wa_layout-no_vline = 'X'.
wa_layout-cell_merge = 'X'.
wa_layout-box_fieldname = 'CHECK'.
wa_layout-box_tabname = 'IT_EKKO'.
wa_layout-window_titlebar = 'PURCHASE ORDER HEADER DETAILS'.
ENDFORM. "POPULATE_LAYOUT
*& Form get_EKKOsortinfo
FORM get_ekkosortinfo.
wa_sortinfo-up = 'X'.
wa_sortinfo-spos = 1.
wa_sortinfo-fieldname = 'EBELN'.
wa_sortinfo-tabname = 'EKKO'.
APPEND wa_sortinfo TO it_sortinfo.
CLEAR wa_sortinfo.
wa_sortinfo-up = 'X'.
wa_sortinfo-spos = 2.
wa_sortinfo-fieldname = 'BSTYP'.
wa_sortinfo-tabname = 'EKKO'.
APPEND wa_sortinfo TO it_sortinfo.
CLEAR wa_sortinfo.
wa_sortinfo-up = 'X'.
wa_sortinfo-spos = 3.
wa_sortinfo-fieldname = 'AEDAT'.
wa_sortinfo-tabname = 'EKKO'.
APPEND wa_sortinfo TO it_sortinfo.
CLEAR wa_sortinfo.
ENDFORM. "get_EKKOsortinfo
*& Form EKKODISPLAY_ONALV
FORM ekkodisplay_onalv.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
i_callback_pf_status_set = 'SET_PF_STATUS1'
i_callback_user_command = 'AT_USER_COMMAND'
is_layout = wa_layout
it_fieldcat = it_fieldcat
it_sort = it_sortinfo[]
it_filter = it_filter
it_events = it_events[]
TABLES
t_outtab = it_ekko[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. "EKKODISPLAY_ONALV
*& Form validate_ebeln
FORM validate_ebeln.
SELECT ebeln
FROM ekpo
INTO TABLE it_ebeln
WHERE ebeln IN so_ebeln.
IF sy-subrc NE 0.
MESSAGE e020(z50871msg) WITH text-014.
ENDIF.
ENDFORM. "validate_ebeln
*& Form populate_layout2
FORM populate_layout2 .
CLEAR wa_layout.
wa_layout-colwidth_optimize = 'X'. "column width
wa_layout-zebra = 'X'.
wa_layout-no_hline = 'X'.
wa_layout-no_vline = 'X'.
wa_layout-cell_merge = 'X'.
wa_layout-window_titlebar = 'PURCHASE ORDER DETAILS SECOND SCREEN'.
ENDFORM. " populate_layout2
*& Form GET_POPUPDATA
FORM get_popupdata .
LOOP AT it_ekko INTO wa_ekko WHERE check = 'X'.
READ TABLE it_eine INTO wa_eine WITH KEY ebeln = wa_ekko-ebeln.
IF sy-subrc NE 0.
MESSAGE i020(z50871msg) WITH text-015 wa_ekko-ebeln .
ELSE.
wa_popup-ebeln = wa_eine-ebeln.
wa_popup-ekorg = wa_eine-ekorg.
wa_popup-ekgrp = wa_eine-ekgrp.
APPEND wa_popup TO it_popup.
ENDIF.
ENDLOOP.
ENDFORM. " GET_POPUPDATA
*& Form GET_POPUPFCAT
FORM get_popupfcat .
CLEAR wa_fieldcat.
REFRESH it_fieldcat.
wa_fieldcat-fieldname = 'EBELN'.
wa_fieldcat-seltext_l = text-004.
wa_fieldcat-hotspot = 'X'.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-fieldname = 'EKORG'.
wa_fieldcat-seltext_l = text-016.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-fieldname = 'EKGRP'.
wa_fieldcat-seltext_l = text-017.
APPEND wa_fieldcat TO it_fieldcat.
ENDFORM. " GET_POPUPFCAT
*& Form DISPLAY_POPUP
FORM display_popup .
LOOP AT it_ekko INTO wa_ekko WHERE check EQ 'X'.
wa_check-check = wa_ekko-check.
APPEND wa_check TO it_check.
ENDLOOP.
IF it_check[] IS INITIAL.
MESSAGE i020(z50871msg) WITH text-018.
ENDIF.
IF NOT it_popup[] IS INITIAL.
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
i_title = text-003
i_allow_no_selection = 'X'
i_scroll_to_sel_line = 'X'
i_tabname = 'IT_POPUP'
it_fieldcat = it_fieldcat
i_callback_program = sy-repid
TABLES
t_outtab = it_popup
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
REFRESH it_check.
REFRESH it_popup.
ENDFORM. " DISPLAY_POPUP
*& Form get_ekko_data
FORM get_ekko_data .
SELECT ebeln bstyp bsart aedat ernam
FROM ekko
INTO CORRESPONDING FIELDS OF TABLE it_ekko
WHERE ebeln IN so_ebeln.
IF sy-subrc NE 0.
MESSAGE e020(z50871msg) WITH text-019.
ENDIF.
ENDFORM. " get_ekko_data
*& Form get_eine_data
FORM get_eine_data .
SELECT ebeln ekorg ekgrp
FROM eine
INTO TABLE it_eine
WHERE ebeln IN so_ebeln.
ENDFORM. " get_eine_data
*& Form at_user_command1
FORM at_user_command1 USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN 'SE16'.
CALL TRANSACTION 'SE16'.
WHEN 'SE37'.
CALL TRANSACTION 'SE37'.
ENDCASE.
regards,
pavan t. -
Can't get affine transforms do anything on an AttributedString
Hello,
I'm trying to transform individual characters in an AttributedString using the respective attribute, but nothing happens as though the transforms simply were ignored by the renderer. Other attributes like underline and strikethrough work fine, however. Am I missing something?
import java.awt.*;
import java.awt.font.*;
import java.text.*;
import java.applet.Applet;
import java.awt.geom.*;
public class test4 extends Applet {
public void paint(Graphics g) {
Graphics2D g2 = (Graphics2D) g;
String s = "abc";
Font f = new Font("Times New Roman", Font.PLAIN, 24);
AttributedString as = new AttributedString(s);
as.addAttribute(TextAttribute.FONT, f);
as.addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON, 0,
1);
as.addAttribute(TextAttribute.TRANSFORM, new TransformAttribute(
AffineTransform.getScaleInstance(0.5, 3)), 1,3);
g2.drawString(as.getIterator(new
TextAttribute[]{TextAttribute.TRANSFORM,TextAttribute.UNDERLINE}),30,40);
}Hi,
I'm not sure why the code you have does not work but a quick search for bugs revealed that there are some outstanding issues relating to AttributedString. It may be worth looking into a little more.
The following code seems to get the desired result if it helps:
String s = "abc";
Font f = new Font("Times New Roman", Font.PLAIN, 24);
AttributedString as = new AttributedString(s);
as.addAttribute(TextAttribute.FONT, f);
as.addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON, 0, 1);
AffineTransform transform = AffineTransform.getScaleInstance(0.5, 3);
f = f.deriveFont(transform);
as.addAttribute(TextAttribute.FONT, f, 1, 3);
g2.drawString(as.getIterator(), 30, 100); -
Affine transformation with vector data
I want to use the SDO_UTIL.AFFINETRANSFORMS method to transform vector data in a sql statement.
The example in the Spatial Developer's Guide is working so far. But if I change the SCALING parameter to TRUE I got a exception:
Fehler beim Start in Zeile 2 in Befehl:
SELECT SDO_UTIL.AFFINETRANSFORMS(
geometry => MDSYS.SDO_GEOMETRY(2003, NULL, NULL,
MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1),
MDSYS.SDO_ORDINATE_ARRAY(
1.5,0,
2.5,1,
1.5,2,
0.5,2,
0.5,0,
1.5,0)),
translation => 'FALSE',
tx => 0.0,
ty => 0.0,
tz => 0.0,
scaling => 'TRUE',
psc1 => NULL,
sx => 0.5,
sy => 0.5,
sz => null,
rotation => 'FALSE',
p1 => NULL,
line1 => NULL,
angle => 0.0,
dir => 0,
shearing => 'FALSE',
shxy => 0.0,
shyx => 0.0,
shxz => 0.0,
shzx => 0.0,
shyz => 0.0,
shzy => 0.0,
reflection => 'FALSE',
pref => NULL,
lineR => MDSYS.SDO_GEOMETRY(2002,0,NULL,
MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1),
MDSYS.SDO_ORDINATE_ARRAY(2.5,0.0,2.5,2.0)),
dirR => 0,
planeR => 'FALSE',
n => NULL,
bigD => NULL
) FROM DUAL
Fehlerbericht:
SQL-Fehler: ORA-29532: Java call terminated by uncaught Java exception: java.lang.NullPointerException
ORA-06512: at "MDSYS.SDO_UTIL", line 265
29532. 00000 - "Java call terminated by uncaught Java exception: %s"
*Cause: A Java exception or error was signaled and could not be
resolved by the Java code.
*Action: Modify Java code, if this behavior is not intended.The methods TRANSLATION and REFLECTION are working - SCALING, ROTATION and SHEARING are not working.
I test it on Oracle 11.1.0.7 on Windows XP and Windows Server 2003 R2.
Maybe it's a similar problem which is described in Bug 9146920 on My Oracle Support.
Has anybody had a similar problem?
Regards,
CordHi,-
Please define psc1 instead of psc1 => NULL like:
psc1 =>MDSYS.SDO_GEOMETRY(2001, NULL, NULL,
MDSYS.SDO_ELEM_INFO_ARRAY(1,1,1),
MDSYS.SDO_ORDINATE_ARRAY(0,0)),if you want scaling with respect to origin.
Define psc1 like:
psc1 =>MDSYS.SDO_GEOMETRY(2001, NULL, NULL,
MDSYS.SDO_ELEM_INFO_ARRAY(1,1,1),
MDSYS.SDO_ORDINATE_ARRAY(0.6,0)),if you want scaling with respect to another point (i.e., point *(0.6, 0)* which is) on your geometry.
Please note that psc1 has to be on the geometry, and it can be any point
other than the vertices of your geometry.
Next, note also that you should _specify sz as zero even if you donot use it for 2D_ as you will see in the below examples.
Hope that this helps and please let us know if you have further problems.
I tried with (0,0) point for psc1 as follows:
SELECT SDO_UTIL.AFFINETRANSFORMS(
geometry => MDSYS.SDO_GEOMETRY(2003, NULL, NULL,
MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1),
MDSYS.SDO_ORDINATE_ARRAY(
1.5,0,
2.5,1,
1.5,2,
0.5,2,
0.5,0,
1.5,0)),
translation => 'FALSE',
tx => 0.0,
ty => 0.0,
tz => 0.0,
scaling => 'TRUE',
psc1 =>MDSYS.SDO_GEOMETRY(2001, NULL, NULL,
MDSYS.SDO_ELEM_INFO_ARRAY(1,1,1),
MDSYS.SDO_ORDINATE_ARRAY(0,0)),
sx => 0.5,
sy => 0.5,
sz => 0.0,
rotation => 'FALSE',
p1 => NULL,
line1 => NULL,
angle => 0.0,
dir => 0,
shearing => 'FALSE',
shxy => 0.0,
shyx => 0.0,
shxz => 0.0,
shzx => 0.0,
shyz => 0.0,
shzy => 0.0,
reflection => 'FALSE',
pref => NULL,
lineR => MDSYS.SDO_GEOMETRY(2002,0,NULL,
MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1),
MDSYS.SDO_ORDINATE_ARRAY(2.5,0.0,2.5,2.0)),
dirR => 0,
planeR => 'FALSE',
n => NULL,
bigD => NULL
) FROM DUAL;
SDO_UTIL.AFFINETRANSFORMS(GEOMETRY=>MDSYS.SDO_GEOMETRY(2003,NULL,NULL,MDSYS.SDO_
SDO_GEOMETRY(2003, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1),
SDO_ORDINATE_ARRAY(.75, 0, 1.25, .5, .75, 1, .25, 1, .25, 0, .75, 0))
With (0.6,0) point for psc1, you will get:
SELECT SDO_UTIL.AFFINETRANSFORMS(
geometry => MDSYS.SDO_GEOMETRY(2003, NULL, NULL,
MDSYS.SDO_ELEM_INFO_ARRAY(1,1003,1),
MDSYS.SDO_ORDINATE_ARRAY(
1.5,0,
2.5,1,
1.5,2,
0.5,2,
0.5,0,
1.5,0)),
translation => 'FALSE',
tx => 0.0,
ty => 0.0,
tz => 0.0,
scaling => 'TRUE',
psc1 =>MDSYS.SDO_GEOMETRY(2001, NULL, NULL,
MDSYS.SDO_ELEM_INFO_ARRAY(1,1,1),
MDSYS.SDO_ORDINATE_ARRAY(0.6,0)),
sx => 0.5,
sy => 0.5,
sz => 0.0,
rotation => 'FALSE',
p1 => NULL,
line1 => NULL,
angle => 0.0,
dir => 0,
shearing => 'FALSE',
shxy => 0.0,
shyx => 0.0,
shxz => 0.0,
shzx => 0.0,
shyz => 0.0,
shzy => 0.0,
reflection => 'FALSE',
pref => NULL,
lineR => MDSYS.SDO_GEOMETRY(2002,0,NULL,
MDSYS.SDO_ELEM_INFO_ARRAY(1,2,1),
MDSYS.SDO_ORDINATE_ARRAY(2.5,0.0,2.5,2.0)),
dirR => 0,
planeR => 'FALSE',
n => NULL,
bigD => NULL
) FROM DUAL;
SDO_UTIL.AFFINETRANSFORMS(GEOMETRY=>MDSYS.SDO_GEOMETRY(2003,NULL,NULL,MDSYS.SDO_
SDO_GEOMETRY(2003, NULL, NULL, SDO_ELEM_INFO_ARRAY(1, 1003, 1),
SDO_ORDINATE_ARRAY(1.05, 0, 1.55, .5, 1.05, 1, .55, 1, .55, 0, 1.05, 0))Best regards
baris -
Doing affine transformations that should transform nothing - what is wrong?
Hello,
I have a question about the transformation in Java2D. Please see this simple painting code:
double xShearFactor = 0.0;
double yShearFactor = 0.0;
double xTranslation = 0;
double yTranslation = 0;
double xScaleFactor = 1.0;
double yScaleFactor = 1.0;
g2d.shear( xShearFactor, yShearFactor );
g2d.scale( xScaleFactor, yScaleFactor );
g2d.translate( xTranslation, yTranslation );
g2d.fill( chartTagShape );
g2d.translate( -xTranslation, -yTranslation );
g2d.scale( 2.0 - xScaleFactor, 2.0 - yScaleFactor );
g2d.shear( 2.0 - xShearFactor, 2.0 - yShearFactor );What it should do is, the "g2d.fill(...)" operation should not be affected because all the transformation values are non-modifying. The transformation method calls after the "g2d.fill(...)" should "reset" the transformation done before.
So, the code above should just "do nothing". But: all following painting operations are totally messed up. When I comment out both the "g2d.shear(...)" lines, the following painting operations are normal.
I would appreciate any help you can offer
Thanks a lot!Well this isnt really java, this is basic maths
ie first time roung you are effectively doing
g2d.shear( 0, 0 );
and second time round you are doing
g2d.shear( 2, 2 );
so yeh it should "mess" it up -
How to calculate the coordinate after implementing Affine Transformation?
Hi, guys!!
I am working on a Map makeing program, like MS Visio. Then, I need to put an icon on the working space. And the icon can be moved, rotated, and scaled, when mouse drags handles (8 small circles) around the icon. However, the problem is that after the icon is scaled or rotated using AffineTransform class, I do not know how to calculate the coordinate to paint the mouse handles.
Please give me your suggestions!! Thanks in advance!!Sure. The idea is that you track your translations, scaling, and rotation separate from the AffineTransform. That way, you know what you need to revert:
AffineTransform at = new AffineTransform();
at.translate(20, 20);
at.scale(2, 2);
at.rotate(45, 10, 10);
At this point, let's assume you want to translate again. First you have revert the rotation and the scale:
at.rotate(-45, 10, 10);
at.scale(1/2, 1/2);
at.translate(10, 10);
In order to do this, you need to track your scaling and rotation values when you change them. If this isn't feasible, it's certainly possible to derive the values from the AffineTransform, but that's a bit tougher.
Michael -
I am trying to scale the size of an image but it doesn t work
could you help me please?
thanks
public void paintComponent(Graphics g) { //called Whenever panel needs
Iterator<Shape> it = shapes.iterator(); //Iterate through Balls calling
if(Menu.geSelection()<=6 )
g.setColor(Menu.getColor());
g.fillRect(0, 0, this.getWidth(), this.getHeight());
else
try
bi = ImageIO.read(file);
//creating the AffineTransform instance
AffineTransform affineTransform = new AffineTransform();
affineTransform.scale(22, 22);
g.drawImage(bi, 0, 0, null);
catch (IOException ex)
Logger.getLogger(ShapePanel.class.getName()).log(Level.SEVERE, null, ex);
while (it.hasNext()) { //each one's paint method
it.next().paint(g);
}bi = ImageIO.read(file);
//creating the AffineTransform instance
AffineTransform affineTransform = new AffineTransform();
bi.createGraphics();
affineTransform.scale(22, 22);
Graphics2D g2 = (Graphics2D) g;
g2.setTransform(affineTransform);
g.drawImage(bi, 40, 0, null); -
Event to use for Creation of a Check box on Warehouse master Form
Hi experts
I have created one check box on Warehouse Master form in AfterMENUClick Event. It works fine if I open the form on Menuclick . But If I open the Warehouse master form by Link button from any document, it does not show the check box. I also want to deactive the checkbox if once it checked. So, I do some coding in Data_Load event. It also works fine If I open the form by Menu click. But if I open the form by Link button it gives error " Invalid Item Id ".
So I want to know which event I should use to create the check box and which Event I Should use to Deactive the Check boxThanks Nagy for quick reply
I use the following code for creation of check box
<B1Listener(BoEventTypes.et_FORM_LOAD, False, New String() {"62"})> _
Public Overridable Sub OnAfterFormLoad(ByVal pVal As ItemEvent)
Dim ActionSuccess As Boolean = pVal.ActionSuccess
Dim form As Form = B1Connections.theAppl.Forms.Item(pVal.FormUID)
'ADD YOUR ACTION CODE HERE ...
Dim oForm As Form
Dim oMatrix As Matrix
Dim oItem As Item
Dim sysItem As Item
Dim BinCheck As CheckBox
Dim BinLabel As StaticText
Dim cmbBinCode As ComboBox
oForm = B1Connections.theAppl.Forms.ActiveForm
oForm.PaneLevel = 1
sysItem = oForm.Items.Item("2000002010") 'Excisable check box
oItem = oForm.Items.Add("BinChk", BoFormItemTypes.it_CHECK_BOX)
oItem.Left = sysItem.Left
oItem.Top = sysItem.Top + 20
BinCheck = oItem.Specific
BinCheck.Caption = "Bin Enabled"
BinCheck.DataBind.SetBound(True, "OWHS", "U_BinEnabled")
End Sub
It gives error on sysItem = oForm.Items.Item("2000002010") line Invalid Item Id
Plz check and tell the problem
Regards
Gorge -
Hi,
I have two problems regarding the dynamic box in java 3D:
1. how can I change size of the box during runtime? I want to draw a 3D bar chart like using box.
2. what is "Exception in thread "AWT-EventQueue-0" javax.media.j3d.BadTransformException: TransformGroup: non-affine transform"? I encountered this when using a percentage (a value / max value) to create a box.
below is my portion of code:
I have methods to set the propValue, maxValue, sideX and sideZ. I update these values using setter to change the Box, but I think I need to have one more method to update the box (calling createSceneGraph() ).
protected Group createSceneGraph()
visualRep = new BranchGroup();
float scaleFact = 1.0f; // scaleFact is used only for debugging purpose
float percentage = propValue / maxValue;
// I want to move the height to half of its height, they are different for each
// module since the height is affected by the percentage. But, every time I add
// percentage to the "itsHeight", it gives me error : Exception in thread
// "AWT-EventQueue-0" javax.media.j3d.BadTransformException:
// TransformGroup: non-affine transform
//float itsHeight = ( HEIGHT * percentage );
float itsHeight = ( HEIGHT );
// 1. Create the box
Box vis = new Box(
sideX * percentage * scaleFact,
itsHeight * scaleFact,
sideZ * percentage * scaleFact,
Box.GENERATE_NORMALS,
LCMPlanning.getInstance().getAppearance( this.getModule(),
LCMPhysical.DEFAULT_WALL ) );
vis.setCapability( Box.ENABLE_APPEARANCE_MODIFY );
// 2. Move the first box to the top of the ground level
Transform3D t3d = new Transform3D();
t3d.setTranslation( new Vector3f( 0.0f, itsHeight, 0.0f ) );
TransformGroup tg = new TransformGroup( t3d );
tg.addChild( vis );
tg.setCapability( TransformGroup.ALLOW_TRANSFORM_WRITE );
visualRep.addChild( tg );
return visualRep;
thanks a lot.
DanielHi,
Nobody answered your questions so far? Here's my take.
Changing the size of the box at runtime:
The easiest way to do that is to scale the transform using transformName.set(double scale) or transformName.setScale(double scale).
Non-affine transform error:
I get this error every once in a while. With me it happens when I try to assign a value of infinity or a NaN (not a number) to one of the params in the transform. I suggest printing the params you are using to create the box.
sideX * percentage * scaleFact,
itsHeight * scaleFact,
sideZ * percentage * scaleFact,
You may not be specifying what you think you are specifying.
Hope that helps. -
Automatic PO creation from PR with no master data
Dear gurus,
Is it possible to run ME59- Auto PO creation from approved PR with no master data/source assigned/PIR? Assuming user create adhoc PR.
Is it possible to run this process successfully if i didn't meet on the criteria below? let say no.1 is not checked?
1.Material Master purchasing view, check automatic PO check box.
2. Vendor Master purchasing view, check automatic PO check box.
3. Maintain Source list for Vendor and Material (transaction ME01) and also see validity period.
4. Maintain Purchase Info Record (transaction ME11), check info record category (must be standard or pipeline or subcontracting)
5. Create a Purchase Requisition ( transaction ME51N), during creation select check box of Source Determination.
6. Use transaction ME59 and execute for purchase requisition for vendor, you will be able to create automatic PO.
Thanks in advance.Hi,
yes all point should be checked
check following link
[http://www.sap-img.com/materials/steps-to-create-auto-po.htm]
Regards
Kailas Ugale -
Idoc generated for creation of sales order
Hi all,
In my project we have two different boxes-I and B.When a purchase order is created in I Box an idoc is triggered which goes to the B Box and creates a sales order.I want to do some changes in E1EDKA1 and E1EDPA1 segment in the idoc in I Box so that when it goes to B Box it will show the changed one.For example if there is EN in E1EDKA1 and E1EDPA1 segment then in B Box it will be appeared as ZA.I need to know that for this change I have to do the coding changes in which USER EXIT?The function module which is triggered during the sales order creation in B Box is IDOC_INPUT_ORDERS.
Thanks in advance
RajHi Raj,
go to se37..
enter the function module and after each segement append there is a customer exit and badi is available to add you custom code..
in the user exit read the segement and modify the segemnt data..
these are the below exits available for the Orders
ORDCHG I VEDB0001 Sales Ord. Change
ORDERS I VEDA0001 Sales Orders "this is the user exit for you to code..
ORDRSP I MM06E001 Order Response for
Purchase Order
search-- CALL CUSTOMER-FUNCTION '011'--Fm--EXIT_SAPLVEDA_011--include--INCLUDE ZXVEDU13.
Regards,
Prabhudas -
BPM Collect Scenario errors at transform stage
The BPM Collect scenario is using a Fork within a Block.
Branch 1 - Loop Receive Append Container Endloop
Branch 2 - Receive step of triggerIdoc
End of Block
Transform step - multiline container of XML documents to one XML document
Send step
BPM Errors at Transform step with JCo mapping not available.
Whilst BPM in Error (Workflow in Error) more messages being received but never processed as the RECEIVE event is "lost" for these messages.
We are looking at redesigning the BPM to reduce the likelihood of this transform error.
In the meantime was looking at ways to Alert the administrator straight away to the error. As we have a workaround to get the process going and to pick up the stranded messages. So have started setting up the ALERT categories as described in How to Guide, for Adapter and Interface. Will this work?
Also in the Transform step there is a box (system exception) but I can't enter anything in. Is there a way to do this if the Alert category doesn't report an error in the BPM. OR do I have to add the Transform step into a Block of its own?
Advice gratefully received if we come up with a working solution will post it out here. Have spent a large amount of time reading posts and blogs on here but have not got a clear picture yet of what is best to do.
thanks,> Whilst BPM in Error (Workflow in Error) more messages
> being received but never processed as the RECEIVE
> event is "lost" for these messages.
This should give you an issue called Parked Messages. The best way to deal with this is to actually define a Local Correlation. In the Block Step properties, you will have an option, Use Correlation --> Give the name of the Correlation . This will make sure that when there is an error, the Correlation become inactiva and a new BPM instance is created.
> In the meantime was looking at ways to Alert the
> administrator straight away to the error. As we have
> a workaround to get the process going and to pick up
> the stranded messages. So have started setting up the
> ALERT categories as described in How to Guide, for
> Adapter and Interface. Will this work?
Not sure if this will work. The issue is that the messages are passed to the IE already and will be in wait step waiting for an active BPM 's receive step How will another interface pick up this message?
> Also in the Transform step there is a box (system
> exception) but I can't enter anything in. Is there a
> way to do this if the Alert category doesn't report
> an error in the BPM. OR do I have to add the
> Transform step into a Block of its own?
This is what is called exception handler. Defined a Exception handler for the Block. Right Click block, insert Exception Branch, give name of the Hanler and then you can select this in the Transformation Step's System Error. This is like Try - Catch of Java.
Regards
Bhavesh -
Why is the rotate point moving when using Transform Again on a triangle?
I am trying to create a pattern that I have created in previous itterations of Illustrator. In CC when I create a triangle (either via Star, Poly, or Pen tool) and then try to rotate it via Transform Each > Transform again, the rotation point moves according to what the bounding box would be if I reset it, rather than staying in one (original) spot relative to the actual bounding box and triangle. I cannot find any settings that would be affecting the rotate point in this way. I am pretty confident that I am using the same procedure now that I did in older versions of Illustrator. Perhaps I am using the wrong procedure.
Naturally, if you are rotating something around its center you should expect that it would end up create a circular pattern. It is more of a square with concave sides. The red is a perfect circle that I grouped to the triangle to demonstrate the rotate points movement. It is located in the exact center according to the align tools.With the rotate tool, option click to set you point of rotation.
You also may want to look into the transform effect, theres is a box with 9 points for your anchor points you can try. You can also add an object filled with none, group this with your object, and transform the group, to get offset results with the transform effect.
Maybe you are looking for
-
ITunes No Longer Plays Music after upgrade to 10.7.3
Since upgrading to Lion 10.7.3, music has stopped playing in iTunes. I double click on a tune, and it looks like it is playing but there is no sound and the little progress bar doesn't advance across the screen. I can play the tunes in the latest v
-
Shuffle songs position doesn't work
My iPod doesn't work on the shuffle position, just play songs in order. Anyone could help me???
-
Overflow field conversion type P
The MM is a problem with the transaction MB1C. When she tells convert to KG / TN is the following message: An overflow field during the conversion. Possibly, the User defined parameters transfer very small. (This is probably the case of fields type P
-
Hi i want a simple dynamic alv code .
-
How Do I make a simple newspaper ad in Indesign?
I'm new to Indesign and really need some help. I'm pretty good at Photoshop but never used Indesign. Do anyone know any tutorials on how to create proffesional ads? Any kind of info would be great. Thanks.