我有一个包含RGBA编码图像的C#字节数组.在WPF中显示此图像的最佳方法是什么?
一种选择是从字节数组创建一个BitmapSource并将其附加到Image控件.但是,创建一个BitmapSource需要一个用于RGBA32的PixelFormat,这在Windows中似乎不可用.
byte[] buffer = new byte[] { 25, 166, 0, 255, 90, 0, 120, 255 };
BitmapSource.Create(2, 1, 96d, 96d, PixelFormats.Bgra32, null, buffer, 4 * 2);
Run Code Online (Sandbox Code Playgroud)
我绝对不想在我的字节数组中交换像素.
我一直在努力解决这个问题,并没有看到解决方案.希望有人能帮助我.
我配置了HibernateTransactionManager.但是,我在日志文件中看到以下消息:
DEBUG [http-8080-1] AnnotationTransactionAttributeSource.getTransactionAttribute(107)| 使用属性[PROPAGATION_REQUIRED,ISOLATION_DEFAULT,-nl.forestfields.picnic.domain.model.exception.IllegalCostException]添加事务方法[cashIn]
DEBUG [http-8080-1] AnnotationTransactionAspect.createTransactionIfNecessary(267)| 跳过事务连接点[nl.forestfields.picnic.view.controller.ShoppingListController.cashIn],因为没有配置事务管理器
此外,如果发生异常,则不会回滚事务.
这是我的配置:
野餐servlet.xml中:
<beans>
<context:component-scan base-package="picnic" />
<context:annotation-config />
<tx:annotation-driven />
.
.
.
Run Code Online (Sandbox Code Playgroud)
野餐上下文db.xml:
<bean class="org.springframework.orm.hibernate3.LocalSessionFactoryBean" id="sessionFactory">
<property name="configLocation" value="classpath:hibernate.cfg.xml" />
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
</props>
</property>
<property name="dataSource" ref="dataSource" />
</bean>
<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName">
<value>${hibernate.connection.driver_class}</value>
</property>
<property name="url">
<value>${hibernate.connection.url}</value>
</property>
<property name="username">
<value>${hibernate.connection.username}</value>
</property>
<property name="password">
<value>${hibernate.connection.password}</value>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" …Run Code Online (Sandbox Code Playgroud)