Visualizzazione dei risultati da 1 a 4 su 4
  1. #1

    sovrapporre due immagini

    Ciao ragazzi, sapete se è possibile in asp.net incollare su un'immagine jpg un'altra immagine con un'alpha trasparenza del 70%?

  2. #2
    Ciao, con la classe Streaming puoi fare un po' tutto di seguito il codice viene usato per scrivere del testo sopra un' immagine. Puoi modificarlo a tue esigenze per sovrapporgli un' immagine, ma per l' alpha dovresti guardare su MSDN perchè è una cosa che non ho mai fatto :

    Importati questi namespace

    codice:
    System.Drawing;
    System.Drawing.Imaging;
    System.Drawing.Drawing2D;
    System.Drawing.Text;
    Il codice da usare :

    codice:
    Carico l' immagine da scrivere a video.
    Bitmap bitMapImage = new 
       System.Drawing.Bitmap(Server.MapPath("dallen.jpg" )  );
    Graphics graphicImage = Graphics.FromImage( bitMapImage ); 
    
    //Uso antialias che la rende piu' carina ...
    graphicImage.SmoothingMode = SmoothingMode.AntiAlias;
    
    //Scrivo del testo.
    graphicImage.DrawString( "That's my boy!", 
       new Font("Arial", 12,FontStyle.Bold ), 
       SystemBrushes.WindowText, new Point( 100, 250 ) ); 
    
    //Disegno un ovale intorno al testo.
    graphicImage.DrawArc(new Pen(Color.Red, 3), 90, 235, 150, 50, 0, 360); 
    
    //Impostiamo il contentype per validare il tutto
    Response.ContentType="image/jpeg"; 
    //Save the new image to the response output stream.
    bitMapImage.Save(Response.OutputStream, ImageFormat.Jpeg); 
    
    //Laviamo via la sporcizia.
    graphicImage.Dispose();
    bitMapImage.Dispose();
    Da qui mi sembra molto semplice sostituire il testo alla seconda immagine, per l' alpha ho scoperto devi usare graphicImage.aplha = ...


  3. #3
    ok.. primo errore.
    questo è lo script riportato paro paro
    codice:
    <%@ Page Language="C#" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
    <%@ Import namespace="System.Drawing" %>
    <%@ Import namespace="System.Drawing.Imaging" %>
    <%@ Import namespace="System.Drawing.Drawing2D" %>
    <%@ Import namespace="System.Drawing.Text" %>
    <script runat="server">
    //Carico l' immagine da scrivere a video.
    Bitmap bitMapImage = new 
       System.Drawing.Bitmap(Server.MapPath("dallen.jpg" )  );
    Graphics graphicImage = Graphics.FromImage( bitMapImage ); 
    
    //Uso antialias che la rende piu' carina ...
    graphicImage.SmoothingMode = SmoothingMode.AntiAlias;
    
    //Scrivo del testo.
    graphicImage.DrawString( "That's my boy!", 
       new Font("Arial", 12,FontStyle.Bold ), 
       SystemBrushes.WindowText, new Point( 100, 250 ) ); 
    
    //Disegno un ovale intorno al testo.
    graphicImage.DrawArc(new Pen(Color.Red, 3), 90, 235, 150, 50, 0, 360); 
    
    //Impostiamo il contentype per validare il tutto
    Response.ContentType="image/jpeg"; 
    //Save the new image to the response output stream.
    bitMapImage.Save(Response.OutputStream, ImageFormat.Jpeg); 
    
    //Laviamo via la sporcizia.
    graphicImage.Dispose();
    bitMapImage.Dispose();
    </script>
    questo è l'errore
    Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

    Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".



    <configuration>
    <system.web>
    <customErrors mode="Off"/>
    </system.web>
    </configuration>


    Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.



    <configuration>
    <system.web>
    <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
    </system.web>
    </configuration>
    che faccio?
    Sono così maledettamente attraente...

    QuickChat. (Asp e ajax)

  4. #4
    segui le istruzioni scritte

    apri il web.config e, se non la trovi, aggiunti la sezione <customErrors mode="Off" /> in modo da visualizzare il dettaglio dell'errore

    no pain no gain!

    ricordati che hai dei limiti...

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.