>
unit U_add_ray; {écrit par denis bertin le 18.6.2012 les droits d'auteur} {Trois dialogues de réglage de la rotation d'un bitmap,
{Tu auras beau dire c'est encore denis bertin qui l'a écrit} {Un logiciel écrit exclusivement écrit par son auteur le 19.6.2012} {avec un ascenseur pour positionner la rotation en degré by denis bertin} {avec une couleur de fond définit par denis le 20.6.2012 by denis bertin} {Improve and amélioré par denis bertin pour créer des pixels plus important le 20.6.2012} interface uses windows,Whelp,WBase,Messages,wformebm,c_color, graphics,wregles,dialbase,lec_color,g_base,Dialombre; type TRotation_visu = class(Dialombre.TCadre_button) procedure setupwindow; override; procedure wmPaint(var Msg: TMessage); override; procedure wmLBUTTONDOWN(var Msg: TMessage); override; procedure wmLBUTTONUP(var Msg: TMessage); override; procedure wmMOUSEMOVE(var Msg: TMessage); override; procedure Set_Angle(un_angle:integer); public angle:integer; captured:boolean; end; Tcolor_button_interface = class(c_color.Tcolor_degra_button) function get_color:longint; override; procedure WMLBUTTONDOWN(var Msg: TMessage); override; procedure WMRBUTTONUP(var Msg: TMessage); override; procedure WMCommand(var Msg: TMessage); override; end; Tcolor_button = class(c_color.Tcolor_degra_button) function get_color:longint; override; end; TCenter_button = class(c_color.Tcolor_degra_button) function get_color:longint; override; end; TCentre_On_Plot = class(Whelp.ThelpDialog) constructor Create(AParent:WBase.TWindow); procedure Setupwindow; override; procedure WMCommand(var Msg: TMessage); override; procedure wmset_painture_control(var Msg: TMessage); override; private radio_mini_guide:Wbase.tradiobutton; radio_Placer_des_guides:Wbase.tradiobutton; radio_placer_des_lignes:Wbase.tradiobutton; check_en_couleur:Wbase.TCheckBox; check_multicouleur:Wbase.TCheckBox; color:U_add_ray.TCenter_button; end; TRay_Bitmap_Dialog = class(Whelp.ThelpDialog) constructor Create(AParent:WBase.TWindow; forme:wformebm.Tforme_TBitMap); procedure Setupwindow; override; procedure WMHSCROLL(var Msg: TMessage); override; procedure Ok; override; procedure wmset_painture_control(var Msg: TMessage); override; public scroll_vertical,scroll_horizontal:WBase.TScrollbar; static_vertical,static_horizontal:Wbase.Tstatic; color:Tcolor_button; check_inversion_de_la_couleur:wbase.Tcheckbox; num_edit_size_pixel:dialbase.TNumEdit_plus_moins; {ecrit par denis bertin} private une_forme:wformebm.Tforme_TBitMap; end; {TRay_Bitmap_Dialog} TRotation_d_image = class(Whelp.ThelpDialog) constructor Create(AParent:WBase.TWindow; forme:wformebm.Tforme_TBitMap; une_colec_guide_anglulaire:wregles.Tcollec_guide); procedure wmclose(var Msg: TMessage); override; procedure Setupwindow; override; procedure WMCommand(var Msg: TMessage); override; procedure Faire_une_rotation(With_angle_radian:real); procedure WMHSCROLL(var Msg: TMessage); override; procedure wmset_painture_control(var Msg: TMessage); override; procedure wmnum_edit_change(var msg:TMessage); override; procedure Affecter_l_angle; procedure Affecter_le_nom_de_la_couleur; procedure ok; override; public scroll_rotation:WBase.TScrollbar; static_angle_degree:Wbase.Tstatic; static_nom_de_la_couleur:Wbase.Tstatic; static_html_color:Wbase.Tstatic; check_placer_des_guides_angulaires:Wbase.Tcheckbox; check_Augmenter_la_taille_de_l_image:Wbase.Tcheckbox; check_Adapter_la_taille_du_cadre:Wbase.Tcheckbox; check_Au_lieu_d_utiliser_la_couleur_de_fond:Wbase.Tcheckbox; check_ajouter_un_gradian_radial:Wbase.Tcheckbox; check_ajouter_un_gradian_lineaire:Wbase.Tcheckbox; num_edit_the_modulation:dialbase.TNumEdit_plus_moins; inter_color:Tcolor_button_interface; color:Tcolor_button; rotation:U_add_ray.TRotation_visu; {denis bertin} private une_forme:wformebm.Tforme_TBitMap; bitmap_before_rotation:graphics.tbitmap; colec_guide_anglulaire:wregles.Tcollec_guide; ancien_rectangle:trect; col_color:lec_color.T_Col_Named; {pour stocker les noms des couleurs-c'db} end; {Idée d'un photographe recontrer à la friche d'Emmetrop le 24.6.2012 by denis} TAjuster_avec_seuil = class(Whelp.ThelpDialog) constructor Create(AParent:WBase.TWindow; forme:wformebm.Tforme_TBitMap); procedure Setupwindow; override; procedure Afficher_le_pourcentage; procedure WMHSCROLL(var Msg: TMessage); override; procedure wmnum_edit_change(var msg:TMessage); override; procedure WMCommand(var Msg: TMessage); override; procedure Effectuer_le_calcul; public scroll_seuil:WBase.TScrollbar; static_pourcentage:Wbase.Tstatic; num_edit_coefficient:dialbase.TNumEdit_plus_moins; {ecrit par denis bertin} radio_plus_grand:Wbase.tradiobutton; radio_plus_petit:Wbase.tradiobutton; check_limitation_de_la_lumiere:Wbase.TCheckBox; private une_forme:wformebm.Tforme_TBitMap; bitmap_before_rotation:graphics.tbitmap; end; {TAjuster_avec_seuil} type Trec_transfert_centre_on_plot = record radio_mini_guide:bool; radio_Placer_des_guides:bool; radio_placer_des_lignes:bool; check_en_couleur:bool; check_multicouleur:bool; end; var rec_transfert_centre_on_plot : Trec_transfert_centre_on_plot; var k_color_choose_to_cross_ray : tcolorref = g_base.rgb_blanc; k_color_choose_center_ray : tcolorref = g_base.rgb_rouge; k_color_interface : tcolorref = g_base.rgb_blanc; implementation uses my_math,hls_rvb,wutil,sysutils,utile,u_object,deformat,u_file_select,uregedit,wmenuk,z_open_file, U_fast_bitmap,U_chercher_mes_ato,haide,k_dll; {Celui qui l'a écrit en france c'est denis} const id_reset_the_color_for_all_I_love = 123456; function Tcolor_button_interface.get_color:longint; begin result:=k_color_interface; end; procedure Tcolor_button_interface.WMCommand(var Msg: TMessage); begin inherited WMCommand(Msg); if msg.wparam=id_reset_the_color_for_all_I_love then begin k_color_interface:=g_base.RGB_Blanc; invalidaterect(self.hwindow,Nil,false); UpdateWIndow(self.hwindow); invalidaterect(TRotation_d_image(parent).rotation.hwindow,Nil,false); UpdateWIndow(TRotation_d_image(parent).rotation.hwindow); uregedit.RegWritePrivateProfileInt(wmenuk.circle,z_open_file.string_je_suis_bien_d_accord_avec_mon_interface,k_color_interface); end; end; {Tcolor_button_interface.WMCommand} procedure Tcolor_button_interface.WMRBUTTONUP(var Msg: TMessage); var un_point_menu_popup:tpoint; another_trackmenu:hmenu; begin another_trackmenu:=Createpopupmenu; Appendmenu(another_trackmenu,MF_STRING,id_reset_the_color_for_all_I_love,z_open_file.string_reset); GetCursorPos(un_point_menu_popup); TrackPopupMenu(another_trackmenu,0,un_point_menu_popup.x,un_point_menu_popup.y,0,hwindow,nil); end; procedure Tcolor_button_interface.wmLBUTTONDOWN(var Msg: TMessage); begin if u_file_select.Affiche_le_dialogue_des_couleur_window(self.hwindow,k_color_interface) then begin invalidaterect(self.hwindow,Nil,false); UpdateWIndow(self.hwindow); invalidaterect(TRotation_d_image(parent).rotation.hwindow,Nil,false); UpdateWIndow(TRotation_d_image(parent).rotation.hwindow); uregedit.RegWritePrivateProfileInt(wmenuk.circle,z_open_file.string_je_suis_bien_d_accord_avec_mon_interface,k_color_interface); end; end; function Tcolor_button.get_color:longint; begin result:=k_color_choose_to_cross_ray; end; function TCenter_button.get_color:longint; begin result:=k_color_choose_center_ray; end; procedure TRotation_visu.SetupWindow; begin inherited setupwindow; captured:=false; end; procedure TRotation_visu.Set_Angle(un_angle:integer); begin self.angle:=un_angle; invalidaterect(self.hwindow,Nil,false); UpdateWIndow(self.hwindow); end; procedure TRotation_visu.wmLBUTTONDOWN(var Msg: TMessage); begin setcapture(self.hwindow); captured:=true; end; procedure TRotation_visu.wmLBUTTONUP(var Msg: TMessage); begin ReleaseCapture; captured:=false; end; procedure TRotation_visu.wmMOUSEMOVE(var Msg: TMessage); var arect:trect; point_souris:tpoint; begin if not captured then exit; point_souris.x:=Smallint(loword(msg.lparam)); point_souris.y:=Smallint(hiword(msg.lparam)); getclientrect(hwindow,arect); self.angle:=round(utile.angle_degree( arect.Right div 2,arect.bottom div 2,point_souris.x,point_souris.y)); invalidaterect(self.hwindow,Nil,false); UpdateWindow(self.hwindow); with TRotation_d_image(parent) do begin scroll_rotation.SetPosition(self.angle); Affecter_l_angle; Faire_une_rotation(self.angle*utile.pisur180); end; postmessage(TRotation_d_image(parent).hwindow,wm_command,0,0); end; procedure TRotation_visu.wmPaint(var Msg: TMessage); var i,maximum:integer;paintStruct:TPaintStruct; paintdc:hdc; arect:trect; apencil:hpen; begin paintdc:=beginpaint(hwindow,paintStruct); getclientrect(hwindow,arect); inherited Paint_rect(paintdc); maximum:=utile.idistance(arect.Right div 2,arect.bottom div 2,arect.Right,arect.bottom)-15; for i:=maximum downto 0 do begin if k_color_interface=g_base.rgb_blanc then apencil:=selectobject(paintdc,createpen(PS_Solid,3, hls_rvb.Get_HLS_RGB(360*i/maximum,0.75,1))) else apencil:=selectobject(paintdc,createpen(PS_Solid,3, deformat.IN_Between_longint_Exp(g_base.RGB_Blanc,k_color_interface,maximum-i,maximum))); ellipse(paintdc,arect.Right div 2 - i,arect.bottom div 2 - i, arect.Right div 2+i,arect.bottom div 2+i); deleteobject(selectobject(paintdc,apencil)); end; moveto(paintdc,arect.Right div 2,arect.bottom div 2); lineto(paintdc, arect.Right div 2+round(cos(self.angle*pi/180)*(arect.Right div 2-5)), arect.bottom div 2-round(sin(self.angle*pi/180)*(arect.Right div 2-5))); endpaint(hwindow,paintStruct); end; Constructor TCentre_On_Plot.Create(AParent:WBase.TWindow); const dial_Centre_On_Plot = 1794; id_radio_mini_guide = 1000; id_radio_Placer_des_guides = 1001; id_radio_placer_des_lignes = 1004; id_check_en_couleur = 1002; id_check_multicouleur = 1003; id_couleur_bouton = 1005; begin inherited Create (AParent,dial_Centre_On_Plot,0); self.TransferBuffer:=@rec_transfert_centre_on_plot; self.radio_mini_guide:=Wbase.tradiobutton.create(self,id_radio_mini_guide,0); self.radio_Placer_des_guides:=Wbase.tradiobutton.create(self,id_radio_Placer_des_guides,0); self.radio_placer_des_lignes:=Wbase.tradiobutton.create(self,id_radio_placer_des_lignes,0); self.check_en_couleur:=Wbase.TCheckBox.create(self,id_check_en_couleur,0); self.check_multicouleur:=Wbase.TCheckBox.create(self,id_check_multicouleur,0); self.color:=U_add_ray.TCenter_button.Create(self,id_couleur_bouton,0); end; procedure TCentre_On_Plot.wmset_painture_control(var Msg: TMessage); begin U_add_ray.k_color_choose_center_ray:=msg.lparam; end; procedure TCentre_On_Plot.Setupwindow; begin inherited Setupwindow; postmessage(self.hwindow,wm_command,0,0); end; procedure TCentre_On_Plot.WMCommand(var Msg: TMessage); const id_check_en_couleur = 1002; id_check_multicouleur = 1003; begin inherited WMCommand(Msg); Case msg.wparam of id_check_en_couleur: self.check_multicouleur.Uncheck; id_check_multicouleur: self.check_en_couleur.Uncheck; end; {case} if self.check_multicouleur.GetCheck=bf_checked then self.color.show(sw_hide) else self.color.show(sw_show); end; {TCentre_On_Plot.WMCommand} constructor TRay_Bitmap_Dialog.Create(AParent:WBase.TWindow; forme:wformebm.Tforme_TBitMap); const dial_id_Ray_Bitmap = 1788; kid_pixel_size = 1004; begin inherited Create (AParent,dial_id_Ray_Bitmap,0); self.scroll_vertical:=WBase.TScrollbar.Create(self,1000,0); self.scroll_horizontal:=WBase.TScrollbar.Create(self,1001,0); self.static_vertical:=Wbase.Tstatic.create(self,1100,0); self.static_horizontal:=Wbase.Tstatic.create(self,1101,0); self.color:=Tcolor_button.create(self,1002,0); self.check_inversion_de_la_couleur:=wbase.Tcheckbox.create(self,1003,0); self.num_edit_size_pixel:=dialbase.TNumEdit_plus_moins.Create(self,kid_pixel_size,3,1,24,0); self.une_forme:=forme; end; procedure TRay_Bitmap_Dialog.Setupwindow; var apc:pc100; begin inherited Setupwindow; self.scroll_vertical.SetRange(1,100); self.scroll_vertical.SetPosition(10); self.scroll_horizontal.SetRange(1,100); self.scroll_horizontal.SetPosition(10); inttopchar(scroll_vertical.GetPosition,apc); static_vertical.SetText(apc); inttopchar(scroll_horizontal.GetPosition,apc); static_horizontal.SetText(apc); self.num_edit_size_pixel.Set_num_value(1); end; procedure TRay_Bitmap_Dialog.WMHSCROLL(var Msg: TMessage); var hwndScrollBar:hwnd; apc:pc100; begin inherited WMHSCROLL(Msg); hwndScrollBar:=msg.LParam; if hwndScrollBar=scroll_vertical.hwindow then begin inttopchar(scroll_vertical.GetPosition,apc); static_vertical.SetText(apc); end else if hwndScrollBar=scroll_horizontal.hwindow then begin inttopchar(scroll_horizontal.GetPosition,apc); static_horizontal.SetText(apc); end; end; {TRay_Bitmap_Dialog.WMHSCROLL} procedure TRay_Bitmap_Dialog.Ok; var i,j,k,l:integer; so_this_variable_is_acced_frequently:integer; {in the cache in the stack segment} un_acces_simplifier_a_la_variable_check:boolean; rapide_ce_bitmap:U_fast_bitmap.TFastBitmap2; old_cursor:hcursor; begin old_cursor:=Setcursor(haide.G_Cursor.wait_cursor); rapide_ce_bitmap.Copy(self.une_forme.BitMap); so_this_variable_is_acced_frequently:=self.num_edit_size_pixel.Get_num_value; un_acces_simplifier_a_la_variable_check:=self.check_inversion_de_la_couleur.GetCheck=bf_checked; for i:=0 to scroll_vertical.GetPosition do begin if scroll_vertical.GetPosition<>0 then begin haide.Show_horloge_curseur(100*i/scroll_vertical.GetPosition); U_chercher_mes_ato.Affiche_une_ligne_de_progression(round(100*i/scroll_vertical.GetPosition)); end; for j:=0 to self.une_forme.BitMap.Height do begin if so_this_variable_is_acced_frequently=1 then begin if un_acces_simplifier_a_la_variable_check then rapide_ce_bitmap.SetPixel(round(self.une_forme.BitMap.Width*i/scroll_vertical.GetPosition),j, rapide_ce_bitmap.GetPixel(round(self.une_forme.BitMap.Width*i/scroll_vertical.GetPosition),j) xor $FFFFFF) else rapide_ce_bitmap.SetPixel(round(self.une_forme.BitMap.Width*i/scroll_vertical.GetPosition),j,k_color_choose_to_cross_ray); end else begin for l:=1 to so_this_variable_is_acced_frequently do for k:=1 to so_this_variable_is_acced_frequently do begin if un_acces_simplifier_a_la_variable_check then rapide_ce_bitmap.SetPixel(round(self.une_forme.BitMap.Width*i/scroll_vertical.GetPosition)+k,j+l, rapide_ce_bitmap.GetPixel(round(self.une_forme.BitMap.Width*i/scroll_vertical.GetPosition)+k,j+l) xor $FFFFFF) else rapide_ce_bitmap.SetPixel(round(self.une_forme.BitMap.Width*i/scroll_vertical.GetPosition)+k,j+l,k_color_choose_to_cross_ray); end; end; end; end; {for i} for i:=0 to self.une_forme.BitMap.width do begin if scroll_vertical.GetPosition<>0 then begin haide.Show_horloge_curseur(100*i/self.une_forme.BitMap.width); U_chercher_mes_ato.Affiche_une_ligne_de_progression(round(100*i/self.une_forme.BitMap.width)); end; for j:=0 to scroll_horizontal.GetPosition do begin if so_this_variable_is_acced_frequently=1 then begin if un_acces_simplifier_a_la_variable_check then rapide_ce_bitmap.SetPixel(i,round(self.une_forme.BitMap.Height*j/scroll_horizontal.GetPosition), rapide_ce_bitmap.GetPixel(i,round(self.une_forme.BitMap.Height*j/scroll_horizontal.GetPosition)) xor $FFFFFF) else self.une_forme.BitMap.canvas.Pixels[i,round(self.une_forme.BitMap.Height*j/scroll_horizontal.GetPosition)]:=k_color_choose_to_cross_ray; end else begin for l:=1 to so_this_variable_is_acced_frequently do for k:=1 to so_this_variable_is_acced_frequently do begin if un_acces_simplifier_a_la_variable_check then rapide_ce_bitmap.Setpixel(i+k,round(self.une_forme.BitMap.Height*j/scroll_horizontal.GetPosition)+l, rapide_ce_bitmap.GetPixel(i+k,round(self.une_forme.BitMap.Height*j/scroll_horizontal.GetPosition)+l) xor $FFFFFF) else rapide_ce_bitmap.SetPixel(i+k,round(self.une_forme.BitMap.Height*j/scroll_horizontal.GetPosition)+l,k_color_choose_to_cross_ray); end; end; end; end; {for i} Setcursor(old_cursor); end; {TRay_Bitmap_Dialog.Ok} procedure TRay_Bitmap_Dialog.wmset_painture_control(var Msg: TMessage); begin U_add_ray.k_color_choose_to_cross_ray:=msg.lparam; end; Constructor TRotation_d_image.Create(AParent:WBase.TWindow; forme:wformebm.Tforme_TBitMap; une_colec_guide_anglulaire:wregles.Tcollec_guide); const id_scroll_rotation = 1000; id_static_angle_degree = 1001; id_check_placer_des_guides = 1003; dial_id_rotation_parametrique = 1789; id_static_nom_de_la_couleur = 2000; id_static_html_color = 2001; id_check_Augmenter_la_taille_de_l_image = 1006; id_check_Adapter_la_taille_du_cadre = 1007; id_Au_lieu_d_utiliser_la_couleur_de_fond = 1008; id_check_ajouter_un_gradian_radial = 1010; id_check_ajouter_un_gradian_lineaire = 1011; id_num_edit_the_modulation = 1012; id_rotation = 500; begin inherited Create(AParent,dial_id_rotation_parametrique,haide.HELPId_effectuer_une_rotation); self.colec_guide_anglulaire:=une_colec_guide_anglulaire; self.scroll_rotation:=WBase.TScrollbar.Create(self,id_scroll_rotation,0);; self.static_angle_degree:=Wbase.Tstatic.create(self,id_static_angle_degree,0); self.static_nom_de_la_couleur:=Wbase.Tstatic.create(self,id_static_nom_de_la_couleur,0); self.static_html_color:=Wbase.Tstatic.create(self,id_static_html_color,0); self.check_placer_des_guides_angulaires:=Wbase.Tcheckbox.create(self,id_check_placer_des_guides,0); self.check_Augmenter_la_taille_de_l_image:=Wbase.Tcheckbox.create(self,id_check_Augmenter_la_taille_de_l_image,0); self.check_Adapter_la_taille_du_cadre:=Wbase.Tcheckbox.create(self,id_check_Adapter_la_taille_du_cadre,0); self.check_Au_lieu_d_utiliser_la_couleur_de_fond:=Wbase.Tcheckbox.create(self,id_Au_lieu_d_utiliser_la_couleur_de_fond,0); self.check_ajouter_un_gradian_radial:=Wbase.Tcheckbox.create(self,id_check_ajouter_un_gradian_radial,0); self.check_ajouter_un_gradian_lineaire:=Wbase.Tcheckbox.create(self,id_check_ajouter_un_gradian_lineaire,0); self.num_edit_the_modulation:=dialbase.TNumEdit_plus_moins.create(self,id_num_edit_the_modulation,4,0,1000,0); self.num_edit_the_modulation.Enable_Previent_ton_Parent(true); self.rotation:=U_add_ray.TRotation_visu.create(self,id_rotation,0); self.bitmap_before_rotation:=graphics.tbitmap.create; self.bitmap_before_rotation.assign(forme.BitMap); self.inter_color:=Tcolor_button_interface.create(self,1009,0); self.color:=Tcolor_button.create(self,1002,0); self.une_forme:=forme; self.ancien_rectangle:=forme.rect; Self.col_color:=lec_color.T_Col_Named.Create; if not self.col_color.Lecture_fichier_couleur then Self.col_color:=nil; end; procedure TRotation_d_image.wmclose(var Msg: TMessage); begin if Self.col_color<>nil then begin {Libération des ressources} Self.col_color.Free; Self.col_color:=nil; end; inherited wmclose(Msg); end; procedure TRotation_d_image.Setupwindow; var apc:wutil.pc100; begin inherited Setupwindow; self.scroll_rotation.SetRange(0,360); self.scroll_rotation.SetPosition(0); inttopchar(scroll_rotation.GetPosition,apc); strcat(strcat(apc,wutil.kpc_space),wutil.kpc_degree); self.static_angle_degree.SetText(apc); postmessage(self.hwindow,wm_command,0,0); Self.Affecter_le_nom_de_la_couleur; self.Num_edit_the_modulation.Set_num_value(0); end; {TRotation_d_image.Setupwindow} procedure TRotation_d_image.WMCommand(var Msg: TMessage); const id_btn_plus_5 = 1004; id_btn_moins_5 = 1005; id_check_Augmenter_la_taille_de_l_image = 1006; id_check_Adapter_la_taille_du_cadre = 1007; id_Au_lieu_d_utiliser_la_couleur_de_fond = 1008; id_autoriser_la_couleur_du_fond = 700; id_check_ajouter_un_gradian_radial = 1010; id_check_ajouter_un_gradian_lineaire = 1011; id_comment_modulation = 1013; var un_angle:integer; begin inherited WMCommand(Msg); enablewindow(GetItemHandle(id_ok), (scroll_rotation.GetPosition<>0) and (scroll_rotation.GetPosition<>360)); case msg.wparam of id_cancel: begin self.une_forme.rect:=self.ancien_rectangle; self.une_forme.BitMap.Assign(self.bitmap_before_rotation); invalidaterect(parent.hwindow,nil,false); end; id_btn_plus_5: begin un_angle:=scroll_rotation.GetPosition; un_angle:=(un_angle+5) mod 360; scroll_rotation.SetPosition(un_angle); Affecter_l_angle; Faire_une_rotation(un_angle*utile.pisur180); end; id_btn_moins_5: begin {dbn} un_angle:=scroll_rotation.GetPosition; if un_angle>5 then dec(un_angle,5) else un_angle:=(360+un_angle-5) mod 360; scroll_rotation.SetPosition(un_angle); Affecter_l_angle; Faire_une_rotation(un_angle*utile.pisur180); end; id_Au_lieu_d_utiliser_la_couleur_de_fond: begin self.check_ajouter_un_gradian_lineaire.Uncheck; self.check_ajouter_un_gradian_radial.Uncheck; un_angle:=scroll_rotation.GetPosition; Faire_une_rotation(un_angle*utile.pisur180); end; id_check_Augmenter_la_taille_de_l_image, id_check_Adapter_la_taille_du_cadre: begin Faire_une_rotation(scroll_rotation.GetPosition*utile.pisur180); end; 2000..3000: begin //Ecrit par denis bertin Self.scroll_rotation.SetPosition(msg.wparam-2000); Self.Affecter_l_angle; Self.Faire_une_rotation(Self.scroll_rotation.GetPosition*utile.pisur180); end; id_check_ajouter_un_gradian_radial: {écrit par Denis} begin self.check_ajouter_un_gradian_lineaire.Uncheck; check_Au_lieu_d_utiliser_la_couleur_de_fond.Uncheck; un_angle:=scroll_rotation.GetPosition; Faire_une_rotation(un_angle*utile.pisur180); end; id_check_ajouter_un_gradian_lineaire: begin self.check_ajouter_un_gradian_radial.Uncheck; self.check_Au_lieu_d_utiliser_la_couleur_de_fond.Uncheck; un_angle:=scroll_rotation.GetPosition; Faire_une_rotation(un_angle*utile.pisur180); end; end; {la case de Vierzon} enablewindow(self.check_placer_des_guides_angulaires.hwindow, (check_Augmenter_la_taille_de_l_image.GetCheck=bf_checked) and (check_Adapter_la_taille_du_cadre.GetCheck=bf_checked)); if self.check_Au_lieu_d_utiliser_la_couleur_de_fond.GetCheck=bf_checked then begin enablewindow(getitemhandle(id_autoriser_la_couleur_du_fond),false); static_nom_de_la_couleur.show(sw_hide); static_html_color.show(sw_hide); color.show(sw_hide); end else begin enablewindow(getitemhandle(id_autoriser_la_couleur_du_fond),true); static_nom_de_la_couleur.show(sw_show); static_html_color.show(sw_show); color.show(sw_show); end; if (self.check_Au_lieu_d_utiliser_la_couleur_de_fond.GetCheck=bf_checked) or (self.check_ajouter_un_gradian_radial.GetCheck=bf_checked) or (self.check_ajouter_un_gradian_lineaire.GetCheck=bf_checked) then begin self.num_edit_the_modulation.Show(sw_show); enablewindow(GetItemHandle(id_comment_modulation),true); end else begin self.num_edit_the_modulation.Show(sw_hide); enablewindow(GetItemHandle(id_comment_modulation),false); end; end; {TRotation_d_image.WMCommand} procedure TRotation_d_image.Affecter_l_angle; var apc:pc100; begin rotation.Set_Angle(scroll_rotation.GetPosition); inttopchar(scroll_rotation.GetPosition,apc); strcat(strcat(apc,wutil.kpc_space),wutil.kpc_degree); self.static_angle_degree.SetText(apc); updatewindow(self.static_angle_degree.hwindow); end; {If a methode is call twice then make a methode deliberatry-written by denis} {Si une méthode doit être utilisé deux fois, faire une procedure exprès} procedure TRotation_d_image.Faire_une_rotation(With_angle_radian:real); begin self.une_forme.rect:=self.ancien_rectangle; self.une_forme.BitMap.Assign(self.bitmap_before_rotation); self.une_forme.do_rotation(parent.hwindow,With_angle_radian, k_color_choose_to_cross_ray, self.check_Augmenter_la_taille_de_l_image.GetCheck=bf_checked, self.check_Adapter_la_taille_du_cadre.GetCheck=bf_checked, self.check_Au_lieu_d_utiliser_la_couleur_de_fond.GetCheck=bf_checked, self.check_ajouter_un_gradian_radial.GetCheck=bf_checked, self.check_ajouter_un_gradian_lineaire.GetCheck=bf_checked, self.Num_edit_the_modulation.Get_num_value); invalidaterect(parent.hwindow,nil,false); updatewindow(parent.hwindow); end; procedure TRotation_d_image.wmnum_edit_change(var msg:TMessage); begin Self.Faire_une_rotation(scroll_rotation.GetPosition*utile.pisur180); //Pour actualiser l'écran a chaque fois que le message est reçu by db. Invalidaterect(self.hwindow,nil,false); updatewindow(self.hwindow); end; procedure TRotation_d_image.wmset_painture_control(var Msg: TMessage); begin U_add_ray.k_color_choose_to_cross_ray:=msg.lparam; updatewindow(self.hwindow); Self.Faire_une_rotation(scroll_rotation.GetPosition*utile.pisur180); Self.Affecter_le_nom_de_la_couleur; end; procedure TRotation_d_image.Affecter_le_nom_de_la_couleur; var une_couleur_avec_son_nom:lec_color.T_color_name; pc_color_html:pc100; begin if (Self.Col_color<>nil) then begin Self.Col_color.Recheche_couleur_plus_proche( U_add_ray.k_color_choose_to_cross_ray,une_couleur_avec_son_nom); if une_couleur_avec_son_nom<>nil then self.static_nom_de_la_couleur.settext(une_couleur_avec_son_nom.name); end; k_dll.DLL_TcolorRef_to_text_html(U_add_ray.k_color_choose_to_cross_ray,pc_color_html,false); self.static_html_color.SetText(pc_color_html); end; procedure TRotation_d_image.WMHSCROLL(var Msg: TMessage); var apc:pc100; hwndScrollBar:hwnd; begin inherited WMHSCROLL(Msg); hwndScrollBar:=msg.LParam; if hwndScrollBar=self.scroll_rotation.hwindow then begin Self.Affecter_l_angle; Self.Faire_une_rotation(scroll_rotation.GetPosition*utile.pisur180); postmessage(self.hwindow,wm_command,0,0); end end; procedure TRotation_d_image.ok; var un_centre_de_rotation:tpoint; angle_en_radian:real; begin if (self.check_placer_des_guides_angulaires.GetCheck=BF_Checked) and (check_Augmenter_la_taille_de_l_image.GetCheck=bf_checked) and (check_Adapter_la_taille_du_cadre.GetCheck=bf_checked) then begin if self.Colec_guide_anglulaire<>nil then begin with self.colec_guide_anglulaire do begin angle_en_radian:=self.scroll_rotation.GetPosition*utile.pisur180; un_centre_de_rotation.x:=(self.une_forme.rect.Left+self.une_forme.rect.right) div 2; un_centre_de_rotation.y:=(self.une_forme.rect.top+self.une_forme.rect.bottom) div 2; add(U_object.T_Angle_Guide.Create( un_centre_de_rotation.x+round(cos(angle_en_radian+utile.pisur2)*(ancien_rectangle.bottom-ancien_rectangle.top)/2), un_centre_de_rotation.y-round(sin(angle_en_radian+utile.pisur2)*(ancien_rectangle.bottom-ancien_rectangle.top)/2),angle_en_radian)); add(U_object.T_Angle_Guide.Create( un_centre_de_rotation.x+round(cos(angle_en_radian-utile.pisur2)*(ancien_rectangle.bottom-ancien_rectangle.top)/2), un_centre_de_rotation.y-round(sin(angle_en_radian-utile.pisur2)*(ancien_rectangle.bottom-ancien_rectangle.top)/2),angle_en_radian)); add(U_object.T_Angle_Guide.Create( un_centre_de_rotation.x+round(cos(angle_en_radian)*(ancien_rectangle.right-ancien_rectangle.left)/2), un_centre_de_rotation.y-round(sin(angle_en_radian)*(ancien_rectangle.right-ancien_rectangle.left)/2),angle_en_radian+utile.pisur2)); add(U_object.T_Angle_Guide.Create( un_centre_de_rotation.x+round(cos(angle_en_radian+PI)*(ancien_rectangle.right-ancien_rectangle.left)/2), un_centre_de_rotation.y-round(sin(angle_en_radian+PI)*(ancien_rectangle.right-ancien_rectangle.left)/2),angle_en_radian+utile.pisur2)); if false then begin add(U_object.T_Angle_Guide.Create( un_centre_de_rotation.x+round(cos(angle_en_radian+utile.pisur2)*(self.une_forme.rect.bottom-self.une_forme.rect.top)/2), un_centre_de_rotation.y-round(sin(angle_en_radian+utile.pisur2)*(self.une_forme.rect.bottom-self.une_forme.rect.top)/2),angle_en_radian)); add(U_object.T_Angle_Guide.Create( un_centre_de_rotation.x+round(cos(angle_en_radian-utile.pisur2)*(self.une_forme.rect.bottom-self.une_forme.rect.top)/2), un_centre_de_rotation.y-round(sin(angle_en_radian-utile.pisur2)*(self.une_forme.rect.bottom-self.une_forme.rect.top)/2),angle_en_radian)); add(U_object.T_Angle_Guide.Create( un_centre_de_rotation.x+round(cos(angle_en_radian)*(self.une_forme.rect.right-self.une_forme.rect.left)/2), un_centre_de_rotation.y-round(sin(angle_en_radian)*(self.une_forme.rect.right-self.une_forme.rect.left)/2),angle_en_radian+utile.pisur2)); add(U_object.T_Angle_Guide.Create( un_centre_de_rotation.x+round(cos(angle_en_radian+PI)*(self.une_forme.rect.right-self.une_forme.rect.left)/2), un_centre_de_rotation.y-round(sin(angle_en_radian+PI)*(self.une_forme.rect.right-self.une_forme.rect.left)/2),angle_en_radian+utile.pisur2)); end; end; end; end; end; (************* Accentuer selon un seuil écrit par denis bertin **24.6.2012*****) constructor TAjuster_avec_seuil.Create(AParent:WBase.TWindow; forme:wformebm.Tforme_TBitMap); const dial_id_Accentuer = 1791; id_scroll_seuil = 100; id_static_pourcentage = 101; id_num_edit_coefficient = 102; id_radio_plus_grand = 200; id_radio_plus_petit = 201; id_check_limitation_de_la_lumiere = 300; begin inherited Create(AParent,dial_id_Accentuer,0); self.scroll_seuil:=WBase.TScrollbar.create(self,id_scroll_seuil,0); self.static_pourcentage:=Wbase.Tstatic.create(self,id_static_pourcentage,0); self.num_edit_coefficient:=dialbase.TNumEdit_plus_moins.Create(self,id_num_edit_coefficient,4,0,1000,0); self.num_edit_coefficient.Enable_Previent_ton_Parent(true); self.radio_plus_grand:=Wbase.tradiobutton.create(self,id_radio_plus_grand,0); self.radio_plus_petit:=Wbase.tradiobutton.create(self,id_radio_plus_petit,0); self.check_limitation_de_la_lumiere:=Wbase.TCheckBox.create(self,id_check_limitation_de_la_lumiere,0); self.une_forme:=forme; self.bitmap_before_rotation:=graphics.tbitmap.create; self.bitmap_before_rotation.assign(forme.BitMap); end; procedure TAjuster_avec_seuil.Setupwindow; begin inherited Setupwindow; self.check_limitation_de_la_lumiere.Check; self.radio_plus_petit.Check; self.scroll_seuil.SetRange(0,100); self.scroll_seuil.SetPosition(20); self.num_edit_coefficient.Set_num_value(144); afficher_le_pourcentage; end; procedure TAjuster_avec_seuil.Afficher_le_pourcentage; var apc:pc100; begin inttopchar(self.scroll_seuil.GetPosition,apc); strcat(apc,wutil.kpc_pourcent); self.static_pourcentage.SetText(apc); updatewindow(self.static_pourcentage.hwindow); end; procedure TAjuster_avec_seuil.wmnum_edit_change(var msg:TMessage); begin updatewindow(self.num_edit_coefficient.hwindow); Effectuer_le_calcul; end; procedure TAjuster_avec_seuil.WMHSCROLL(var Msg: TMessage); begin inherited WMHSCROLL(Msg); Afficher_le_pourcentage; Effectuer_le_calcul; end; procedure TAjuster_avec_seuil.effectuer_le_calcul; var i,j:integer; hue,lum,sat:real; seuil:real; coeff:real; rapide:U_fast_bitmap.TFastBitmap2; bool_plus_petit:boolean; bool_limitation:boolean; begin bool_limitation:=self.check_limitation_de_la_lumiere.GetCheck=Bf_Checked; bool_plus_petit:=self.radio_plus_petit.GetCheck=Bf_Checked; self.une_forme.BitMap.assign(self.bitmap_before_rotation); rapide.Copy(une_forme.BitMap); seuil:=self.scroll_seuil.GetPosition/100; coeff:=self.num_edit_coefficient.Get_num_value/100; for i:=0 to pred(une_forme.BitMap.Width) do for j:=0 to pred(une_forme.BitMap.height) do begin hls_rvb.tcolorref_to_hls(rapide.GetPixel(i,j),hue,lum,sat); if bool_plus_petit then begin if lum<seuil then begin lum:=lum*coeff; if bool_limitation then lum:=my_math.REAL_min(1.0,lum); rapide.SetPixel(i,j,hls_rvb.Get_HLS_RGB(hue,lum,sat)); end; end else begin if lum>seuil then begin lum:=lum*coeff; if bool_limitation then lum:=my_math.REAL_min(1.0,lum); rapide.SetPixel(i,j,hls_rvb.Get_HLS_RGB(hue,lum,sat)); end; end; end; invalidaterect(parent.hwindow,nil,false); Updatewindow(parent.hwindow); end; {TAjuster_avec_seuil.effectuer_la_calcul} procedure TAjuster_avec_seuil.WMCommand(var Msg: TMessage); const id_essayer = 1002; id_revenir = 1003; const id_radio_plus_grand = 200; const id_radio_plus_petit = 201; const id_check_limitation_de_la_lumiere = 300; begin inherited WMCommand(Msg); case msg.wparam of id_cancel: begin self.une_forme.BitMap.assign(self.bitmap_before_rotation); invalidaterect(parent.hwindow,nil,false); end; id_check_limitation_de_la_lumiere, id_essayer,id_radio_plus_grand,id_radio_plus_petit: begin self.effectuer_le_calcul; end; id_revenir: begin self.une_forme.BitMap.assign(self.bitmap_before_rotation); invalidaterect(parent.hwindow,nil,false); end; end; {case} end; {TAjuster_avec_seuil.WMCommand} begin with rec_transfert_centre_on_plot do begin radio_mini_guide:=true; radio_Placer_des_guides:=false; radio_placer_des_lignes:=false; check_en_couleur:=true; check_multicouleur:=false; end; k_color_interface:=uregedit.RegGetPrivateProfileInt( wmenuk.circle,z_open_file.string_je_suis_bien_d_accord_avec_mon_interface,g_base.RGB_Blanc); end.